Skip to content

Instantly share code, notes, and snippets.

@alvin2ye
alvin2ye / serve.go
Created May 16, 2019 05:23 — forked from paulmach/serve.go
Simple Static File Server in Go
/*
Serve is a very simple static file server in go
Usage:
-p="8100": port to serve on
-d=".": the directory of static files to host
Navigating to http://localhost:8100 will display the index.html or directory
listing file.
*/
package main
@alvin2ye
alvin2ye / install.sh
Created June 12, 2016 12:52 — forked from wdullaer/install.sh
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
; Summary: Proxy Switchy! Exported Rule List
; Date: Sunday, May 15, 2011
; Website: http://bit.ly/proxyswitchy
#BEGIN
[wildcard]
*://192.168.1.*
*://www.amazon.com/*
*://www.bbc.co.uk/*
@alvin2ye
alvin2ye / .gemrc
Last active December 19, 2015 23:49 — forked from hamakn/.gemrc
# curl -sL https://gist.github.com/alvin2ye/6037403/raw/.gemrc > ~/.gemrc
gem: --no-ri --no-rdoc
:sources:
#- http://rubygems.org/
- http://production.s3.rubygems.org/
# run with: god -c /path/to/config.god [add -D if you want to not-deamonize god]
# This is the actual config file used to keep the delayed_job running
APPLICATION_ROOT = "/var/www/application"
RAILS_ENV = "production"
God.watch do |w|
w.name = "delayed_job_production"
w.interval = 15.seconds
w.start = "/bin/bash -c 'cd #{APPLICATION_ROOT}/current; /usr/bin/env RAILS_ENV=#{RAILS_ENV} #{APPLICATION_ROOT}/current/script/delayed_job start > /tmp/delay_job.out'"
@alvin2ye
alvin2ye / rails_template_for_mongoid.rb
Created June 11, 2012 01:40 — forked from huacnlee/rails_template_for_mongoid.rb
A custom Rails template for Mongoid.
# coding: utf-8
# This is a Rails init template with MongoDB projects
#
# Mongoid, Devise, Bootstrap, jQuery, Redis, Cells, will_paginate, Carrierwave, simple_form, Settingslogic, Thin
#
# Usage
#
# $ rails new app_name -m https://raw.github.com/gist/2168014
#
#!/bin/bash
sudo apt-get -y install dialog
DIALOG=${DIALOG=dialog}
tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
trap "rm -f $tempfile" 0 1 2 5 15
$DIALOG --backtitle "请选择您要安装的选项" \
--title "专业系统安装" --clear \
@alvin2ye
alvin2ye / pptpd.sh
Created May 31, 2011 04:38 — forked from yinhm/pptpd.sh
Automaticlly install pptpd on Amazon EC2 Amazon Linux
# Automaticlly install pptpd on Amazon EC2 Amazon Linux
#
# Ripped from http://blog.diahosting.com/linux-tutorial/pptpd/
# pptpd source rpm packing by it's authors
#
# WARNING:
# first ms-dns setting to 172.16.0.23, 172.16.0.23 was showing on my
# /etc/resolv.conf, I'm not sure this is the same on all Amazon AWS zones.
#
# You need to adjust your "Security Groups" which you are using too.
@alvin2ye
alvin2ye / .bashrc
Created February 22, 2011 06:34 — forked from julienXX/.bashrc
# Colors ----------------------------------------------------------
export TERM=xterm-color
export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32'
export CLICOLOR=1
alias ls='ls -G' # OS-X SPECIFIC - the -G command in OS-X is for colors, in Linux it's no groups
#alias ls='ls --color=auto' # For linux, etc
@alvin2ye
alvin2ye / backup.rake
Last active September 24, 2015 19:58 — forked from RobinWu/backup.rake
backup.rake for rails 1.2.x
require 'fileutils'
require 'enumerator' # support rails 1.2.5
require 'date'
namespace :backup do
desc 'crontab -e'
task :crontab do
puts <<-CRONTAB
m(0-59) h(0-23) d(1-31) m(1-12) w(0-6 0=Sunday) command
0 3 * * * cd /var/www/<project> && /usr/bin/rake backup:log:analyze APIKEY=* RAILS_ENV=production > /dev/null 2>&1