Skip to content

Instantly share code, notes, and snippets.

@yoursunny
yoursunny / bpi-r2-sdimage.sh
Created August 27, 2019 11:41
OpenWrt 18.06.4 SD eMMC image for Banana Pi R2
#!/bin/bash
# OpenWrt 18.06.4 for Banana Pi R2
# Make SD or eMMC image from official kernel and rootfs images.
# Inspired by https://github.com/BPI-SINOVOIP/openwrt/commit/b4dfaeca4d33ad88364bfb7df353b3dfca2883fe
set -e
KIND=$1
if [[ $KIND != sd ]] && [[ $KIND != emmc ]]; then
echo Usage: $0 '<sd|emmc> [outfile]' >/dev/stderr
@huzhifeng
huzhifeng / gpio_button_test.example
Created November 3, 2015 12:58
Shell scripts used to test GPIO LEDs and buttons, fork and improve based on http://wiki.openwrt.org/doc/devel/add.new.device
Single GPIO test
root@OpenWrt:/# gpio_button_test.sh 1 1
[GPIO1] value 0
root@OpenWrt:/#
GPIO range test
root@OpenWrt:/# gpio_button_test.sh 0 2
[GPIO0] value 0
[GPIO1] value 0
[GPIO2] value 0
@dferg
dferg / howto-tomato-l2tp-ipsec-server.markdown
Last active December 18, 2023 21:49
HOWTO: Install L2TP/IPsec Server on TomatoUSB

Introduction

This howto describes setting up a LT2P over IPsec VPN server on your router with TomatoUSB firmware. This should allow you to connect using the built-in client to your Mac, iPhone or Android device. (Not sure about Windows.)

At the end of this tutorial, you should have a L2TP/IPsec VPN server that starts automatically on boot. Mac/iPhone/Android devices can connect with their native client and will be assigned an IP address within your LAN subnet. They should be able to talk to other devices on your LAN and should be able to contact hosts on the Internet NAT'd behind your WAN IP address.

Requirements

  • Router running Shibby's fork of TomatoUSB
  • entware installed to a USB stick mounted at /opt (howto)
@zythum
zythum / gist:2848881
Created June 1, 2012 04:50
google收录的敏感词
@esperlu
esperlu / mysql2sqlite.sh
Created April 27, 2011 05:46
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@hcooper
hcooper / new-openvpn-client.sh
Created February 7, 2011 11:01
Script to automate creating new OpenVPN client certificates and make them easy to download
#! /bin/bash
# Script to automate creating new OpenVPN clients
# The client cert and key, along with the CA cert is
# zipped up and placed somewhere to download securely
#
# H Cooper - 05/02/11
#
# Usage: new-openvpn-client.sh <common-name>
# Set where we're working from