Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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
import socket
import telnetlib
payload = bytearray()
for i in range(0,0x28):
payload.append(0x41)
for i in range(0, 4):
payload.append(0x42)
payload.append(0xCD)
payload.append(0x88)

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 / a.bash
Created October 30, 2015 11:35
ip netns VPN
#!/bin/bash
#create bridge 'br0'
brctl addbr br0
#create network namespace 'ns0'
ip netns add ns0
#create virtual nic pair for hooking ns0
ip link add veth0 type veth peer name veth1
#adding veth1 into namespace 'ns0'
ip link set veth1 netns ns0
#bring ethernet NIC down for adding it to br0 later
@pellaeon
pellaeon / neutron client debug
Created September 27, 2015 14:40
neutronclient.client doesn't seem to recognize Keystone API v3
2015-09-27 22:34:36,421 neutronclient.client DEBUG
REQ: curl -i http://172.29.236.19:5000/v3/tokens -X POST -H "User-Agent: python-neutronclient" -d '{"auth": {"tenantName": "admin", "passwordCredentials": {"username": "admin", "password": "REDACTED"}}}'
2015-09-27 22:34:36,456 neutronclient.client DEBUG RESP:404 {'content-length': '93', 'vary': 'X-Auth-Token', 'server': 'Apache', 'date': 'Sun, 27 Sep 2015 14:34:36 GMT', 'content-type': 'application/json', 'x-openstack-request-id': 'req-073bd239-db55-4da9-8db2-7daf9f01ea36'} {"error": {"message": "The resource could not be found.", "code": 404, "title": "Not Found"}}
@pellaeon
pellaeon / 0KVb7nflqxs.js
Last active July 3, 2023 23:40
facebook PrivacyConst
/*!CK:1682740188!*/ /*1436151151,*/
if (self.CavalryLogger) {
CavalryLogger.start_js(["87tQA"]);
}
__d("TickerStoryList", ["Event", "Animation", "Arbiter", "AsyncRequest", "AsyncSignal", "Bootloader", "ChannelConstants", "LegacyContextualDialog", "CSS", "DOM", "HTML", "Keys", "LayerFadeOnHide", "LiveTimer", "NavigationMessage", "Parent", "Rect", "Run", "ScrollableArea", "SelectorDeprecated", "Style", "TickerController", "TickerReadStateTracking", "Toggler", "URI", "UserActivity", "UserAgent_DEPRECATED", "Vector", "DOMVector", "BanzaiODS", "clickRefAction", "collectDataAttributes", "containsNode", "cx", "csx", "ex", "emptyFunction", "ge", "getElementText", "goURI", "throttle", "tickerPhoteSnowLiftOpenStatus"], function(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, aa, ba, ca, da, ea, fa, ga, ha, ia, ja, ka, la, ma, na, oa, pa, qa, ra, sa, ta, ua, va) {
b.__markCompiled && b.__markCompiled();
var wa = 15000,
xa = {};