Skip to content

Instantly share code, notes, and snippets.

@etng
etng / gist.py
Created September 26, 2017 03:01
published from yibombp.local
#!/usr/bin/env python
'''
# Create a Github Gist with a simple Python script
## usage
* save this file as ~/gist.py
* and call it like this:
* create new gist with filenames
@etng
etng / jupyter_ipython_unittest.ipynb
Created May 5, 2017 03:26 — forked from vlad-bezden/jupyter_ipython_unittest.ipynb
Example of how to use unittest in IPython or Jupyter
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@etng
etng / recover_source_code.md
Created March 17, 2017 07:33 — forked from simonw/recover_source_code.md
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@etng
etng / build_tmux_on_centos.sh
Created December 15, 2016 01:37
build tmux on centos 6
# Build Install tmux on Centos
# install deps
yum install -y gcc kernel-devel make ncurses-devel
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL
mkdir tmp && cd tmp
mkdir libevent
curl -L -o- https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz | tar -zxvf - --strip-components=1 -C libevent
cd libevent
./configure --prefix=/usr/local
make && make install
@etng
etng / vpn_psk_bingo.md
Created November 28, 2016 05:14 — forked from kennwhite/vpn_psk_bingo.md
Most VPN Services are Terrible
@etng
etng / dns2https.php
Created September 18, 2016 08:49 — forked from diyism/dns2https.php
dns2https.php
<?php
/*
tcp dns client for google dns over https (https://dns.google.com)
ubuntu上使用:
在/etc/rc.local里加/usr/bin/php /home/<your_name>/dns2https.php
执行:
sysv-rc-conf unbound off
sysv-rc-conf dnscrypt-proxy off
Large Object Motions:
(
)
{
}
[[
[]
][
]]
[m
@etng
etng / bobp-python.md
Created November 13, 2015 00:03 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@etng
etng / surge.conf
Created October 14, 2015 06:45 — forked from soffchen/surge.conf
surge.conf
[General]
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, localhost, *.local
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12
dns-server = 119.29.29.29, 223.5.5.5, 114.114.114.114
loglevel = notify
[Proxy]
Proxy = custom
[Rule]