Skip to content

Instantly share code, notes, and snippets.

View gist:5ff51ef623ff464c870b4f1b0a08e3ed
# Move the current head so that it's pointing at the old commit
# Leave the index intact for redoing the commit.
# HEAD@{1} gives you "the commit that HEAD pointed at before
# it was moved to where it currently points at". Note that this is
# different from HEAD~1, which gives you "the commit that is the
# parent node of the commit that HEAD is currently pointing to."
git reset --soft HEAD@{1}
# install git if not installed
if ! hash git 2>/dev/null; then
apt-get install -y git
#install unzip if not installed
if ! hash unzip 2>/dev/null; then
View gist:be1b6eb04d05b3333490185f8883c072
screen -ls | grep Detached | cut -d. -f1 | awk '{print $1}' | xargs kill
finder39 / Makefile.config
Last active Dec 23, 2016
caffe makefile that hopefully works
View Makefile.config
## Refer to
# Contributions simplifying and improving our build system are welcome!
# 32 bit / 64 bit indexing
USE_INDEX_64 := 1
# GreenTea (ViennaCL/OpenCL) backend switch
# Enable the CUDA backend
# USE_CUDA := 1
finder39 / gist:82ebafbfce5569482ef5
Created Dec 9, 2015
Add new Xcode UUID to plugins
View gist:82ebafbfce5569482ef5
Get new UUID of Xcode with
`defaults read /Applications/ DVTPlugInCompatibilityUUID`
Then put into Info.plist of plugins located at:
`~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins`
View gist:a919413a1ca8ad1c879b
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
finder39 / gist:4f0f8b1972c677381631
Created Mar 7, 2015
Remove ll types of files from git repo
View gist:4f0f8b1972c677381631
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
View gist:24cc271adc6c127fc890
# Xcode
View gist:dc77e2693d71faf9f691
init: function(elevators, floors) {
var getByFloor = function (value) {
var result = floorsWaiting.filter(function(o){return o.floorNum == value;} );
return result? result[0] : null; // or undefined
var getElevatorById = function (arr, value) {
var result = arr.filter(function(o){return o.iden == value;} );
return result? result[0] : null; // or undefined
View jsonDictionaryHelpers.swift
import Foundation
func getBool(object:AnyObject?) -> Bool? {
if let temp = object as? Bool {
return temp
} else if let temp = object as? NSNumber {
return temp.boolValue
} else if let temp = object as? Int {
return Bool(temp)
} else if let temp = object as? String {