Skip to content

Instantly share code, notes, and snippets.


Weihong Guan aguegu

View GitHub Profile
aguegu / feeder.js
Created Dec 13, 2018
csv.tar.gz generator
View feeder.js
/* eslint-env mocha */
/* eslint no-console: 'off' */
import chai from 'chai';
import chaiHttp from 'chai-http';
import 'chai/register-should';
import { createObjectCsvWriter } from 'csv-writer';
import config from 'config';
import _ from 'lodash';
import moment from 'moment';
aguegu /
Created Mar 18, 2017
Shadowsocks QRCode generation
import pyqrcode
import base64
url = 'bf-cfb-auth:test@'
print pyqrcode.create('ss://' + base64.b64encode(url)).terminal()
aguegu /
Created Sep 27, 2016 — forked from chuangbo/
Python dynamic DNSPod DNS Script

替换上你的Email,密码,域名ID,记录ID等参数,就可以运行了。 会在后台一直运行,每隔30秒检查一遍IP,如果修改了就更新IP。

获得domain_id可以用curl curl -k -d "login_email=xxx&login_password=xxx"

获得record_id类似 curl -k -d "login_email=xxx&login_password=xxx&domain_id=xxx"

aguegu /
Created Apr 3, 2015
activate/deactivate terminal proxy
export {http,https,ftp}_proxy='http://localhost:7777'
aguegu /
Created Dec 17, 2014
python script to batch converting from mkv to mp4
#!/usr/bin/env python
from subprocess import call
for i in range(4, 25):
call(["avconv", "-i", "DFTV.Ipartment.S03E%02d.720p.HDTV.x264-NGB.mkv" % i, "-acodec", "aac", "-strict", "experimental", "DFTV.Ipartment.S03E%02d.720p.HDTV.x264-NGB.mp4" % i])
View strongswan ikev2 server on ubuntu 14.04
# Basic Strongswan ikev2 server setup
* paltform: ubuntu 14.04 x64
* the commands below are run with root account
## Strongswan
apt-get install strongswan
apt-get install iptables iptables-persistent
. venv/bin/activate
echo "Executing $@ in venv"
exec "$@"
aguegu / .editorconfig
Last active Aug 29, 2015
View .editorconfig
# EditorConfig is awesome:
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
View gist:65d13625f8b0979c7a47
in progress (#1046): re-focus this page on deployment of python on linux, esp. suse; perhaps move to PythonDeployment?. for developer set-up, see WritingQualityCode
virtualenv is a tool to create isolated Python environments:
The basic problem being addressed is one of dependencies and versions, and indirectly permissions. Imagine you have an application that needs version 1 of LibFoo , but another application requires version 2. How can you use both these applications? Or what if you want to install an application and leave it be ? If an application works, any change in its libraries or the versions of those libraries can break the application. ... In all these cases, virtualenv can help you.
Machine Set-Up
If your development machine runs ubuntu (or debian) linux, install with apt-get:
aguegu /
Created Jun 23, 2014
why python sqlite3 convert str to number by default?
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sqlite3
import sys
con = None
con = sqlite3.connect(':memory:')