Skip to content

Instantly share code, notes, and snippets.

@magmoro
magmoro / git_new_remote_branch.sh
Created March 15, 2009 09:22
new_remote_branch_git
git push origin master:refs/heads/test
#creates test branch
#or
git push origin local_branch:new_remote_branch
@thisivan
thisivan / git_remote_branches.sh
Created April 28, 2009 02:41
Git: Track Remote Branches
# Create new remote branch
git push origin origin:refs/heads/new_branch_name
# Make sure everything is updated
git fetch origin
# Check your branch has been created
git branch -r
# Track a remote branch
@somebox
somebox / convert_trac.rb
Created October 10, 2010 20:31
Convert Trac Wiki to Markdown
#!/usr/bin/env ruby
# Convert Trac DB Wiki pages to Markdown source files
# This script is based on http://github.com/seven1m/trac_wiki_to_github which
# converted all pages from a Trac DB to GitHub Wiki format (as Textile).
#
# I made two changes:
# - uses MarkDown format instead
# - uses the sqllite3-ruby gem which does not need Ruby 1.9
@wkrsz
wkrsz / gist:756086
Created December 27, 2010 12:01
Google App Script - import calendar events into a spreadsheet
function import_calendar( start_date, end_date, cal_name, spreadsheet, sheet_name) {
var sheet = spreadsheet.getSheetByName(sheet_name);
var cal = CalendarApp.getCalendarsByName(cal_name)[0];
sheet.clear();
events = cal.getEvents( start_date, end_date );
irow = 2;
for( i in events ) {
evt = events[i];
var date = evt.getStartTime();
@cdown
cdown / gist:1163649
Last active November 17, 2024 21:46
Bash urlencode and urldecode
urlencode() {
# urlencode <string>
old_lc_collate=$LC_COLLATE
LC_COLLATE=C
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:$i:1}"
case $c in
@sgk
sgk / trac2down.py
Created October 14, 2011 09:35
Trac Wiki to Markdown converter
#!/usr/bin/python
# vim:set fileencoding=utf-8 sw=2 ai:
import sqlite3
import datetime
import re
SQL = '''
select
name, version, time, author, text
@bgahagan
bgahagan / inotify.sh
Created December 4, 2011 00:34
inotify-tools example
#!/bin/bash
while true; do
echo "Waiting for file changes"
inotifywait -rq --format '%T %w %f' -e close_write "path/to/files"
echo "Files were changed"
done
@jedy
jedy / tc.sh
Created May 24, 2012 02:35
tc带宽控制
#!/bin/bash
#脚本文件名: tc2
#########################################################################################
#用TC(Traffic Control)解决ADSL宽带速度技术 Ver. 1.0 by KindGeorge 2004.12.27 #
#########################################################################################
#此脚本经过实验通过,更多的信息请参阅http://lartc.org
#tc+iptables+HTB+SFQ
#
#一.什么是ADSL? ADSL(Asymmetric Digital Subscriber Loop,非对称数字用户环路)
#用最简单的话的讲,就是采用上行和下行不对等带宽的基于ATM的技术.
@mwcz
mwcz / watchrun.sh
Last active May 28, 2016 06:42
watchrun script for running a command when any file in the current dir tree changes
#!/bin/sh
# USAGE: ./watchrun.sh COMMAND
# New credit to: http://exyr.org/2011/inotify-run/
# this script will wait for changes in the current directory tree, and when one occurs, it will run COMMAND, then resume waiting
# requires inotify-tools:
# sudo apt-get install inotify-tools
# or:
@mdodsworth
mdodsworth / gist:3490042
Created August 27, 2012 16:23
node: multicast example
var dgram = require('dgram');
var socket = dgram.createSocket('udp4');
var testMessage = "[hello world] pid: " + process.pid;
var multicastAddress = '239.1.2.3';
var multicastPort = 5554;
socket.bind(multicastPort, '0.0.0.0');
socket.addMembership(multicastAddress);