Skip to content

Instantly share code, notes, and snippets.

View donigian's full-sized avatar

armen donigian donigian

  • Jet Propulsion Labratory
  • Pasadena
View GitHub Profile
To set up a new Chef workstation:
+ download vagrant
+ download virtualbox
+ vagrant box add precise64
+ vagrant plugin install vagrant-berkshelf
+ vagrant plugin install vagrant-omnibus
+ git clone [email protected]:gpn-dev/chef-repo.git
+ vagrant up
vagrant up
For example, if your commit history is A-B-C-D-E-F with F as HEAD, and you want to change the author of C and D, then you would...
Specify git rebase -i B
change the lines for both C and D to edit
Once the rebase started, it would first pause at C
You would git commit --amend --author="Author Name <[email protected]>"
Then git rebase --continue
It would pause again at D
Then you would git commit --amend --author="Author Name <[email protected]>" again
git rebase --continue
@donigian
donigian / chef knife bootstrap
Created December 19, 2013 22:13
chef knife bootstrap
✗ knife bootstrap localhost \
--ssh-user vagrant \
--ssh-password vagrant \
--ssh-port 2222 \
--run-list "recipe[apt]" \
--sudo
Bootstrapping Chef on localhost
localhost --2013-12-19 21:47:47-- https://www.opscode.com/chef/install.sh
localhost Resolving www.opscode.com (www.opscode.com)... 184.106.28.91
localhost Connecting to www.opscode.com (www.opscode.com)|184.106.28.91|:443... connected.
#!/bin/bash
set -o errexit
set -o nounset
if [[ ${#} -ne 1 ]]
then
echo "Usage: ${0} upstart-conf-file" >&2
exit 1
fi
scala> callByValue(printFoo())
Func Foo invoked
a1="a1"
a2="a2"
scala> callByName(printFoo())
Func Foo invoked
b1="b1"
Func Foo invoked
b2="b2"
@donigian
donigian / Scala Bits: Call By Name vs Call By Value
Last active December 31, 2015 12:19
Scala Bits: Call By Name vs Call By Value
def printFoo() = {
println("Func Foo invoked")
}
def callByValue(a: String) = {
println("a1=" + a)
println("a2=" + a)
}
def callByName(b: => String) = {
@donigian
donigian / gist:6773492
Last active December 24, 2015 08:49
scala zsh project start up script
function mk-scala-dir() {
mkdir -p src/main/{resources,scala}
mkdir -p test/{resources,scala}
mkdir -p project/
touch build.sbt
printf 'name := "sample"\n\n' >> build.sbt
printf 'version := "0.0.1"\n\n' >>build.sbt
printf 'scalaVersion := "2.10.0"\n' >> build.sbt
touch project/build.properties
rmongodb Example
library(rmongodb)
mg2 <- mongo.create()
print(mongo.get.databases(mg2))
print(mongo.get.database.collections(mg2, 'db'))
buf <- mongo.bson.buffer.create()
mongo.bson.buffer.start.object(buf, 'AGE')
mongo.bson.buffer.append(buf, '$lt', 10)
mongo.bson.buffer.finish.object(buf)
@donigian
donigian / gist:5816211
Last active December 18, 2015 17:09
Git Rebase Workflow
$ git checkout master && git pull
$ git checkout -b topic
-> Work a bit and commit changes
-> Preview changes from master
$ git checkout master # Think about checking out branch performing action to
$ git pull
$ git checkout topic
$ git rebase master
-> When unit & integration tests pass
$ git checkout master
@donigian
donigian / postgres sql cheat sheet
Last active February 2, 2017 00:52
postgres sql cheat sheet
sudo service postgresql restart
sudo service postgresql status
sudo service postgresql stop
sudo service postgresql status
sudo crontab -l
tail -f /var/log/postgresql/postgresql-9.1-main.log
/etc/services