Skip to content

Instantly share code, notes, and snippets.

@igal
igal / gist:53855
Created January 28, 2009 07:29
.gitrc aliases for common git commands
# Aliases for common git commands. E.g., enter "git d" for "git diff"
# These settings live in the ~/.gitconfig file.
[alias]
b = branch
ba = branch -a
ci = commit
co = checkout
d = diff
dc = diff --cached
@mathiasbynens
mathiasbynens / appify
Created November 12, 2010 13:46 — forked from subtleGradient/appify
appify — create the simplest possible Mac app from a shell script
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF
appify v3.0.1 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
Appify takes a shell script as its first argument:
`basename "$0"` my-script.sh
@paulsmith
paulsmith / echo.go
Created January 12, 2011 06:09
A simple echo server testing a few interesting Go language features, goroutines and channels.
// $ 6g echo.go && 6l -o echo echo.6
// $ ./echo
//
// ~ in another terminal ~
//
// $ nc localhost 3540
package main
import (
@jbenet
jbenet / NSTimeZone+AskGeo.h
Created April 7, 2011 11:27
Objective-C AskGeo API
// The MIT License
//
// Copyright (c) 2010 Juan Batiz-Benet
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@willf
willf / bitset.go
Created May 11, 2011 01:47
First implementation of bitsets
// Copyright 2011 Will Fitzgerald. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/*
Package bitset implements bitsets.
It provides methods for making a bitset of an arbitrary
upper limit, setting and testing bit locations, and clearing
bit locations as well as the entire set.
@thwarted
thwarted / sshpub-to-rsa
Created June 14, 2011 09:12
converts an openssh RSA public key into a format usable by openssl rsautl (if you don't have openssh 5.6 or later with ssh-keygen PEM export format)
#!/usr/bin/env python
# with help and inspiration from
# * ASN1_generate_nconf(3) (specifically the SubjectPublicKeyInfo structure)
# * http://www.sysmic.org/dotclear/index.php?post/2010/03/24/Convert-keys-betweens-GnuPG%2C-OpenSsh-and-OpenSSL
# * http://blog.oddbit.com/2011/05/converting-openssh-public-keys.html
import sys
import base64
import struct
@pamelafox
pamelafox / usermodel.py
Created July 6, 2011 21:08
SimpleGeo Timezone Calculation on Python App Engine
class User(db.Model):
location = db.StringProperty()
timezone = db.StringProperty(default='America/Los_Angeles')
# Do this once per user
def calculate_timezone(self):
from simplegeo import Client
client = Client('oauth key', 'oauth secret SHH')
response = client.context.get_context_by_address(self.location)
for feature in response['features']:
@fbrnc
fbrnc / gist:1262502
Created October 4, 2011 19:12
Magento priority configuration for TwoLevels cache backend
Index: app/code/core/Mage/Core/Model/Cache.php
===================================================================
--- app/code/core/Mage/Core/Model/Cache.php (revision 124392)
+++ app/code/core/Mage/Core/Model/Cache.php (working copy)
@@ -44,7 +44,7 @@
/**
* Cache frontend API
*
- * @var Zend_Cache_Core
+ * @var Varien_Cache_Core
@mboersma
mboersma / yaml2json
Last active July 31, 2023 12:34
YAML to JSON one-liner
python3 -c 'import sys, yaml, json; y=yaml.safe_load(sys.stdin.read()); print(json.dumps(y))'
@canton7
canton7 / 0main.md
Last active November 7, 2023 08:16
Local versions of tracked config files

How to have local versions of tracked config files in git

This is a fairly common question, and there isn't a One True Answer.

These are the most common techniques:

If you can modify your application