Skip to content

Instantly share code, notes, and snippets.

View coffeesam's full-sized avatar
:octocat:
GitHubbing..

Sam Hon coffeesam

:octocat:
GitHubbing..
View GitHub Profile
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
#!/bin/sh
DOMAIN=`echo $1 | sed 's/https:\/\///' | sed -E 's/\/.*$//'`
URL="https://$DOMAIN"
if [ -z $URL ]; then
cat << EOF
Usage: ckrootca <url>
EOF
else
curl -c $DOMAIN.cookie -I -vs $URL 2>&1 | grep "Server certificate" -B1 | tail -n1
@coffeesam
coffeesam / gist:1372698
Created November 17, 2011 08:35 — forked from tung/gist:409780
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
COLOR_NONE="\[\e[0m\]"
@coffeesam
coffeesam / Gemfile
Created December 8, 2011 22:08 — forked from mislav/Gemfile
How to integrate Compass with Rails 3.1 asset pipeline
group :assets do
gem 'sass-rails', '~> 3.1.0'
gem 'coffee-rails', '~> 3.1.0'
gem 'uglifier'
gem 'compass'
end
@coffeesam
coffeesam / appify
Created August 2, 2012 06:29 — forked from mathiasbynens/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
@coffeesam
coffeesam / process.txt
Created August 8, 2012 04:47
AppJS bundle app.exe process dump
{ title: 'Command Prompt - bin\\node.exe -e "console.log(process)" ',
version: 'v0.8.2',
moduleLoadList:
[ 'Binding evals',
'Binding natives',
'NativeModule events',
'NativeModule buffer',
'Binding buffer',
'NativeModule assert',
'NativeModule util',
@coffeesam
coffeesam / commands.md
Created August 22, 2012 01:45 — forked from maddox/commands.md
Install script for Samba3

Install Samba 3 on OS X 10.7 Lion

Run the two commands below one at a time to get Samba 3 installed and to have it run on boot.

Install Samba with Homebrew

sh < <(curl https://raw.github.com/gist/1938575/df254d9a2ac83dddb04fcc7f9b634b65708aa477/

Set Samba up to launch on boot

@coffeesam
coffeesam / example.bash
Created November 16, 2015 10:03 — forked from choonkeat/html2sprockets.rake
`html2sprockets:assets` is a quick way to add 3rd-party js/css to your rails app that is asset pipeline compatible; creates local gem in `vendor/gems` and apply them in your `Gemfile`
# download and unzip https://github.com/hakimel/reveal.js/archive/3.1.0.zip
rake html2sprockets:assets NAME=revealjs SRC="/Users/choonkeat/Downloads/reveal.js-3.1.0/css
/Users/choonkeat/Downloads/reveal.js-3.1.0/js
/Users/choonkeat/Downloads/reveal.js-3.1.0/lib
/Users/choonkeat/Downloads/reveal.js-3.1.0/plugin"
# app/assets/stylesheets/reveal.css:/*
# app/assets/stylesheets/reveal.css: *= require revealjs/css/reveal.css
# app/assets/stylesheets/reveal.css: *= require revealjs/css/theme/black.css
# app/assets/stylesheets/reveal.css: *= require revealjs/lib/css/zenburn.css
# app/assets/stylesheets/reveal.css: */
require 'yaml'
namespace :pg do
namespace :mac do
def conf
@conf ||= YAML.load_file("#{Rails.root}/config/database.yml")
end
def username
/**
* Return a timestamp with the format "m/d/yy h:MM:ss TT"
* @type {Date}
*/
function timeStamp() {
// Create a date object with the current time
var now = new Date();
// Create an array with the current month, day and time