Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
#create a new chain named SHADOWSOCKS
iptables -t nat -N SHADOWSOCKS
# Ignore your shadowsocks server's addresses
# It's very IMPORTANT, just be careful.
iptables -t nat -A SHADOWSOCKS -d YOUR-SERVERS-IP-ADDRESS -j RETURN
# Ignore LANs IP address
@vbajpai
vbajpai / opkgclean.sh
Last active March 5, 2024 17:06
If opkg runs out of space, it will not remove the files it was installing. Run this custom script in order recover the space by removing these files and the installed dependencies.
#!/bin/sh
#takes one argument/parameter: the name of the package which didn't install correctly and should be removed along with its dependencies
#do opkg update first
#example: ./opkgremovepartlyinstalledpackage.sh pulseaudio-daemon
#get list of all packages that would be installed along with package x
opkg update
PACKAGES=`opkg --force-space --noaction install $1 | grep http | cut -f 2 -d ' ' | sed 's/.$//'`
for i in $PACKAGES
do
@rkumar
rkumar / gist:445992
Created June 20, 2010 18:20
subcommand parser wrapping over OptionParser (ruby)
#!/usr/bin/env ruby -w
######################################
# A tiny wrapper over optparse that gives easy subcommand facility.
# It also neatly prints help for global and subcommands
# as well as summarizes subcommands in global help.
#
# For updated version, goto : http://github.com/rkumar/subcommand
#
# @author Rahul Kumar, Jun 2010
# @date 2010-06-20 22:33
# A simple app that implements a naive session-based login, to demonstrate the problems with testing sessions in Sinatra.
require 'rubygems'
require 'sinatra/base'
class LoginApp < Sinatra::Base
enable :sessions
get '/' do