This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| settings dir: ~/.aws/ | |
| # s3 bucket size | |
| aws s3 ls --summarize --human-readable --recursive s3://bucket-name/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xcrun simctl io booted recordVideo appvideo.mov |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defaults write $(mdls -name kMDItemCFBundleIdentifier -raw /Applications/MindNode.app) AppleLanguages '("en-US")' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #write out current crontab | |
| crontab -l > mycron | |
| #echo new cron into cron file | |
| echo "00 09 * * 1-5 echo hello" >> mycron | |
| #install new cron file | |
| crontab mycron | |
| rm mycron |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # connect to tty on Docker for Mac VM | |
| screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty | |
| # disconnect that session but leave it open in background | |
| Ctrl-a d | |
| # list that session that's still running in background | |
| screen -ls | |
| # reconnect to that session (don't open a new one, that won't work and 2nd tty will give you garbled screen) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Delete docker container by name example | |
| #!/bin/bash | |
| CONTAINERID="$(docker ps | grep $1 | cut -d" " -f1)" | |
| docker rm -f $CONTAINERID 1> /dev/null 2> /dev/null | |
| if [ $? -eq 0 ] | |
| then | |
| echo "Successfully delete container $CONTAINERID" | |
| exit 0 | |
| else | |
| echo "Container not found" >&2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Archive and zip: tar -zcvf test.tar.gz test.txt | |
| Unzip: tar -zxvf test.tar.gz | |
| List ordered by size: ls -lS | |
| Return first field from text file (space delimeted): cut -d" " -f1 somefile.txt (-d delimeter, -f field number) | |
| SSH not send locale: | |
| Remove SendEnv LANG LC_* line in /etc/ssh/ssh_config | |
| SSH not accept locale: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Run container with specified pgdata path: | |
| docker run --name pgs-test -p 5432:5432 -v /Users/{user}/pgdata:/var/lib/postgresql/data -e POSTGRES_USER=usr -e POSTGRES_PASSWORD=pass1 -e POSTGRES_DB=db -d pgs-test | |
| Backup: | |
| docker exec pgs-test bash -c 'pg_dump -U usr --format=t --file=/pgback/back1.tar todo' | |
| Restore: | |
| docker exec pgs-test bash -c 'pg_restore -Uusr --create --clean --dbname=todo /pgback/back1.tar' | |
| #dump db |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Observable.deferred { | |
| return NotificationCenter.default | |
| .rx | |
| .notification(notifName) | |
| .map { _ ... } | |
| .startWith(IdentityProviderManager.hasFacebookIdentity) | |
| }.distinctUntilChanged()``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extension ObservableType { | |
| func polling(interval: RxTimeInterval, scheduler: SchedulerType = MainScheduler.instance) -> Observable<E> { | |
| return Observable<Int>.interval(interval, scheduler: scheduler) | |
| .flatMapFirst { _ in | |
| return self.asObservable() | |
| } | |
| } | |
| } |