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
@coffeesam
coffeesam / resign.sh
Created April 29, 2020 11:22 — forked from RichardBronosky/resign.sh
A simple tool for resigning an iOS app ipa with a new certificate/mobileprovision
#!/usr/bin/env bash
if [[ ! ( # any of the following are not true
# 1st arg is an existing regular file
-f "$1" &&
# ...and it has a .ipa extension
"${1##*.}" == "ipa" &&
# 2nd arg is an existing regular file
-f "$2" &&
# ...and it has an .mobileprovision extension
@coffeesam
coffeesam / paynow.js
Created April 15, 2020 07:10 — forked from chengkiang/paynow.js
SG PayNow QR Code Generator Sample
String.prototype.padLeft = function (n, str) {
if (n < String(this).length) {
return this.toString();
}
else {
return Array(n - String(this).length + 1).join(str || '0') + this;
}
}
function crc16(s) {
@coffeesam
coffeesam / is-nric.js
Last active June 11, 2018 10:03 — forked from eddiemoore/nric-validation.js
Validation for Singapore NRIC and FIN number
//Based on http://www.samliew.com/icval/
const isNRIC = (str) => {
if (str.length != 9)
return false;
str = str.toUpperCase();
let i;
const icArray = [];
for(i = 0; i < 9; i++) {
@coffeesam
coffeesam / sanfrancisco-font.css
Created September 19, 2017 07:27
San Francisco Web Font
/**
* http://applemusic.tumblr.com/
* https://jsfiddle.net/xq56dmrh/
*/
/** Ultra Light */
@font-face {
font-family: "San Francisco";
font-weight: 100;
src: url("https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-ultralight-webfont.woff");
@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: */
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
#!/usr/bin/env bash
# bash 4.1.5(1) Linux Ubuntu 10.04 Date : 2011-10-09
#
# _______________| netspeed : check download speed via command line.
#
# Usage: netspeed [tokyo, london, usw, use, east, west, URL]
# ^default U.S. west coast.
# [ -speed_KB/sec ]
# ^negation activates the Mbps converter.
#

Archive a GitHub Repository

git clone --bare git@github.com:jonlong/<repo>.git
tar -czf <repo>.git.tar.gz <repo>.git

Deploy an Archived Repository to GitHub

Create a new private repository on the target account:

curl -F 'login=' -F 'token=' -F 'name=jonlong/' -F 'public=0' http://github.com/api/v2/json/repos/create

@coffeesam
coffeesam / config
Created August 10, 2013 19:51 — forked from jessearmand/config
# SSH Connection pooling for faster additional connections to a machine
ControlMaster auto
ControlPath /tmp/ssh_mux_%h_%p_%r
# This makes subsequent connections go faster
ControlPersist 2h
# Make it so ssh-ing from one server to another passes keys around automagically
Host *
ForwardAgent yes