Skip to content

Instantly share code, notes, and snippets.

View jackeylu's full-sized avatar

Lin Lyu jackeylu

  • Tianfeng Security Ltd.
  • Wuhan
View GitHub Profile
@jackeylu
jackeylu / seq-naming.py
Created April 27, 2014 02:00
naming a batch of files with sequence index
# coding: utf-8
import glob
files = glob.glob("*") # get the file list of current directory
out = open("m.bat","w") # generate bat file
i = 1 # where the index start from
for f in files:
newname = "%03.d%s" %(i,f) # output new file name like 001filename, 002filename
out.writelines("move %s %s\n"%(f, newname))
i = i +1
@jackeylu
jackeylu / url-decoder.py
Created November 24, 2013 12:37
一个url编解码的小程序,通常google搜索结果页面在跳转到真实页面时,需要经过google自身的url,但是有时候会被reset,通过这个代码可以直接获取真实地址。
#!/bin/env python
# coding=utf-8
#
# a basic url decoder can be helpful to find out the real page link, when you google refered page was blocked by the GFW
#
from urllib2 import quote, unquote
from getopt import getopt, GetoptError
import sys
@jackeylu
jackeylu / stringstream
Created July 24, 2013 16:01
a stringstream example for converting any built-in type or self-defined with _str method
#include <sstream> // for stringstream
#include <iostream>
template <class T>
T convert(const char* arg)
{
T result;
std::stringstream ss;
ss << arg;
ss >> result;
@jackeylu
jackeylu / container_toString
Created July 24, 2013 15:58
a basic to string method for different containers
#include <iostream>
#include <vector>
int main(void)
{
std::vector<int> vecInt(3);
vecInt[0] = 1;
vecInt[1] = 2;
vecInt[2] = 3;
@jackeylu
jackeylu / batch-rename.sh
Created July 27, 2012 13:47
Rename all the papers from pattern [author][year] to [year]-[author][key] for the better view in explorer
#! /bin/bash
# rename files
#
# FIXME
# 1. filename with more than one year number
# a file name with more than one year number, like
# Chen2000-tech-Guanling-Chen-TR2000-381, the shell doesn't
# know how to deal with it, as the result of grep "-Po" returned
# with two number "2000\n" and "2000"
#
\documentclass[UTF8,10pt]{ctexart}
\usepackage[a4paper,%%textwidth=129mm,textheight=185mm, %%193-8
text={160mm,260mm},centering]{geometry}
\pagestyle{empty}
\begin{document}
\title{用散点图示范ggplot2的核心概念}
\author{肖凯}
\maketitle
\abstract{
本文稿是第五届R语言会议演讲内容的一部分,试图用散点图示例来说明ggplot2包的核心概念,以方便初学者快速上手。同时这也是笔者应用knitr包的一个练习。该示例所用数据是ggplot2包内带的mpg数据集。}