Skip to content

Instantly share code, notes, and snippets.

@turbidsoul
turbidsoul / ftp_download.py
Created June 23, 2013 07:06
ftp下载显示现在进度
import ftplib
import sys
from progressbar import ProgressBar
from progressbar.widgets import Percentage, FileTransferSpeed, ETA, Bar
if len(sys.argv) < 4:
print("请输入ftp地址,用户,密码和文件".decode("utf8"))
sys.exit(0)
@turbidsoul
turbidsoul / minimum.py
Created May 13, 2013 09:42
pygments styles
# -*- coding: utf-8 -*-
"""
pygments.styles.minimum
~~~~~~~~~~~~~~~~~~~~~~
pygments version of my "minimum" vim theme.
:license: BSD, see LICENSE for details.
"""
# -*- coding: utf8 -*-
__enc64__ = [
'A', 'B', 'C', 'D', "E", "F", 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', "W", 'X', 'Y', 'Z',
'a', 'b', 'c', 'd', "e", "f", 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', "w", 'x', 'y', 'z',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/', '='
]
__enc32__ = [
@turbidsoul
turbidsoul / InstallCert.java
Created May 3, 2013 01:36
生成java的安全证书,并把起copy到%JAVA_HOME%\jre\lib\security下,或者在启动参数中加入-Djavax.net.ssl.trustStore=F:/work/Java/jssecacerts即可。 编译文件之后,运行字节码,java InstallCert web_site_hostname 会在当前目录下生成jssecacerts文件
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
package cn.is.ftp;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
@turbidsoul
turbidsoul / Base16.java
Created March 23, 2013 08:28
java base 16 编码和解码
/***
* Copyright 2006 bsmith@qq.com
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
* copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
@turbidsoul
turbidsoul / base16.lua
Last active December 15, 2015 07:59
lua 16进制编码
local str = "2e7ac38c09ddc025825be6267fd11725"
hex = {}
local HexToDec={
['0'] = 0, ['1'] = 1, ['2'] = 2, ['3'] = 3,
['4'] = 4, ['5'] = 5, ['6'] = 6, ['7'] = 7,
['8'] = 8, ['9'] = 9, ['A'] = 10, ['B'] = 11,
['C'] = 12, ['D'] = 13, ['E'] = 14, ['F'] = 15,
['A'] = 10, ['B'] = 11, ['C'] = 12, ['D'] = 13,
['E'] = 14, ['F'] = 15
@turbidsoul
turbidsoul / UnicodeCover.java
Created October 17, 2012 01:22
转换指定目录及其子目录下所有文件的编码从GBK到UTF-8
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
/**
*
@turbidsoul
turbidsoul / dabblet.css
Created October 12, 2012 07:40 — forked from lensco/dabblet.css
box-shadow vs filter: drop-shadow
/**
* box-shadow vs filter: drop-shadow
*/
body {
background: #ddd;
font: 16px/1 sans-serif;
}
div {
margin: 100px;