Skip to content

Instantly share code, notes, and snippets.

View rabintang's full-sized avatar

binTang rabintang

  • Tencent, Shenzhen
  • Shenzhen, China
View GitHub Profile
@rabintang
rabintang / crf.py
Created May 11, 2014 02:11 — forked from neubig/crf.py
#!/usr/bin/python
# crf.py (by Graham Neubig)
# This script trains conditional random fields (CRFs)
# stdin: A corpus of WORD_POS WORD_POS WORD_POS sentences
# stdout: Feature vectors for emission and transition properties
from collections import defaultdict
from math import log, exp
import sys
@rabintang
rabintang / Atopk SQL File
Created June 20, 2013 11:26
zen cart的Atopk模板的空数据库文件
-- phpMyAdmin SQL Dump
-- version 3.4.11.1deb1
-- http://www.phpmyadmin.net
--
-- 主机: localhost
-- 生成日期: 2013 年 06 月 18 日 23:36
-- 服务器版本: 5.5.29
-- PHP 版本: 5.4.6-1ubuntu1.1
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
@rabintang
rabintang / gist:5975472
Created July 11, 2013 13:33
C#的Email邮件发送系统,简单易用
/*****************************************************************/
* 功能:发送自定义电子邮件,可以用于在系统发送自定义系统邮件。
/*****************************************************************/
using System;
using System.Net;
using System.Net.Mail;
using System.Net.Mime;
namespace XFish.Utils
{
@rabintang
rabintang / GoogleSpellingAPI
Last active December 29, 2015 05:49
利用Google提供的API来对输入的词做拼写检查,并得到来自Google返回的建议
# -*- coding: utf-8 -*-
import time
import os
import sys
import urllib2,urllib
import HTMLParser
import xml.dom.minidom
import xml.etree.ElementTree as ET
@rabintang
rabintang / tensorflow_rename_variables.py
Created July 24, 2017 03:31 — forked from batzner/tensorflow_rename_variables.py
Small python script to rename variables in a TensorFlow checkpoint
import sys, getopt
import tensorflow as tf
usage_str = 'python tensorflow_rename_variables.py --checkpoint_dir=path/to/dir/ ' \
'--replace_from=substr --replace_to=substr --add_prefix=abc --dry_run'
def rename(checkpoint_dir, replace_from, replace_to, add_prefix, dry_run):
checkpoint = tf.train.get_checkpoint_state(checkpoint_dir)
@rabintang
rabintang / torchtext_dataset_example.py
Last active November 10, 2017 04:30
torchtext dataset example
from torchtext import data
class DatasetDemo(data.Dataset):
def __init__(self, fields, path=None, examples=None, **kwargs):
if examples is None:
examples = []
for line in file(path):
parts = line.split("\t")
target = parts[0]
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import urllib
import urllib2
import cookielib
import base64
import re
import json
@rabintang
rabintang / Generate_Thumbnail.py
Last active January 4, 2022 10:48
使用python生成缩略图,支持遍历整个文件夹中指定图片格式的图片
#-*-!/usr/bin/env python-*-
#-*-coding=utf-8-*-
from PIL import Image
import os
import sys
import fnmatch
import logging
class ThumbnailGenerator: