Skip to content

Instantly share code, notes, and snippets.

@oldsharp
oldsharp / bashrc
Last active March 31, 2017 01:02
bashrc for non-logging shells
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
#
# vi: set filetype=sh :
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
@oldsharp
oldsharp / glow_puzzle.py
Last active August 29, 2015 13:56
glow puzzle
#!/usr/bin/python2
# -*- coding: utf-8 -*-
#
# Author: Ray Chen <oldsharp@gmail.com>
#
# This program has been placed in the public domain.
"""A puzzle game with moving tiles."""
@oldsharp
oldsharp / public_dns_list
Last active December 13, 2018 20:15
public dns servers list
# google public dns
8.8.8.8
8.8.4.4
# opendns
208.67.222.222
208.67.220.220
# v2ex dns
199.91.73.222
@oldsharp
oldsharp / rtl_hostapd_2g.conf
Last active January 3, 2016 10:28
rtl_hostapd_2g configure file
##### hostapd configuration file ##############################################
interface=wlan0
ctrl_interface=/var/run/hostapd
ssid=octocat
channel=3
wpa=2
wpa_passphrase=<password>
#bridge=br0
@oldsharp
oldsharp / iptables.sh
Created January 16, 2014 02:48
iptables rules
#!/bin/sh
sudo iptables -A FORWARD -o eth0 -i wlan0 -s 192.168.0.0/24 -m conntrack --ctstate NEW -j ACCEPT
sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -t nat -F POSTROUTING
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
@oldsharp
oldsharp / mushroom.py
Created December 18, 2013 07:55
a simple sample-script to create cassandra cluster
#!/usr/bin/env python
import os
import shutil
import ccmlib.cluster
CLEAR = True
NODE_NUM = 4
@oldsharp
oldsharp / m_pay_calc.py
Created December 16, 2013 07:26
monthly pay calcualtor
def month_pay_calc(base, month_rate, month_count):
return (base * month_rate * ((month_rate+1.0)**month_count)) / \
((month_rate+1.0)**month_count - 1.0)
base = 124 * 10000
g_base_1 = 80 * 10000
g_base_2 = 30 * 10000
month_count = 12 * 30
@oldsharp
oldsharp / colortest.pl
Last active December 30, 2015 10:49
XTERM 256Color Test Chart
#!/usr/bin/perl
# by entheon, do whatever the hell you want with this file
print "\n";
print "**************************\n";
print "*XTERM 256Color Test Chart\n";
print "**************************\n";
print "* 16 = black\n";
print "* 255 = white\n";