Skip to content

Instantly share code, notes, and snippets.

View ernsheong's full-sized avatar

Jonathan Lin ernsheong

View GitHub Profile
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//
@yorzi
yorzi / api_key_generator.rb
Created March 29, 2011 03:03
api key(or any other kind of key) generator via ruby.
class KeyGenerator
require "digest/sha1"
def self.generate(length = 10)
Digest::SHA1.hexdigest(Time.now.to_s + rand(12341234).to_s)[1..length]
end
end
@schacon
schacon / gist:942899
Created April 26, 2011 19:19
delete all remote branches that have already been merged into master
$ git branch -r --merged |
grep origin |
grep -v '>' |
grep -v master |
xargs -L1 |
awk '{split($0,a,"/"); print a[2]}' |
xargs git push origin --delete
@artero
artero / launch_sublime_from_terminal.markdown
Last active May 15, 2024 03:38 — forked from olivierlacan/launch_sublime_from_terminal.markdown
Launch Sublime Text 2 from the Mac OS X Terminal

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

@dnishimura
dnishimura / Makefile.golang
Created June 20, 2012 17:51 — forked from yanatan16/Makefile.golang
Makefile for Golang projects
# Makefile for a go project
#
# Author: Jon Eisen
# site: joneisen.me
#
# Targets:
# all: Builds the code
# build: Builds the code
# fmt: Formats the source files
# clean: cleans the code
@denniskuczynski
denniskuczynski / monit.cfg.erb
Created June 21, 2012 20:12
Example Monit Configuration ERB file to leverage Ruby for Config
<% PWD = ENV["PWD"] %>
<% PID_DIR = '/usr/local/var/run' %>
<%
ADDITIONAL = ''
if ENV['RVM']
ADDITIONAL = "export PATH=#{ENV['PATH']} && export GEM_HOME=#{ENV['GEM_HOME']} && export GEM_PATH=#{ENV['GEM_PATH']} && export HOME=#{ENV['HOME']} && "
end
%>
#
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active April 26, 2024 23:26 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@Rud5G
Rud5G / install-ubuntu-1204.sh
Created August 10, 2012 08:03
chromebook__goo.gl/oyjlt
# fw_type will always be developer for Mario.
# Alex and ZGB need the developer BIOS installed though.
fw_type="`crossystem mainfw_type`"
if [ ! "$fw_type" = "developer" ]
then
echo "\nYou're Chromebook is not running a developer BIOS!"
echo "You need to run:"
echo ""
echo "sudo chromeos-firmwareupdate --mode=todev"
echo ""
@adharris
adharris / postgres_array.go
Created November 28, 2012 19:52
PostgreSQL demo of Array types using Golang
package main
import (
"database/sql"
"errors"
"fmt"
_ "github.com/bmizerany/pq"
"os"
"regexp"
"strings"