Skip to content

Instantly share code, notes, and snippets.

View crispgm's full-sized avatar
Caffeinated

David Zhang crispgm

Caffeinated
View GitHub Profile
Olympus Share APP control urls over E-M10 camera, still to investigate..
http://192.168.0.10
http://192.168.0.10/
http://192.168.0.10/clear_resvflg.cgi
http://192.168.0.10/exec_pwoff.cgi
http://192.168.0.10/exec_shutter.cgi?com=1st2ndpush
http://192.168.0.10/exec_shutter.cgi?com=1stpush
http://192.168.0.10/exec_shutter.cgi?com=1strelease
http://192.168.0.10/exec_shutter.cgi?com=2nd1strelease
@crispgm
crispgm / git-remote-set-url.md
Created June 4, 2016 14:08
When you rename a project on GitHub

show the upstreams

git remote -v

remove origin

git remote remove origin
@crispgm
crispgm / git-fetch-upstream.md
Last active June 4, 2016 14:10
sync forked project
git remote add upstream <ORIGINAL>
git fetch upstream
git checkout master
git merge upstream/master
@crispgm
crispgm / docker-commands.md
Created September 7, 2016 03:54
Docker commands

Build Dockerfiles:

docker build -t crisp/nginx /path/to/Dockerfile

Run in daemon mode:

docker run --name nginx -d -p PORT1:PORT1 -p PORTn:PORTn -v VOL1:VOL1 -v VOLn:VOLn crisp/nginx
@crispgm
crispgm / forked-repo-ahead-master.md
Created September 24, 2016 02:21
Forked repo is ahead of master
git checkout master
git reset --hard upstream/master
git push --force
int
foo(bar)
    int bar
{
    ...
}
@crispgm
crispgm / this_year_rails.rb
Created July 4, 2017 03:03
Monkey partch to add `this_year?` to Rails
module DateAndTime
module Calculations
def this_year?
year == ::Date.current.year
end
end
end
@crispgm
crispgm / remove_file_from_last_commit.sh
Last active December 31, 2019 02:53 — forked from 0x8BADFOOD/remove_file_from_last_commit
[Git] Remove file from last commit
# roll back commit
git reset --soft HEAD^
# remove file from index
git reset HEAD path/to/unwanted_file
# commit again without unwanted files
git commit -m "My commit message"
# Source: http://stackoverflow.com/questions/12481639/remove-files-from-git-commit
@crispgm
crispgm / random-sample.awk
Last active December 17, 2018 09:31
Random sample from a file with awk
awk 'BEGIN {srand()} !/^$/ { if (rand() <= .01) print $0}'
@crispgm
crispgm / crontab-log.sh
Last active January 3, 2020 06:15
View crontab log
grep CRON /var/log/syslog