Skip to content

Instantly share code, notes, and snippets.

View gautamk's full-sized avatar

Gautam gautamk

  • Block | Meta | Appdynamics | Cisco | Amazon | University of Washington
  • Seattle
View GitHub Profile
@romannurik
romannurik / background-page.html
Created September 24, 2009 05:15
A workaround for Cross-domain XHR's not working in Chrome Extensions' content scripts. See http://groups.google.com/group/chromium-extensions/browse_thread/thread/43ec4d383cf8d01d
<!DOCTYPE html>
<html>
<head>
<script src="xhrproxy.js"></script>
<script>
setupXHRProxy();
</script>
</head>
@uhop
uhop / admin.py
Created March 14, 2011 00:31
Adding Dojo's rich editor to Django's Admin.
# Example how to add rich editor capabilities to your models in admin.
from django.contrib.admin import site, ModelAdmin
import models
# we define our resources to add to admin pages
class CommonMedia:
js = (
'https://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dojo/dojo.xd.js',
@micahbrich
micahbrich / flac-to-mp3.rb
Created May 21, 2011 23:40
Batch convert flac to mp3, with metadata, using ffmpeg
Dir.glob("*.flac").each do |f|
flac = "./#{f.gsub(' ', '\ ')}"
mp3 = "./#{f.gsub(' ', '\ ').chomp('.flac')}.mp3"
system("ffmpeg -i #{flac} -map_meta_data #{mp3}:#{flac} #{mp3}")
end
@chrisroos
chrisroos / gpg-import-and-export-instructions.md
Created September 9, 2011 10:49
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

@gautamk
gautamk / auth.php
Created February 4, 2012 15:10
CodeIgniter Authentication Library , application/libraries/auth.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Auth {
/**
* @author K.Gautam
* @version 0.1
* @todo ability to add configuration.
*/
protected $CI=NULL;
@paul-matthews
paul-matthews / sumodule-slides.md
Created March 8, 2012 10:31
Git Submodule Slides - From PHPUK 2012

% Git Submodules - The Good + The Bad % Paul Matthews % March 2012

This talk

  • Submodules
  • Essentials
  • Using submodules
  • Using distributed submodules
@gautamk
gautamk / eclipse
Created April 27, 2012 12:08
Various Command and Scripts to remember
#!/bin/bash
/path/to/eclipse &
P=`which eclipse`
disown `pidof ${P}`
@djangofan
djangofan / gist:2939268
Created June 15, 2012 23:56
Groovy script to watch a directory for changes in JDK1.7
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.*;
// requires JDK 1.7.0+
Path tmpPath = Paths.get( args[0])
WatchService watchService = FileSystems.getDefault().newWatchService()
@john2x
john2x / 00_destructuring.md
Last active August 23, 2024 07:45
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences

@domenic
domenic / 0-github-actions.md
Last active May 26, 2024 07:43
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with GitHub Actions

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

A file below this one contains the steps for doing this with Travis CI. However, these days I recommend GitHub Actions, for the following reasons:

  • It is much easier and requires less steps, because you are already authenticated with GitHub, so you don't need to share secret keys across services like you do when coordinate Travis CI and GitHub.
  • It is free, with no quotas.
  • Anecdotally, builds are much faster with GitHub Actions than with Travis CI, especially in terms of time spent waiting for a builder.