build3r / TodayILearned

A repo where I list thing which I learn daily for sharing and referring back

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

banner

Long Term Knowledge


Twelve Factor App

https://12factor.net/

  1. Code base: One app should have one repo, if multiple app are sharing code then it should be refactored into library. One repo will have multiple deployments (prod, staging, local, variants etc)
  2. Dependencies: All projects should have a explicit dependency declaration and isolation from system dependency. If the app relies of system dependencies then it should be statically linked.
  3. Configuration: Any value like endpoints, keys etc should be refactored into configs. Best is to add them to env variables. They should not be committed to version control. In android it might not work, as we have to bundle them in apk. But we can still maintain configs separately.
  4. Resources: Both local and 3rd party services should be considered as attached resources. The resource should be referred only by the url/locator service. There should be only config change and no code change to swap our resources.
  5. Build, Release, Run: The build state transforms code into runnable, the release stage adds config to the runnable, the run stage take the release and executes it in the execution environment. The whole pipe line in one way flow and any new changes will require a new release. The run stage should be light weight and should able to run without user intervention in case of restarts.

Android

  • Activity Results API
  • Android dependency Graph
  • Constraint Layout with percentage
  • Vector Assets
  • Work Manager
  • Pull Apk from Device
    1. get Path adb shell pm path com.example.someapp
    2. Get APK adb pull /data/app/com.example.someapp-2.apk
  • Securing Keys in NDK Layer: You can store api key in the NDK layer which makes it difficult for bad actors to access them. Easy way is just add include C++ while creating project and add kets in native-lib.cpp file.
  • Best Way to SHA1, SHA256 and MD5 signatures of your debug or signing certificate
    • Set the appropriate variant
    • ./gradlew signingReport
    • You can even click gradle -> Project -> app -> tasks -> android -> signingReport
  • To get an APKCertSha256Digest
    • keytool -printcert -jarfile ~/PATH_TO/YOURAPKFILE.apk | grep "SHA256: " | cut -d " " -f 3 | xxd -r -p | openssl base64
    • echo "SHA256_TEXT_REPRESENTATION" | xxd -r -p | openssl base64
    • xxd does a hex dump of input, basically text to binary

Data Analysis

  1. Intro to Pandas
    1. If you make a column as index you can't access it with [colum] you will have to use df.index
    2. GroupBy you can directly call sum

Stoicism

Lessons From Stoics


Interesting TidBits

  • Python List Comprehension A list comprehension looks like this:
    new_list = [f(o) for o in a_list if o>0]
    This will return every element of a_list that is greater than 0, after passing it to the function f.

  • You can use the ADB accessibility to change the density of Physical Device or Emulator to test you app UI on small screen devices

    adb shell wm density //see current density
    adb shell wm density 580 //set a different density
    adb shell wm density reset //reset denity to default
    
  • You can check out only a subdirectory from a huge git repo. Really helpful when experimenting with google samples.

    • You need git version > 2.19 (GitHub is supported)
    • Do a sparse clone with no blobs and with history depth 1
    git clone \
    --depth 1  \
    --filter=blob:none  \
    --sparse \
      https://github.com/googlesamples/mlkit.git 
    • This will only clone a empty repo*
    • The enter the repo and sparse-checkout the subdirectory which you need
    git sparse-checkout set android/material-showcase

Machine Learning


Tools


MacOS

  • Command-Option-C will copy the file path
  • Holding control during screenshot will copy directly to clipboard
  • Apple Books Directory /Users/<Name>/Library/Mobile Documents/iCloud~com~apple~iBooks/Documents

Fundamentals Revisit

Entrepreneurship

Life Lessons

  • You won't get anywhere by making other people feel stupid, no matter how correct you are.
  • Being kind is harder than being clever.

Inspired by ashandilya

About

A repo where I list thing which I learn daily for sharing and referring back

License:Creative Commons Zero v1.0 Universal


Languages

Language:Shell 100.0%