Skip to content

Instantly share code, notes, and snippets.

@peterprokop
Last active January 22, 2020 16:25
Show Gist options
  • Save peterprokop/63df2c6a060830ef72494079124891e2 to your computer and use it in GitHub Desktop.
Save peterprokop/63df2c6a060830ef72494079124891e2 to your computer and use it in GitHub Desktop.
CHEAT-SHEETS.md
* iOS
`~/Library/Developer/CoreSimulator/Devices` - iOS simulators folder
`instruments -s devices` - list all runnable devices/simulators
`Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport` - device support dir
* GIT
`git submodule update --init --recursive` - grab submodules
`git branch --sort=-committerdate | tail -n 50 | xargs git branch -d` delete 50 oldest branches
`git checkout -t <name of remote>/test` - checkout remote branch
`git push --delete origin tagname` - delete remote tag
`git tag --delete tagname` - delete local tag
`git shortlog --summary --numbered --email` - show all committers
* SSH
`ssh-add -l` - list all available keys
`ssh-keygen` - generate new key
* Fastlane
`fastlane run register_devices devices_file:<filepath>`
`fastlane match adhoc --force_for_new_devices`
* CocoaPods
`pod trunk push SwiftOverlays.podspec`
* CP
You can copy the content of a folder /source to another existing folder /dest with the command
`cp -a /source/. /dest/`
The -a option is an improved recursive option, that preserve all file attributes, and also preserve symlinks.
The . at end of the source path is a specific cp syntax that allow to copy all files and folders, included hidden ones.
* ADB
Install on specific device:
`adb -s "deviceIDfromlist" install apkName`
Device list:
`~/Library/Android/sdk/platform-tools/adb devices -l`
* Bash batch rename
`for i in *.pkg ; do mv "$i" "${i/-[0-9.]*.pkg/.pkg}" ; done`
`for i in *.jpeg ; do mv "$i" "${i/.jpeg/.jpg}" ; done`
* Bash general
`du -sh * | sort -hr` - disc usage by folders/files
`grep -rni '.' -e 'search_term'` - searches recursively (`-r`) current folder, case-insensitive (`-i`), shows line numbers (`-n`) or file names (`-l`)
`find . \( -iname \*.swift \) -exec wc -l '{}' \+` - Swift LOC
`find . \( -iname \*.m -o -iname \*.mm -o -iname \*.h \) -exec wc -l '{}' \+` - Swift + ObjC LOC
* Java
export JAVA_HOME="/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home"
/usr/libexec/java_home -V
Version managing: https://stackoverflow.com/questions/52524112/how-do-i-install-java-on-mac-osx-allowing-version-switching
* Docker
`docker ps` - list running
`docker images -a` - list images
`docker system prune --volumes` - remove all stopped containers, all dangling images, and all unused networks, all unused volumes
`docker image prune -a` - remove all images which are not referenced by any existing container
* JQ
`cat ts5.json | jq ".content | fromjson"` - get JSON from field and unescape it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment