Skip to content

Instantly share code, notes, and snippets.

View larsxschneider's full-sized avatar

Lars Schneider larsxschneider

View GitHub Profile
@larsxschneider
larsxschneider / gist:1461116
Created December 11, 2011 15:25
Load all git submodules
git submodule update --init --recursive
@larsxschneider
larsxschneider / removeRemote.sh
Created February 29, 2012 14:20
Remove all merged branches on a Github
git fetch | git branch --merged | grep -v " master" | grep -v "* " | xargs -n 1 -I {} sh -c 'echo "Deleting" {}; git branch -d {}; git push --delete origin {}; git branch -dr {}'
@larsxschneider
larsxschneider / ws
Created March 2, 2012 13:11
Remove trailing whitespaces
find . -not \( -name .svn -prune -o -name .git -prune \) -type f -print0 | xargs -0 sed -i '' -E "s/[[:space:]]*$//"
@larsxschneider
larsxschneider / tab
Created March 2, 2012 14:00
Replace tab with whitespaces
find . -not \( -name .svn -prune -o -name .git -prune \) -type f -exec sed -i "" $'s/\t/ /g' {} \;
@larsxschneider
larsxschneider / tagversion
Created March 4, 2012 13:23
Tag a version
git tag -a v1.0.0 -m "v1.0.0" a5381e3c711c3489071da832a32b6efdeae3f0d6
@larsxschneider
larsxschneider / jsmethods.js
Created March 30, 2012 13:50
Render all JS methods
function getMethods(obj) {
var result = [];
for (var id in obj) {
try {
if (typeof(obj[id]) == "function") {
result.push(id + ": " + obj[id].toString());
}
} catch (err) {
result.push(id + ": inaccessible");
}
@larsxschneider
larsxschneider / .git-fix-whitespaces.sh
Created October 26, 2012 08:30 — forked from torsten/fix-whitespace.sh
Pre-commit hook script for git to fix various source file things.
#!/bin/sh
# Pre-commit hook for git which removes trailing whitespace, converts tabs to spaces, and enforces a max line length.
# The script does not process files that are partially staged. Reason: The `git add` in the last line would fully
# stage a file which is not what the user wants.
if git rev-parse --verify HEAD >/dev/null 2>&1 ; then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
@larsxschneider
larsxschneider / github.com.js
Created October 31, 2012 17:25 — forked from agnoster/github.com.js
View/edit a file in a pull request by clicking on the line number.
/**
* 1) Use http://defunkt.io/dotjs/
* 2) Install this into ~/.js/github.com.js
* 3) Click on a line number in the editor to open the file at this position (e.g. to see more context)
* 4) Alt+Click on a line number in the editor to edit the file at this position
*
* This script is based on @agnoster's idea: https://gist.github.com/3906361
*/
function getBranch() {
@larsxschneider
larsxschneider / Localize.h
Last active December 11, 2015 09:19
Generate localization files for iOS and Javascript (jquery globalize).
#pragma once
// Use this macro to localize strings in "common" code (code that is used in iOS and Javascript)
#define AIMLocalizedString(string, description) string
@larsxschneider
larsxschneider / run_impala_query.py
Last active August 29, 2015 14:14
Run Impala query on EMR cluster and store results as CSV file on S3
import boto.emr
from boto.s3.key import Key
from boto.s3.connection import S3Connection
aws_key = 'your-key'
aws_secret = 'your-secret'
bucket_name = 'your-bucket-name'
result_file_name = 'your-result-file-path'
s3_connection = S3Connection(aws_key, aws_secret, validate_certs=False)