Skip to content

Instantly share code, notes, and snippets.

@huanghao
huanghao / btn.js
Last active June 18, 2021 04:53
会计视频增加一个截图按钮
function mycode() {
var vid = document.getElementsByTagName('video')[0];
vid.crossOrigin = "Anonymous";
var can = document.createElement('canvas');
var ctx = can.getContext('2d');
var a = document.createElement('a');
var btn = document.createElement('button');
btn.innerText = "截图";
@huanghao
huanghao / btn.js
Last active June 18, 2021 05:17
会计copy习题到剪贴板
function mycode() {
var can = document.createElement('canvas');
var ctx = can.getContext('2d');
var a = document.createElement('a');
var btn = document.createElement('button');
btn.innerText = "截图";
btn.style.height = "36px";
btn.style.width = "72px";
@huanghao
huanghao / .gitignore
Last active March 1, 2016 00:46
rush
payurl.txt
setup.sh
ctrl.sh
*.ova
adt-bundle-mac-x86_64-20140702/
*.zip
env/*
gm/*
*.dmg
*.apk
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
import string
import logging
import argparse
import itertools
from collections import defaultdict
from subprocess import check_output, Popen, PIPE
@huanghao
huanghao / d3-interpolate.html
Created April 20, 2014 10:50
Different interpolate style of d3
<html>
<head>
<script src="d3.v3.min.js" charset="utf-8"></script>
</head>
<body>
<div id="graph"></div>
<script type="text/javascript">
var options = ['linear', 'linear-closed', 'step', 'step-before', 'step-after', 'basis', 'basis-open', 'basis-closed', 'bundle', 'cardinal', 'cardinal-open', 'cardinal-closed', 'monotone'];
d3.select('body').insert('select', ':first-child')
.selectAll('option')
@huanghao
huanghao / pub2duitang.py
Created January 8, 2012 15:08
rt tools
#coding: utf8
import urllib2
import urllib
import os
import re
from urlparse import urlparse
import time
import getopt
import sys
@huanghao
huanghao / postman.py
Created November 17, 2011 17:30
接收邮件,调用email2trac
import os
import sys
import datetime
import poplib
import getopt
import email
import re
pwd = os.path.dirname(os.path.realpath(__file__))
#coding: utf8
import os
import sys
import re
import urllib2
import time
from headers import headers
cwd = os.path.join(os.getcwd(), os.path.dirname(sys.argv[0]))
@huanghao
huanghao / sleepsort.sh
Created June 16, 2011 14:56
蛋疼的排序
#!/bin/bash
function f() {
sleep "$1"
echo "$1"
}
while [ -n "$1" ]
do
f "$1" &
shift
done
@huanghao
huanghao / nmc.py
Created May 20, 2011 03:31
获取天气预报信息,信息来源nmc of cma(national meteorological center of china meteorological administration)
#coding: utf8
import sys
import urllib2
from getopt import getopt
from re import findall, S, sub
def GET(url, headers={}, *args, **kw):
req = urllib2.Request(url)
for key, val in headers.items():