Skip to content

Instantly share code, notes, and snippets.

View khalib's full-sized avatar

Caleb Whang khalib

  • San Francisco Giants
  • San Francisco, CA
View GitHub Profile
@khalib
khalib / mirror.git
Last active August 29, 2015 14:02
Mirror deviated branch to an existing branch
# Branch DEV has extra files and commits that are not needed anymore
# DEV is to be a mirror of MASTER
# Get the latest DEV branch
git checkout DEV
git pull origin DEV
# Get the latest MASTER branch
git checkout MASTER
git pull origin MASTER
@khalib
khalib / deploy.sh
Last active June 1, 2016 21:50
Dev Sandbox Deploy
###########
# LOCAL #
###########
# Copy Acquia ssh key for Git access.
scp -i ~/.ssh/cs_education.key ~/.ssh/acquia_graphite_rs* root@ec2-54-215-27-192.us-west-1.compute.amazonaws.com:/root/.ssh/
############
# SERVER #
############
# Change ssh key access.
@khalib
khalib / cs-api-php-example.php
Last active August 29, 2015 14:09
Example usage of the Common Sense api-php driver.
$api_info = variable_get('csm_api_info');
// the third TRUE param sets to use DEV api server. Remove for launch.
$api = new CommonSenseApi($api_info['clientId'], $api_info['appId'], TRUE);
// Get education API instance.
// There are two magic methods to fetch data from the API
// <type>_list($options) and <type>_item($id, $options)
// where <type> is one of: products, blog, app_flows, lists, user_reviews, boards
$education = $api->education();
[docker version]
Client version: 1.5.0
Client API version: 1.17
Go version (client): go1.4.1
Git commit (client): a8a31ef
OS/Arch (client): darwin/amd64
Server version: 1.5.0
Server API version: 1.17
Go version (server): go1.4.1
Git commit (server): a8a31ef
<?php
$databases = array (
'default' =>
array (
'default' =>
array (
'database' => 'graphite_150623',
'username' => 'graphite',
'password' => 'graphite',
@khalib
khalib / graphite_init.sh
Created June 26, 2015 23:42
Graphite Drush Init
drush -l local.graphite.org vset preprocess_js 0 --yes
drush -l local.graphite.org vset preprocess_css 0 --yes
drush -l local.graphite.org pm-disable -y masquerade
drush -l local.graphite.org pm-disable -y cdn
drush -l local.graphite.org vset honeypot_time_limit 0 --yes
drush -l local.graphite.org vset error_level 2 --yes
drush -l local.graphite.org vset csm_migration_d6_hostname local.csm.org --yes
drush -l local.graphite.org vset tlr_csm_sync_csm_api_host local.csm.org --yes
# Save incoming data.
user = User();
user.id = <id>
user.first_name = <firstName>
user.last_name = <lastName>
db.users.save(user)
# Output API data - get a list of users.
output = User.find({}, { limit: 15 })
@khalib
khalib / qa-v6.3-rc10.sh
Created March 29, 2016 03:45
Dry Run Features List: qa-v6.3-rc10
Name Feature Status Version State
BEF Test Content bef_test_content Disabled 7.x-3.2
CSM Education csm_education_feature Enabled 7.x-5.0
CSM Field Bases csm_field_bases_feature Enabled 7.x-4.3
CSM Learning Ratings csm_learning_ratings_feature Enabled 7.x-6.3
CSM Migration Feature csm_migration_feature Enabled 7.x-3.8
CSM Schools csm_schools_feature Enabled 7.x-5.3
CSM Taxonomies Feature csm_taxonomies_feature Enabled 7.x-5.0
Date Migration Example date_migrate_example Disabled 7.x-2.9
Features Extra test feature features_extra_test Disabled
@khalib
khalib / release-v6.3.sh
Created March 30, 2016 02:15
Release v6.3 Feature List after running reverts
Name Feature Status Version State
BEF Test Content bef_test_content Disabled 7.x-3.2
CSM Education csm_education_feature Enabled 7.x-5.0
CSM Field Bases csm_field_bases_feature Enabled 7.x-4.3
CSM Learning Ratings csm_learning_ratings_feature Enabled 7.x-6.3
CSM Migration Feature csm_migration_feature Enabled 7.x-3.8
CSM Schools csm_schools_feature Enabled 7.x-5.3
CSM Taxonomies Feature csm_taxonomies_feature Enabled 7.x-5.0
Date Migration Example date_migrate_example Disabled 7.x-2.9
Features Extra test feature features_extra_test Disabled
@khalib
khalib / import.py
Last active April 22, 2016 07:00
Python script that imports JSON game data from the MLB Gameday API to a MS SQL database.
"""
JSON data importer to a MS SQL database.
NOTE: This code has not been tested and is for the sole purpose of showing example code
for a simple data import workflow using a non-optimized design without error handling.
"""
import json
import urllib
from os import getenv