Skip to content

Instantly share code, notes, and snippets.

View yszheda's full-sized avatar

Shuai YUAN yszheda

View GitHub Profile
require 'rubygems'
require 'nokogiri'
require 'fileutils'
require 'date'
require 'uri'
# usage: ruby import.rb my-blog.xml
# my-blog.xml is a file from Settings -> Basic -> Export in blogger.
data = File.read ARGV[0]
@yszheda
yszheda / jxsj-mahler-crawler.py
Created February 8, 2014 06:59
a naive python crawler for the jxsj magzine.
import re
import urllib
import urlparse
import os
def getHtml(url):
page = urllib.urlopen(url)
html = page.read()
return html
@yszheda
yszheda / tmuxEnvSaver.sh
Last active November 17, 2016 06:54
take and restore tmux snapshot
#!/bin/bash
# take and restore tmux snapshot
tmuxSnapshot="/.tmux_snapshot"
tmuxEXE=`which tmux`
save_snap()
{
${tmuxEXE} list-windows -a -F"#{session_name} #{window_name} #{pane_current_command} #{pane_current_path}" > ${tmuxSnapshot}
}
@yszheda
yszheda / .ycm_extra_conf.py
Created August 29, 2014 04:10
YouCompleteMe config for cocos2d-x project on Mac
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
@yszheda
yszheda / gitdiff-svnpatch.sh
Created December 8, 2015 12:32 — forked from katta/gitdiff-svnpatch.sh
Converts git diff to svn patch format
git diff --no-prefix | sed -e "s/^diff --git [^[:space:]]*/Index:/" -e "s/^index.*/===================================================================/" --ignore-space-at-eol > changes.patch
@yszheda
yszheda / sync-git-commit-to-svn-branch.sh
Last active December 9, 2015 03:36
sync the specified git commit to another git-svn/svn branch
#!/bin/bash
if [ $1 == "-h" ]; then
echo "Usage: "
echo "$(basename $0) <git commit SHA1>"
exit 0
fi
SHA1=$1
REPO_DIR=""
@yszheda
yszheda / auto_send_daily_mail.sh
Last active December 14, 2015 07:42
auto generate your daily work report by scanning your commits in the git repo, and send the mail to your boss.
#!/bin/bash
SMTP_URL=""
USER=""
SENDER=""
RECEIVER=""
DATE=`date +%Y-%m-%d`
REPORT=""
./gen_daily_report.sh $SENDER $RECEIVER $REPORT
@yszheda
yszheda / BMFontGenerator.sh
Created December 9, 2015 11:48
generate BMFont from a set of pngs
#!/bin/bash
if [ $1 == "-h" ]; then
echo "Usage: "
echo "$(basename $0) <inputPath> <prefix>"
echo "generate png and fnt under <inputPath>/output"
echo "<inputPath>: path containing images"
echo "<prefix>: prefix of output file names"
exit 0
fi
inputPath=$1
@yszheda
yszheda / 修复系统权限错误.txt
Created February 17, 2016 02:43 — forked from syxc/修复系统权限错误.txt
sudo chmod 777 / 惨剧修复简单步骤
sudo chmod 777 /
sudo chmod 777 -R /
Linux下以上命令的危害性,试过的人都会觉得可怕,有些人遇到这种情况,第一反应是没救了,其实,你要愿意花功夫去折腾,还是有办法滴!
下面理了下怎么折腾:
道具:
A、B两台电脑,假设都装着Ubuntu 12.04版本的系统,都能ssh、root(平时装Linux的时候这两个最好都弄好了,以备不时之需)。
情景:
现假设「A」是那台悲剧的执行过「sudo chmod 777 /」的电脑,什么效果,就不说了,反正不是什么好事,如果好奇,一试便知!
@yszheda
yszheda / find_duplicate_files.py
Last active August 8, 2016 02:38
find duplicate texture files
#!/usr/bin/env python
# coding:utf-8
# find duplicate png in tp projects
import sys
import getopt
import os
import hashlib
import filecmp