Skip to content

Instantly share code, notes, and snippets.

@sit
sit / gitproxy-socat
Created January 20, 2009 02:30
A simple wrapper around socat to use as a git proxy command
#!/bin/sh
# Use socat to proxy git through an HTTP CONNECT firewall.
# Useful if you are trying to clone git:// from inside a company.
# Requires that the proxy allows CONNECT to port 9418.
#
# Save this file as gitproxy somewhere in your path (e.g., ~/bin) and then run
# chmod +x gitproxy
# git config --global core.gitproxy gitproxy
#
# More details at http://tinyurl.com/8xvpny
@sit
sit / ctime
Created March 22, 2009 14:35
Simple Perl script to convert unix epoch times to text.
#!/usr/bin/perl -w
#
# Convert unix times (on command line or one-per-line via stdin)
# to human readable times in local timezone.
#
if (@ARGV) {
print join("\n", map { scalar localtime($_); } @ARGV), "\n";
} else {
while (<STDIN>) {
chomp;
#!/bin/sh
#
# Convert from a MTS to a mp4 file using HandbrakeCLI
# Handbrake available from, for example, http://handbrake.fr/downloads2.php
#
# Renames files as prefixYYYYMMDD_basename.mp4 in the current directory.
# If you have an AVCHD directory, for example, you could run
# mts2mp4 /Volumes/SDCARD/PRIVATE/BDMV/STREAM/*.MTS
# to convert from your SDCARD into your current directory (on OS X).
#
@sit
sit / .gitignore
Created January 14, 2011 19:44
A basic .gitignore file for Hudson configurations
# The following ignores...
# Miscellaneous Hudson litter
*.log
*.tmp
*.old
*.bak
*.jar
*.json
# Generated Hudson state
@sit
sit / propertyMissingPuzzle.groovy
Created September 23, 2011 16:08
A puzzle about why Groovy behaves a certain way with respect to propertyMissing
/*
* A minimal script to demonstrate the problem discussed at
* http://stackoverflow.com/questions/7524340/how-do-groovy-scripts-interact-with-propertymissing
*/
class Thing {
}
class FooSyntax {
def myKeyword(Thing t) { println "Hello Foo " + t.toString(); }
@sit
sit / test-archive-q.sh
Created November 29, 2011 21:55
Script to clean and run Hive's archive.q test
ant clean
ant package
(cd metastore && ant model-jar)
ant test -Dtestcase=TestCliDriver -Dqfile=archive.q
@sit
sit / build.gradle
Last active June 24, 2022 11:50
A sample build.gradle for setting up a basic Gradle project for CDH application development
apply plugin: "java"
apply plugin: "eclipse"
apply plugin: "idea"
group = "com.mycompany.hadoopproject"
version = "1.0"
repositories {
// Standard Maven
mavenCentral()
@sit
sit / Berksfile
Created May 2, 2013 16:16
Vagrant and Berkshelf configuration for migrating a chef-repo into Berkshelf-managed cookbooks. (It appears berkshelf-vagrant does not do this automatically, despite what https://github.com/RiotGames/vagrant-berkshelf/blob/master/lib/berkshelf/vagrant/action.rb#L17 may suggest.)
# -*- mode: ruby -*-
# vi: set ft=ruby :
site :opscode
# Suck in all cookbooks in local chef-repo
Dir.entries("cookbooks").each do |cookbook_name|
next if cookbook_name.starts_with?('.')
cookbook_dir = "cookbooks/#{cookbook_name}"
next unless File.directory?(cookbook_dir)
@sit
sit / CentOS-6.3.json
Created July 16, 2013 20:31
Simple Veewee-inspired CentOS 6.3 box for packer
{
"provisioners": [
{
"type": "shell",
"scripts": [
"scripts/chef-client.sh",
"scripts/vagrant.sh"
],
"override": {
"virtualbox": {
#
# Ways of stringifying Hello World in Python
#
a = "hello"
b = "world"
"%s %s" % (a, b)
"%(a)s %(b)s" % locals()
"{a} {b}".format(**locals())
"{first} {second}".format(first=a, second=b)