Skip to content

Instantly share code, notes, and snippets.

View hvnsweeting's full-sized avatar

Viet Hung Nguyen hvnsweeting

View GitHub Profile
@hvnsweeting
hvnsweeting / SmartOnTouchListener.java
Created March 16, 2012 16:21
SmartOnTouchListener
/**
* @author Nguyen Viet Hung (hvnsweeting@gmail.com)
* @version 1.0
* SmartOnTouchListener class help convert your onTouch into single-click and drag&drop, double-click and drag&drop or long-click and drag&drop
*/
package com.aps.smartbar.quicksettings.service;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
@hvnsweeting
hvnsweeting / FML TODO
Created May 22, 2012 13:28
todo for FML site
1. Customize blog layout
2. Write many post
#!/usr/bin/env python
import smtplib
from datetime import datetime
SMTP_SERVER = 'smtp.gmail.com'
SMTP_PORT = 587
sender = 'bot.c2k8pro@gmail.com'
subject ='[BirthReminder] Happy birthday to you! from C2k8pro'
password = 'xxxxxx'
1365 ip ru g
1366 ip ru get
1371 ip ru
1877 ip ru
1878 ip ru del pref 32766
1880 ip ru ad from all lookup main pref 20
1881 ip ru ad from all lookup table 90
1882 ip ru ad from all lookup 90
1883 ip ru
1908 ip ru
iproute commands
Prerequisites
iproute2 package
kernel configure options:
CONFIG_IP_ADVANCED_ROUTER=y
CONFIG_IP_MULTIPLE_TABLES=y
CONFIG_IP_ROUTE_MULTIPATH=y
menuconfig path:
import requests
import json
HOST = "http://0.0.0.0:8080/create"
rules = [{"ip" : "123.123.123.123", "type":"all"},
{"ip" : "192.168.4.130" , "type" : "all"},
{"ip" : "192.168.3.182" , "type" : "all"},
{"ip" : "123.30.53.12" , "type" : "all"},
{"ip" : "222.255.27.156" , "type" : "all"},
{"ip" : "1.2.3.4", "type" : "ftp"},
import requests
import json
HOST = "http://0.0.0.0:8080/create"
rules = [{"ip" : "123.123.123.123", "type":"all"},
{"ip" : "192.168.4.130" , "type" : "all"},
{"ip" : "192.168.3.182" , "type" : "all"},
{"ip" : "123.30.53.12" , "type" : "all"},
{"ip" : "222.255.27.156" , "type" : "all"},
{"ip" : "1.2.3.4", "type" : "ftp"},
def make_bezier(xys):
# xys should be a sequence of 2-tuples (Bezier control points)
n=len(xys)
combinations=pascal_row(n-1)
def bezier(ts):
# This uses the generalized formula for bezier curves
# http://en.wikipedia.org/wiki/B%C3%A9zier_curve#Generalization
result=[]
for t in ts:
tpowers=(t**i for i in range(n))
from PIL import Image, ImageDraw
from bezier import *
if __name__=='__main__':
im = Image.new('RGBA', (100, 100), (0, 0, 0, 0))
draw = ImageDraw.Draw(im)
ts=[t/100.0 for t in range(101)]
xys=[(50,100),(80,80),(100,50)]
bezier=make_bezier(xys)
<domain type='kvm' id='4'>
<name>first</name>
<uuid>a65f501c-78cb-82de-57d4-0f02bccf68cd</uuid>
<memory>524288</memory>
<currentMemory>524288</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='x86_64' machine='pc-1.0'>hvm</type>
<boot dev='hd'/>
</os>