Skip to content

Instantly share code, notes, and snippets.

View HuangFJ's full-sized avatar

Jon Huang HuangFJ

  • ❤️☠️🤖
  • X @HFJ
View GitHub Profile
@HuangFJ
HuangFJ / setup.py
Created February 8, 2013 07:11
采集微博的动画gif图片
from distutils.core import setup
import py2exe
data_files = [("config.ini"),("test.db")]
includes = ["mechanize", "simplejson", "PIL.Image"]
options = {"py2exe":
{ "compressed": 1,
"optimize": 2,
@HuangFJ
HuangFJ / video.php
Last active May 4, 2017 11:08
通过php直接输出的文件通常不被html5的<video>标签支持,尤其是ios设备。为了完美支持html5的视频播放,php必须支持byte-range请求。因为html5播放视频之前会发送一个只需文件少数字节的请求,确认服务端是否支持byte-range请求,支持才会继续发送请求剩余的文件数据。
<?php
$localfile = "test.mp4";
$size = filesize($localfile);
$start = 0;
$end = $size - 1;
$length = $size;
header("Accept-Ranges: 0-$size");
@HuangFJ
HuangFJ / graphite
Created January 11, 2014 17:52 — forked from drawks/graphite
#This is the "site config" for nginx
upstream django {
# Distribute requests to servers based on client IP. This keeps load
# balancing fair but consistent per-client. In this instance we're
# only using one uWGSI worker anyway.
ip_hash;
server unix:/tmp/uwsgi.sock;
}
server {
@HuangFJ
HuangFJ / install_opencv2.4.9.sh
Last active November 11, 2021 14:08 — forked from mitmul/install_opencv2.4.8.sh
centos 6.5 + opencv 2.4.9 + ffmpeg 0.10.11 + python 2.7.7 自动安装脚本
#! /bin/bash
sudo yum install -y gcc g++ gtk+-devel libjpeg-devel libtiff-devel jasper-devel libpng-devel zlib-devel cmake unzip sqlite-devel readline-devel bzip2-devel openssl-devel ncurses-devel
sudo yum install -y yum-priorities
sudo rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
sudo yum install -y eigen3-devel --enablerepo=epel
su -c 'yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/el/updates/6/i386/rpmfusion-free-release-6-1.noarch.rpm http://download1.rpmfusion.org/nonfree/el/updates/6/i386/rpmfusion-nonfree-release-6-1.noarch.rpm'
sudo yum install -y ffmpeg-devel
export PYTHON_PREFIX=/usr/local/python-2.7.7
@HuangFJ
HuangFJ / upnp.py
Created August 24, 2014 17:03
NAT Traversal via UPnP Port Mapping
# NAT Traversal via UPnP Port Mapping
# Written by Nikos Fotoulis <nikofot at gmx.com>
# This code is public domain.
#
# Tested on Thomsom TG858v7 modem router.
# UPnP is hairy. May not work with other routers
# Feedback is welcome.
#
# How to add multicast address on Mac OS please refer to
# http://blogs.agilefaqs.com/2009/11/08/enabling-multicast-on-your-macos-unix/
@HuangFJ
HuangFJ / analysis.yaml
Created January 19, 2015 18:17 — forked from igor-kupczynski/analysis.yaml
How to implement good search on product name in Elasticsearch. http://igor.kupczynski.info/2014/10/22/search-for-product-name.html
analyzer:
generic_name_analyzer:
type: "custom"
tokenizer: "icu_tokenizer"
filter: ["word_split", "icu_folding", "english_stop"]
trigram_name_analyzer:
type: "custom"
tokenizer: "icu_tokenizer"
filter: ["icu_folding", "english_stop", "trigram_filter"]

Keybase proof

I hereby claim:

  • I am huangfj on github.
  • I am j0n (https://keybase.io/j0n) on keybase.
  • I have a public key ASBkytSxPeJ5OCPwC9ASI-K-8GbggHh7RYCRT1hqw-_nUAo

To claim this, I am signing this object:

@HuangFJ
HuangFJ / btc_txs_crawler.rs
Created June 3, 2023 15:37
crawl BTC txs
use anyhow::{anyhow, Result};
use cuckoofilter::CuckooFilter;
use futures::future::join_all;
use serde_json::Value;
use std::collections::hash_map::DefaultHasher;
use tracing::debug;
const REST_URL: &str = "https://btc.getblock.io/<YOUR OWN API KEY>/testnet";
const LAST_BLOCK_HASH: &str = "00000000000010f9d43bb5c329aef7c5ab0c4f115cb5a0f4484b0267769ee0ff";
const ACCOUNTS: [&str; 1] = ["tb1q95e88yfvytshvkk8pv7eguzj05qatlty0wm687"];

Keybase proof

I hereby claim:

  • I am huangfj on github.
  • I am huangfj (https://keybase.io/huangfj) on keybase.
  • I have a public key ASBdzA-gSjy_WXBsUxU_IgRs4TZx754pu4SdueVTheXS8Ao

To claim this, I am signing this object: