Skip to content

Instantly share code, notes, and snippets.

View lanceliao's full-sized avatar

Lance Liao lanceliao

View GitHub Profile
@lanceliao
lanceliao / OpenWrt-Package-Downloader.py
Last active June 3, 2020 17:50
Cache all packages from OpenWrt trunk repository
#!/usr/bin/env python
#coding=utf-8
#
# Openwrt Package Grabber
#
# Copyright (C) 2014 http://www.shuyz.com
#
import urllib2
import re
@lanceliao
lanceliao / gfw_alexa1000.py
Created August 14, 2014 05:06
Generate a list of dnsmasq(with ipset) rules for blocked alexa top 1000 domains
#!/usr/bin/env python
#coding=utf-8
#
# Generate a list of dnsmasq(with ipset) rules for
# Censorship of Alexa Top 1000 Domains in China
#
# Copyright (C) 2014 http://www.shuyz.com
#
import urllib2
@lanceliao
lanceliao / openshift-nginx-compile.sh
Last active October 3, 2015 06:18
Compile and install nginx for OpenShift with memory cache, webdav and fancyindex support
#!/bin/sh
#
# Compile and install nginx for OpenShift
# with memory cache, webdav and fancyindex support
#
# This is a universal script which can run on any type of OpenShift gears
# Note:
# install dir: $OPENSHIFT_DATA_DIR
# tmp dir: $OPENSHIFT_TMP_DIR
# log dir: $OPENSHIFT_LOG_DIR
@lanceliao
lanceliao / shadowsocks.sh
Created August 14, 2014 07:23
Shadowsocks startup script with iptables rules for OpenWrt
#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org
#
# Shadowsocks startup script with iptables rules for OpenWrt
#
# This file is located in directory /etc/init.d/
# rename this file to shadowsocks before using it
#
# By Lance http://www.shuyz.com
#
@lanceliao
lanceliao / 1-redsocks2-openwrt.md
Last active April 24, 2023 16:05
在OpenWrt上配置redsocks2

redsocks2是一款透明socks5代理工具,能够实现智能代理的功能,这里是redsocks2在OpenWrt上的配置,配合shadowsocks使用。

redsocks.conf 是配置文件,放在/etc目录,将192.168.1.1改成路由器的地址. redsocks2.sh 为自启动文件,改名为redsocks2放到/etc/init.d目录即可。自启动文件假设redsocks可执行文件在/opt/bin目录。

启动redsocks2: /etc/init.d/redsocks2 start 停止redsocks2: /etc/init.d/redsocks2 stop

redsocks2 git源

@lanceliao
lanceliao / my.cnf
Created August 14, 2014 08:34
MySQL config on OpenWrt
[client]
port = 3306
socket = /var/run/mysqld.sock
default-character-set=utf8
[mysqld]
user = root
socket = /var/run/mysqld.sock
port = 3306
basedir = /usr
@lanceliao
lanceliao / 0-openwrt-auto-mount-readme.md
Last active November 26, 2022 08:58
Auto mount USB storage device by uuid on OpenWrt
  1. Install USB device support;
opkg install kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-storage e2fsprogs fdisk usbutils mount-utils block-mount kmod-fs-ext4 kmod-fs-vfat kmod-nls-utf-8 kmod-nls-cp437 kmod-nls-iso8859-1

reboot
  1. Install blkid, run opkg update && opkg install blkid;
  2. Copy block.sh to directory /lib/functions;
  3. Copy 10-mount and 20-swap to directory /etc/hotplug.d/block;
  4. That's it! run logread -f command then plug in a USB stick to test.
@lanceliao
lanceliao / raspberry-chkwifi.sh
Created August 14, 2014 09:20
Raspberry Pi WIFI protect script - auto reconnect when AP is powered on after a powered off. call this script in crontab.
#!/bin/bash
export PATH=$PATH:/sbin
# Auto reconnect to specified WIFI access point if there is no internect connection
# Author: Lance
# Website: http://www.shuyz.com
# Last updated: 2013/05/25
#your WIFI SSID here to be auto connect
SSID=ShuYZ
@lanceliao
lanceliao / samba-openwrt.md
Last active May 12, 2022 18:28
Samba on OpenWrt 配置

##安装

opkg update && opkg install samba luci-app-samba

##配置

匿名登录

#/etc/config/samba
config sambashare
@lanceliao
lanceliao / luci-lighttpd-openwrt.md
Last active February 26, 2020 15:43
Configure LUCI on lighttpd

###Install

opkg install lighttpd lighttpd-mod-cgi

###Configgure

修改/etc/lighttpd/lighttpd.conf

  1. static-file.exclude-extensions = (".php", ".pl", ".fcgi")改成static-file.exclude-extensions = (".php", ".pl", ".fcgi", ".lua")