Skip to content

Instantly share code, notes, and snippets.

Weihong Guan aguegu

View GitHub Profile
@aguegu
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
aguegu / ss2qrcode.py
Created Mar 18, 2017
Shadowsocks QRCode generation
View ss2qrcode.py
import pyqrcode
import base64
url = 'bf-cfb-auth:test@192.168.100.1:8888'
print pyqrcode.create('ss://' + base64.b64encode(url)).terminal()
@aguegu
aguegu / README.md
Created Sep 27, 2016 — forked from chuangbo/README.md
Python dynamic DNSPod DNS Script
View README.md

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

获得domain_id可以用curl curl -k https://dnsapi.cn/Domain.List -d "login_email=xxx&login_password=xxx"

获得record_id类似 curl -k https://dnsapi.cn/Record.List -d "login_email=xxx&login_password=xxx&domain_id=xxx"

@aguegu
aguegu / proxy_activate.sh
Created Apr 3, 2015
activate/deactivate terminal proxy
View proxy_activate.sh
#!/bin/zsh
export {http,https,ftp}_proxy='http://localhost:7777'
@aguegu
aguegu / conv.py
Created Dec 17, 2014
python script to batch converting from mkv to mp4
View conv.py
#!/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: atlantic.net ubuntu 14.04 x64
* the commands below are run with root account
## Strongswan
```
apt-get install strongswan
apt-get install iptables iptables-persistent
```
View in_venv.sh
#!/bin/bash
. venv/bin/activate
echo "Executing $@ in venv"
exec "$@"
deactivate
@aguegu
aguegu / .editorconfig
Last active Aug 29, 2015
BendixCrawler
View .editorconfig
# EditorConfig is awesome: http://EditorConfig.org
# 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
aguegu / sqlite_unicode.py
Created Jun 23, 2014
why python sqlite3 convert str to number by default?
View sqlite_unicode.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sqlite3
import sys
con = None
try:
con = sqlite3.connect(':memory:')
You can’t perform that action at this time.