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
Here is an example how to build and run ApiDemos sample project.
Go to your SDK folder, then to ../samples/android-#/ApiDemos, where # is API Level.
Start terminal in this folder.
Run android list targets and find target with API Level that is equal or higher then what you've chosen for # on step 1. Lets call this target X. In my case X equals 21. It looks like in your case X equals 1.
Run android update project -p . -n ApiDemos -t X (change X to correct value)
Run ant debug
Run adb install bin/ApiDemos-debug.apk
Setting up a Device for Development
Set up the submodule for the first time:
[~]$ cd ~/main/
[main]$ git submodule add git://github.com/my/submodule.git ./subm
[main]$ git submodule update --init
[main]$ git commit ./submodule -m "Added submodule as ./subm"
Fetch submodules after cloning a repository:
[~]$ git clone git://github.com/my/main.git ~/main
[~]$ cd ~/main/
[main]$ git submodule update --init
Pull upstream main repo changes and update submodule contents:
@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
@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
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: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
@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) = {
scala> callByValue(printFoo())
Func Foo invoked
a1="a1"
a2="a2"
scala> callByName(printFoo())
Func Foo invoked
b1="b1"
Func Foo invoked
b2="b2"
#!/bin/bash
set -o errexit
set -o nounset
if [[ ${#} -ne 1 ]]
then
echo "Usage: ${0} upstart-conf-file" >&2
exit 1
fi
@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.