Skip to content

Instantly share code, notes, and snippets.

View linc01n's full-sized avatar

Lincoln Lee linc01n

View GitHub Profile
#!/bin/zsh
switche () {
case $1 in
j)
profile='~/.emacs.d.ocodo'
;;
s)
profile='~/.emacs.d.spacemacs'
;;
#
# Dynamically generated by Chef on <%= node["fqdn"] %>
# Local modifications will be overwritten by Chef.
#
#
# One way to set the STASH HOME path is here via this variable. Simply uncomment it and set a valid path like
# /stash/home. You can of course set it outside in the command terminal; that will also work.
#
if [ "x${STASH_HOME}" = "x" ]; then
#!/bin/bash
# $1 => Slack hook URL
# $2 => Channel name
# $3 => URL to web repo browser for base project
slack_url="$1"
channel="$2"
browser_url="$3"
# Debugging output in /tmp/stash_slack.txt
@linc01n
linc01n / 36.rb
Last active August 29, 2015 13:56
Interview question
#!/usr/bin/env ruby
# It is a base 36 number system
# 6 digit means 36^6 different combination
0.upto(36 ** 6 - 1) do |n|
# to_s(36) convert the number to base 36 system
# rjust(6, '0') pad 0 for the number less than 6 digit
puts n.to_s(36).rjust(6, '0')
end
@linc01n
linc01n / gist:4315209
Created December 17, 2012 01:46
Compile ruby instead of using binary
rvm install --disable-binary 1.9.3
@linc01n
linc01n / Gemfile
Created September 14, 2012 09:35
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
source :rubygems
# We are not loading Active Record, nor Active Resources etc.
# We can do this in any app by simply replacing the rails gem
# by the parts we want to use.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
gem "tzinfo"
# Let's use thin
@linc01n
linc01n / awssdk_create_snapshot.rb
Created December 20, 2011 10:05 — forked from juno/awssdk_create_snapshot.rb
Create EC2 SnapShot from Volume with AWS-SDK for Ruby
# -*- coding: utf-8 -*-
require 'rubygems'
require 'aws-sdk'
## アクセスIDとシークレットアクセスキーを指定します
ACCESS_KEY = 'SET UP YOUR ACCESS KEY'
SECRET_KEY = 'SET UP YOUR SECRET KEY'
## 引数チェック
unless ARGV.size == 4
@linc01n
linc01n / remove_svn.sh
Created September 20, 2011 01:47
remove all svn folder recursively
find . -name .svn -print0 | xargs -0 rm -rf
@linc01n
linc01n / pptpd.sh
Created August 19, 2011 08:54 — forked from jmhobbs/pptpd.sh
Ubuntu 11.04 AWS EC2 PPTPD Installer
#!/bin/bash
#
# This script will install and configure a PPTPD server on your Ubuntu box.
# I use this for a micro instance on Amazon EC2 as a quick, cheap (free!) VPN
#
# This script was tested with Natty Narwahl 11.04, ami-06ad526f
#
# Usage:
# wget https://gist.github.com/raw/950539/pptpd.sh