Skip to content

Instantly share code, notes, and snippets.

OpenVPN in Linux network namespace

This script creates a network namespace, in that namespace your OpenVPN tunnel is the default interface.

  1. Change your OpenVPN server settings in yourvpn.ovpn, modify the paths to passwd and crl files accordingly
  2. Put in your username and password in passwd file
  3. ./piavpn.zsh up
  4. ./piavpn.zsh start_vpn

Switch to that network namespace with: sudo ip netns exec piavpn bash

@pellaeon
pellaeon / jenkins build script
Created November 18, 2017 05:34
鳳梨酥計劃
#!/usr/local/bin/bash
set -ex
BSDINIT_DIR="$JENKINS_HOME/workspace/bsd-cloudinit/bsd-cloudinit_master"
BSDINSTALLER_DIR="$JENKINS_HOME/workspace/bsd-cloudinit/bsd-cloudinit-installer_master"
TEST_DIR="$BSDINSTALLER_DIR/test"
TEST_IMG="$TEST_DIR/tester.raw"
@pellaeon
pellaeon / hidemyass.js
Last active July 3, 2017 22:33
Get proxy list from various sites
// open http://proxylist.hidemyass.com/search-1292985 and
// run following code in browser developer console
aaa = '';
$('table#listable > tbody > tr').each(function(index){
text = $(this)[0].innerText;
textarr = text.split(/\s+/);
proxystr = textarr[2].concat(":",textarr[3]);
//console.log(proxystr);
aaa = aaa.concat(proxystr, "\n");
});
@pellaeon
pellaeon / With patch
Created May 21, 2017 08:57
Gluster volume process GDB output
(gdb) set follow-fork-mode child
(gdb) set breakpoint pending on
(gdb) b compat.c:extattr_list_reshape
Breakpoint 1 at 0x80088eda7: file compat.c, line 548.
(gdb) b compat.c:551
Breakpoint 2 at 0x80088edba: file compat.c, line 551.
(gdb) b sys_llistxattr
Breakpoint 3 at 0x8008959b1: file syscall.c, line 433.
(gdb) b sys_flistxattr
Breakpoint 4 at 0x800895aca: file syscall.c, line 552.
@pellaeon
pellaeon / iptables_custom.sh
Created May 1, 2017 05:48
Allow traffic of apps in work profile to pass, set this as AFWall custom script
IP6TABLES=/system/bin/ip6tables
IPTABLES=/system/bin/iptables
$IPTABLES -A afwall-3g-home -m owner --uid-owner 1010082 -j RETURN
$IPTABLES -A afwall-3g-home -m owner --uid-owner 1010105 -j RETURN
$IPTABLES -A afwall-3g-home -m owner --uid-owner 1010172 -j RETURN
$IPTABLES -A afwall-wifi-wan -m owner --uid-owner 1010082 -j RETURN
$IPTABLES -A afwall-wifi-wan -m owner --uid-owner 1010105 -j RETURN
$IPTABLES -A afwall-wifi-wan -m owner --uid-owner 1010172 -j RETURN
@pellaeon
pellaeon / cloudconfig.txt
Created August 7, 2016 07:16
pellaeon's cloudconfig
#cloud-config
apt_mirror: http://ubuntu.cs.nctu.edu.tw/ubuntu/
timezone: Asia/Taipei
package_upgrade: true
packages:
- mosh
- git
- screen
- htop
PhantomJS 2.1.1 (Linux 0.0.0) OCA.Files.FileList tests loading file list scroll distance is read from sessionStorage FAILED
TypeError: null is not an object (evaluating 'getItemStub.getCall(0).args') in /var/www/html/owncloud/apps/files/tests/js/filelistSpec.js (line 1391)
/var/www/html/owncloud/apps/files/tests/js/filelistSpec.js:1391:33
namespace OC\Core\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class Auth extends Command {
protected function configure() {
obj-m +=feng.o
KERNELDIR ?= ~/android/kernel/k2u-jb-3.4.10-cl157896-1-built
PWD := $(shell pwd)
CROSS_COMPILE=/home/pellaeon/toolchains/arm-eabi-4.6/bin/arm-eabi-
ARCH=arm
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules
/*
* =====================================================================================
*
* Filename: concatenate_lists.c
*
* Description: Concatenates 2 linked lists of characters
*
* Version: 1.0
* Created: 2013年01月07日 11時38分00秒
* Revision: none