Skip to content

Instantly share code, notes, and snippets.

@tlhc
tlhc / remmina_password_exposer.py
Created February 6, 2015 08:43
Remmina Password
from Crypto.Cipher import DES3
import base64
import os
import re
from os.path import expanduser
home = expanduser("~")
# costanti :)
REMMINA_FOLDER = home+'/'+'.remmina/'
一、键盘风格
UIKit框架支持8种风格键盘
```
typedef enum {
UIKeyboardTypeDefault, // 默认键盘:支持所有字符
UIKeyboardTypeASCIICapable, // 支持ASCII的默认键盘
UIKeyboardTypeNumbersAndPunctuation, // 标准电话键盘,支持+*#等符号
UIKeyboardTypeURL, // URL键盘,有.com按钮;只支持URL字符
UIKeyboardTypeNumberPad, //数字键盘
@tlhc
tlhc / vlm.c
Last active August 29, 2015 14:11
libvlc
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <vlc/vlc.h>
#include <time.h>
#include <signal.h>
#define UNUSED(x) (void)(x)
static const char* vlcArguments[] = {
@tlhc
tlhc / ntp.py
Last active August 29, 2015 14:11
ntp request
#!/usr/bin/env python
from socket import AF_INET, SOCK_DGRAM
import sys
import socket
import struct, time
def getNTPTime(host = "pool.ntp.org"):
port = 123
buf = 1024
address = (host,port)
@tlhc
tlhc / BaseHttpServer.py
Created December 11, 2014 09:56
BaseHttpServer.py
"""HTTP server base class.
Note: the class in this module doesn't implement any HTTP request; see
SimpleHTTPServer for simple implementations of GET, HEAD and POST
(including CGI scripts). It does, however, optionally implement HTTP/1.1
persistent connections, as of version 0.3.
Contents:
- BaseHTTPRequestHandler: HTTP request handler base class
@tlhc
tlhc / clsadv.py
Created July 18, 2014 05:29
dump mp3 info from Dive Into Python
"""Framework for getting filetype-specific metadata.
Instantiate appropriate class with filename. Returned object acts like a
dictionary, with key-value pairs for each piece of metadata.
import fileinfo
info = fileinfo.MP3FileInfo("/music/ap/mahadeva.mp3")
print "\\n".join(["%s=%s" % (k, v) for k, v in info.items()])
Or use listDirectory function to get info on all files in a directory.
for info in fileinfo.listDirectory("/music/ap/", [".mp3"]):
/*
* =====================================================================================
*
* Filename: el.c
*
* Description:
*
* Version: 1.0
* Created: 2014年06月19日 10时28分18秒
* Revision: none
@tlhc
tlhc / gethost.py
Created November 2, 2013 11:20
get the google dns list
# !/usr/bin/env python
#my first python script
import urllib2
import os
enable_proxy = True
proxy_hander = urllib2.ProxyHandler({"http" : 'http://127.0.0.1:8087'})
null_proxy_hander = urllib2.ProxyHandler({})
if enable_proxy:
opener = urllib2.build_opener(proxy_hander)
@tlhc
tlhc / gist:4181206
Created December 1, 2012 09:08
eh....just for fun.. so stupid..
find . -iname | file * | grep -i "executable" | awk -F ':' '{print $1}' | xargs git rm