Skip to content

Instantly share code, notes, and snippets.

View larsxschneider's full-sized avatar

Lars Schneider larsxschneider

View GitHub Profile
@larsxschneider
larsxschneider / find-extensions-for-lfs.py
Last active October 8, 2016 13:09
Scripts to help migrating source code to Git / Git LFS
#!/usr/bin/env python
#
# Script to identify extensions in a Git repository that should go to LFS
#
import os
cwd = os.getcwd()
min_size_mb = 0.5
result = {}
@larsxschneider
larsxschneider / show.sh
Last active March 25, 2016 17:55
Print Git HTTPS credentials stored with the credentials helper
#!/usr/bin/env bash
printf "protocol=https\nhost=github.com\n\n" | git credential-$(git config credential.helper) get
@larsxschneider
larsxschneider / lfs-filesize.sh
Last active January 20, 2016 15:06
Print size of the LFS files in a repo and order by size
git-lfs ls-files | cut -c 14- | tr '\n' '\0' | xargs -0 ls -l | awk '{$1=$2=$3=$4=$6=$7=$8="";print}' | sort -n
@larsxschneider
larsxschneider / git-lfsclone.sh
Last active September 12, 2024 02:17
Clone Git repositories and download LFS files in parallel
#!/usr/bin/env bash
#
# Clone Git repositories and download LFS files in parallel
#
set -e
CLEAN_ERROR='push @lines, $_;splice @lines, 0, 7 if /error: external filter failed/;print shift @lines if @lines > 6}{ print @lines;'
git -c filter.lfs.smudge= \
-c filter.lfs.required=false \
@larsxschneider
larsxschneider / encoding.py
Created August 31, 2015 13:20
Try encoding in Python
codecs=[
'ascii',
'big5',
'big5hkscs ',
'cp037',
'cp424',
'cp437',
'cp500',
'cp720',
'cp737',
@larsxschneider
larsxschneider / test.sh
Last active August 28, 2015 08:07
git line ending bug?
#!/bin/sh
#
# !!! Please run this test on Windows !!!
#
# Unexpected result confirmed with the following versions:
# $ git --version
# git version 1.9.5.msysgit.1
# git version 2.5.0.windows.1
#
@larsxschneider
larsxschneider / autodesk-open-source.rb
Created August 2, 2015 17:29
Generates a list of all Autodesk open source repos
#!/usr/bin/env ruby
require 'rubygems'
require 'bundler/setup'
require 'octokit'
if $0 == __FILE__
dotcom_token = ARGV[1]
@larsxschneider
larsxschneider / gist:a31fb77c7e9a9c9b81da
Created June 28, 2015 17:12
Git LFS test using BFG
#!/usr/bin/env bash
GIT_REMOTE="https://path/to/your/repo.git"
# Download BFG from here:
# https://github.com/rtyley/bfg-repo-cleaner/releases/download/git-lfs-alpha/bfg-1.12.4-SNAPSHOT-git-lfs-7242876.jar
GIT_BFG="/path/to/downloaded/bfg-1.12.4-SNAPSHOT-git-lfs-7242876.jar"
rm -rf bfg-upload
mkdir bfg-upload
pushd bfg-upload > /dev/null
@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)
@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