Skip to content

Instantly share code, notes, and snippets.

View jk2K's full-sized avatar
💭
I may be slow to respond.

Meng Ye jk2K

💭
I may be slow to respond.
View GitHub Profile
@jk2K
jk2K / appcrush.py
Created May 26, 2015 07:03
appcrush.rb的python版本
# coding=utf-8
import os
import sys
import glob
pngcrush = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush"
destination = os.path.join(os.environ['HOME'], 'Desktop')
for ipa in sys.argv:
@jk2K
jk2K / mac
Last active August 22, 2018 09:50
Vim配置文件 .vimrc
"不兼容vi
set nocompatible
"让删除键更好用
set backspace=2
"不创建撤销文件
set noundofile
"取消自动备份
set nobackup
"自动缩进
set autoindent
@jk2K
jk2K / netpayclient.php
Last active August 29, 2015 14:12
chinapay向上兼容php5.5
<?php
define("DES_KEY", "SCUBEPGW");
define("HASH_PAD", "0001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff003021300906052b0e03021a05000414");
bcscale(0);
$private_key = array();
if (!function_exists('hex2bin'))
{
function hex2bin($hexdata)
{
$bindata = '';
@jk2K
jk2K / generate_mnid.php
Created September 17, 2014 09:05
控制discuz导航高亮的$mnid生成算法
<?php
$_G['mnid'] = 'mn_N'.substr(md5('your_link'), 0, 4);
//地址在discuz后台主导航里面找
@jk2K
jk2K / chunzhen_ip.php
Created May 28, 2014 05:48
PHP利用纯真IP数据库获取地址信息,代码转载自:PHP爱好者 [http://www.joyphper.net/]
<?php
/**
* IP 地理位置查询类
*
* @author joyphper
* @version 1.0
* @copyright 2010 joyphper.net
*/
@jk2K
jk2K / bulk_recount_usercredit.php
Created May 27, 2014 07:33
批量重新计算discuz用户积分
<?php
require './source/class/class_core.php';
$discuz = & discuz_core::instance();
$discuz->init();
$credit = & credit::instance();
$sql = 'select uid from ' . DB::table('common_member');
$users = DB::fetch_all($sql);
//重新计算用户积分
@jk2K
jk2K / import_to_fengche.py
Created May 20, 2014 10:40
自动将txt文本里的内容发布到fengche代办中
# coding=utf-8
from urllib import request
from urllib import parse
from http import cookiejar
username = 'your_username'
password = 'your_password'
login_url = 'https://fengcheco.com/auth/identity/callback'
project_id = 'your_project_id'
iteration_id = 'your_iteration_id'
@jk2K
jk2K / auto_post_to_github.bat
Last active August 29, 2015 14:01
windows批处理:自动发布代码到github automatically post to github
::方便调试set cur_path = %cd%
e:
cd e:\www\CGBT2
git checkout gh-pages
php e:\www\newcgbt_release\v2.0\tools\db_dict_generator.php
move C:\Users\Lee\Desktop\db_dict.html e:\www\CGBT2
git add db_dict.html
git commit -am "generate database dict, %date:~0, 10%"
git push origin gh-pages
git checkout master
@jk2K
jk2K / db_dict_generator.php
Created May 5, 2014 03:20
php生成mysql数据字典, 根据作者郭剑锋的代码做了一些小改动, 使得可以生成html, 原址链接http://yuncode.net/code/c_533ce5180d50247
<?php
/**
* 生成mysql数据字典
*/
header("Content-type: text/html; charset=utf-8");
// 配置数据库
$dbserver = "localhost";
$dbusername = "mysql用户名";
$dbpassword = "mysql密码";
@jk2K
jk2K / gist:9636901
Created March 19, 2014 07:18
格式化文件大小
function size_format( $bytes, $decimals = 0 ) {
$quant = array(
// ========================= Origin ====
'TB' => 1099511627776, // pow( 1024, 4)
'GB' => 1073741824, // pow( 1024, 3)
'MB' => 1048576, // pow( 1024, 2)
'kB' => 1024, // pow( 1024, 1)
'B ' => 1, // pow( 1024, 0)
);
foreach ( $quant as $unit => $mag )