Skip to content

Instantly share code, notes, and snippets.

Terry Wang terrywang

Block or report user

Report or block terrywang

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am terrywang on github.
  • I am terrywang (https://keybase.io/terrywang) on keybase.
  • I have a public key whose fingerprint is CB3E C2DC AD18 0C78 731E C034 00D8 3189 AB6C 9CA3

To claim this, I am signing this object:

@terrywang
terrywang / config
Last active Feb 27, 2019
Secure Enhanced ~/.ssh/config OpenSSH client per-user configuration file
View config
# User ssh configuration file ~/.ssh/config
# Gist https://gist.github.com/terrywang/3997931
# man ssh_config for more information
# Inspired by the blog post below to fight the NSA
# https://stribika.github.io/2015/01/04/secure-secure-shell.html
# Github needs diffie-hellman-group-exchange-sha1 some of the time but not always
# Host github.com
# KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1
@terrywang
terrywang / vimcasts.sh
Created Dec 17, 2015
Vimcasts screencasts download bash one-liner - please support Drew Neil if possible e.g. buy Practical Vim ;-D
View vimcasts.sh
for (( i=1; i<=68; i++ )); do file=$(curl -s http://media.vimcasts.org/videos/$i/ | grep m4v | awk '{ print $5 }' | cut -d'>' -f2 | cut -d'<' -f1); url=http://media.vimcasts.org/videos/$i/$file; echo $url; wget -c -S -O "$i-$file" "$url"; done
@terrywang
terrywang / nginx.conf
Last active May 6, 2019
nginx config file template for Debian and Ubuntu
View nginx.conf
# User and group used by worker processes
user www-data;
# Ideally # of worker processes = # of CPUs or cores
# Set to auto to autodetect
# max_clients = worker_processes * worker_connections
worker_processes auto;
pid /run/nginx.pid;
@terrywang
terrywang / match.java
Created Feb 17, 2014
Java code backup ;-) To Compile: javac Match.java Usage: java Match <pattern> <text>
View match.java
/**
* The Match class implements Brute Force pattern matching.
*
* @author Terry Wang
* @version 0.2
*/
public class Match {
/** variable to record the position of matching */
private static int position = 0;
@terrywang
terrywang / vcheck.c
Last active Aug 29, 2015
Check Linux VM hardware assisted virtualization type {Xen HVM,KVM,VMware}. Based on the C program written by http://www.vpsee.com
View vcheck.c
/*
* Use CPUID opcode from EAX register to determine Linux VM Virtualization type {Xen HVM,KVM,VMware}
* Based on the c program written by http://www.vpsee.com ;-)
*/
#include <stdio.h>
#include <string.h>
#define HYPERVISOR_INFO 0x40000000
#define CPUID(idx, eax, ebx, ecx, edx) \
@terrywang
terrywang / rsync.rb
Last active Nov 2, 2016
rsync Homebrew formula for OS X, with fileflags, crtimes and hfs-compression patches. May be merged to https://github.com/Homebrew/homebrew-dupes soon ;-)
View rsync.rb
require 'formula'
class Rsync < Formula
homepage 'http://rsync.samba.org/'
url 'http://rsync.samba.org/ftp/rsync/src/rsync-3.1.0.tar.gz'
sha1 'eb58ab04bcb6293da76b83f58327c038b23fcba3'
depends_on :autoconf
def patches
@terrywang
terrywang / Berkshelf
Last active Nov 26, 2017
Vagrantfile sample for Vagrant, the following plugins are required: vagrant-berkshelf, vagrant-omnibus, vagrant-proxyconf, vagrant-vbguest, vagrant-proxyconf. Berksfile defines cookbooks and their dependencies. Run berks install to install cookbooks and dependencies.
View Berkshelf
site :opscode
cookbook 'nginx', '~> 2.4.4'
@terrywang
terrywang / jdk.sh
Last active Mar 27, 2019
Oracle JDK Download Script, the magic cookie comes from oab-java6 ;-) It **ONLY** works for latest Oracle JDK 7 and 8 update releases.
View jdk.sh
#!/bin/bash
# --------------------------------------
#
# Title: Oracle JDK Download Script
# Author: Terry Wang
# Email: i (at) terry (dot) im
# Homepage: http://terry.im
# File: jdk.sh
# Created: 28 August, 2013
#
@terrywang
terrywang / .bashrc
Last active Jan 15, 2017
Bash 4.2.x dot files for Linux and OS X, extracted from Ubuntu which by default does NOT use $HOME/.bash_profile for interactive login shells.
View .bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
# [ -z "$PS1" ] && return
case $- in
*i*) ;;
*) return;;
esac
You can’t perform that action at this time.