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
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible). | |
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export. | |
var FORMAT_ONELINE = 'One-line'; | |
var FORMAT_MULTILINE = 'Multi-line'; | |
var FORMAT_PRETTY = 'Pretty'; | |
var LANGUAGE_JS = 'JavaScript'; | |
var LANGUAGE_PYTHON = 'Python'; |
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
sudo apt-get install curl git -y | |
sudo aptitude install git-completion | |
git config --global color.ui "auto" | |
git config --global user.name "Forrest Sutton" | |
git config --global user.email "<email>@gmail.com" | |
ssh-keygen -t dsa -C "<email>@gmail.com" |
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
//start mongodb | |
mongod --dbpath data | |
mongoimport --db opendata --collection atlenergy < energy_wb.json | |
#restore database from mongodump | |
mongorestore --collection col --db opendata opendata/col.bson | |
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
#split a name into three parts. you can also compare fname and mname when mname is blank | |
SELECT initialimport.CustomerNumber as CustNumb, | |
SUBSTRING_INDEX(SUBSTRING_INDEX(ContactPerson, ' ', 1), ' ', -1) as fname, | |
SUBSTRING_INDEX(SUBSTRING_INDEX(ContactPerson, ' ', 2), ' ', -1) as mname, | |
SUBSTRING_INDEX(SUBSTRING_INDEX(ContactPerson, ' ', 3), ' ', -1) as lname | |
FROM initialimport; | |
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
-O, [--skip-activerecord] # Skip Active Record files | |
-J, [--skip-prototype] # Skip Prototype files | |
-T, [--skip-testunit] # Skip Test::Unit files | |
You can get a complete list of all the available options by running the command: | |
$ rails new --help | |
Creating the app | |
$ sudo gem install rails | |
rails new YourApp -OJT |
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
the Hash Rocket syntax (:foo => "bar") | |
is deprecated in favor of the new-to-Ruby JSON-style hash (foo: "bar") | |
run inside project | |
rvm use 1.9.3-p327@rails3 --rvmrc | |
rails new APP -T | |
rails generate controller Users new --no-test-framework | |
rails generate model User name:string email:string --no-test-framework | |
rails _3.2.13_ new demo #when the sytem has rails 4 but you want rails 3.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
import pymongo | |
import sys | |
import traceback | |
# establish a connection to the database | |
connection = pymongo.Connection("mongodb://localhost", safe=True) | |
# get a handle to the school database | |
db=connection.school | |
students = db.students |
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
https://github.com/ahmednuaman/gdrive-cms-py-gae | |
http://developer.android.com/training/basics/activity-lifecycle/pausing.html | |
#speed test from the command line | |
wget -O /dev/null http://speedtest.wdc01.softlayer.com/downloads/test10.zip | |
#kinn bikes | |
http://www.kickstarter.com/projects/kinnbikes/kinn-a-fast-family-friendly-transport-bike?ref=tag |
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
#change to postgres user and open psql prompt | |
sudo -u postgres psql postgres` | |
#list databases | |
postgres=# \l | |
#list roles | |
postgres=# \du | |
#create role | |
postgres=# CREATE ROLE demorole1 WITH LOGIN ENCRYPTED PASSWORD 'password1' CREATEDB; |
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
sudo apt-get install openssh-server | |
sudo apt-get install python-pip | |
sudo apt-get install python-pip3 | |
envhost / | |
vim | |
ipython jupyter |
OlderNewer