This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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) \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
site :opscode | |
cookbook 'nginx', '~> 2.4.4' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# -------------------------------------- | |
# | |
# Title: Chef Solo Bootstrap | |
# Author: Terry Wang | |
# Email: i (at) terry (dot) im | |
# Homepage: http://terry.im | |
# File: bootstrap-ubuntu.sh | |
# Created: Feb, 2013 | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*filter | |
# Allow all loopback (lo) traffic and drop all traffic to 127.0.0.0/8 that doesn't use lo | |
-A INPUT -i lo -j ACCEPT | |
-A INPUT -d 127.0.0.0/8 -j REJECT | |
# Accept all established inbound connections | |
# -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT | |
# conntrack match is recommended | |
-A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT | |
# Allow all outbound traffic | |
# It can be modified to allow certain traffic ONLY |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dscl . -read /Users/username JPEGPhoto | tail -1 | xxd -r -p > /path/to/accountImage.jpg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# One liner | |
# mysqldump to stdout, pipe to xz for compression and then pipe to pv redirect to xz file | |
# pv is OPIONTAL, it is for showing the progress ONLY | |
# The - after xz -z is OPTIONAL, by default xz reads from stdin and writes to stdout | |
mysqldump -u confluenceuser -ppassword confluence | xz -z | pv > wiki_$(date +"%Y%m%d").xz | |
# Other 2 equivalant variants | |
# mysqldump -u confluenceuser -ppassword confluence | xz -z | > wiki_$(date +"%Y%m%d").xz |