Skip to content

Instantly share code, notes, and snippets.

@dieterplex
dieterplex / gcin.spec
Created December 26, 2011 22:46
gcin-2.6.8 rpm spec for fedora
%define release liu_mdk
%define prefix /usr
%define name gcin
%define version 2.6.8
Summary: gcin : Chinese input method server
Name: %{name}
Version: %{version}
Release: %{release}
@dieterplex
dieterplex / request_time.py
Created April 26, 2012 07:19 — forked from andrewwatts/request_time.py
urllib2 vs urllib3 vs requests
#!/usr/bin/env python2.7
import urllib2
import time
_ITERATIONS = 200
start_time = time.time()
for i in range(0, _ITERATIONS):
@dieterplex
dieterplex / playdeb.sh
Created October 8, 2012 02:34 — forked from stefanbirkner/playdeb.sh
Playdeb builds a debian package of the play framework.
#!/bin/bash
# playdeb builds a debian package of the play framework. playdeb downloads
# the playframework by itself. You run it by
# playdeb.sh <version> <maintainer>
# Example:
# playdeb.sh 1.2.3 "Denny Colt <[email protected]>"
#
# The script has been tested with version 1.2.3.
if [ -z $1 ]
#!/usr/bin/python
from pprint import pprint as p;import subprocess as s;
def loop_list_print(cmds):
oo = [ s.Popen(['/bin/sh','-c', cmd], stdout=s.PIPE).communicate()[0] for cmd in cmds]
ooo = [ ( o, o.decode('unicode_escape',errors='replace'), o.decode('big5') ) for o in oo ]
for oo in ooo:
for o in oo:
print(o.strip())
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import urllib2
from HTMLParser import HTMLParser
def write(value=''):
sys.stdout.write(str(value))
class MyHTMLParser(HTMLParser):
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package testsnmp4j;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Vector;
# coding: utf-8
import json
import os
import sys
import re
import fnmatch
import concurrent.futures
# https://stackoverflow.com/a/5141829/554150
def find_logs(target_path):
@dieterplex
dieterplex / get_key_counts.py
Last active June 3, 2024 14:43 — forked from m77so/get_key_counts.py
Export key type counts from Niz Plum 68. Reference: https://github.com/cho45/niz-tools-ruby/
# using python-hidapi
import hid
import time
VENDOR_ID = 0x0483
PRODUCT_ID = 0x5032
TOTAL_KEY_COUNT = 68
h = hid.device()
keyboard_path = [ a['path'] for a in hid.enumerate(VENDOR_ID, PRODUCT_ID) if a['interface_number']==1][0]