This file contains 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
<?php | |
// Author: Ngo Minh Nam | |
$dir = "/path/to/your/repo/"; | |
$output = array(); | |
chdir($dir); | |
exec("git log",$output); | |
$history = array(); | |
foreach($output as $line){ | |
if(strpos($line, 'commit')===0){ |
This file contains 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 boto3 | |
import uuid | |
class CognitoUserFileUploader(object): | |
def __init__(self, *args, **kwargs): | |
self.__dict__.update(kwargs) | |
self.id_token = self.get_cognito_id_token( | |
self.username, self.refresh_token, | |
self.device_key, self.client_id |
This file contains 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
# remap prefix from 'C-b' to 'C-a' | |
unbind C-b | |
set-option -g prefix C-a | |
bind-key C-a send-prefix | |
setw -g mode-keys vi | |
set -g default-terminal 'screen-256color' | |
set -g history-limit 10000 | |
# Setup 'v' to begin selection as in Vim |
This file contains 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
# If you come from bash you might have to change your $PATH. | |
# export PATH=$HOME/bin:/usr/local/bin:$PATH | |
# Path to your oh-my-zsh installation. | |
export ZSH=/Users/nam/.oh-my-zsh | |
# Set name of the theme to load. Optionally, if you set this to "random" | |
# it'll load a random theme each time that oh-my-zsh is loaded. | |
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes | |
ZSH_THEME="simple" |
This file contains 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 os | |
import json | |
import importlib | |
import inspect | |
import boto3 | |
SNS_ARN = os.environ.get('SNS_ARN', None) | |
def import_and_get_task(task_path): |
This file contains 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
// for more debug logging, add this to ./conf/log4j-console.properties | |
// log4j.logger.com.thinkaurelius.titan.graphdb.database.management=DEBUG | |
// Open the graph | |
graph = TitanFactory.build().set('storage.backend','inmemory').set('schema.default','none').set('query.force-index',true).open(); | |
g = graph.traversal() | |
// Create an index on new property key. Index created on new property is ENABLED immediately. | |
if (graph.getOpenTransactions()) graph.tx().rollback() | |
mgmt = graph.openManagement() |
This file contains 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
# NOTE: these are Django new style middleware classes, won't work with | |
# Django < 1.10 | |
from django.conf import settings | |
ACAH = [ | |
'Content-Type', 'X-Amz-Date', 'Authorization', | |
'X-Api-Key', 'X-Amz-Security-Token', 'x-requested-with', | |
] |
This file contains 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
#!/bin/bash | |
# Python stuff | |
sudo easy_install pip | |
sudo pip install virtualenvwrapper --ignore-installed six | |
# Sublime cli | |
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/sublime | |
# Brew and stuff |
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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
""" | |
Use setattr | |
""" | |
# Normal | |
item.price = self.request['price'] | |
item.quantity = self.request['quantity'] | |
item.shipping = self.request['shipping'] | |
item.save() |
NewerOlder