Skip to content

Instantly share code, notes, and snippets.

kyon kyon0304

Block or report user

Report or block kyon0304

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
kyon0304 / readparam.c
Created Aug 4, 2014
read config file use c
View readparam.c
#include "readparam.h"
char* delblank( char* str )
char* out = str;
int i, j;
for( i = 0, j = 0; i < strlen( str ); i++,j++ )
if( str[i] == ' ' || str[i] == '\n')
kyon0304 /
Created Jul 7, 2014
s1=`du -b $1|cut -f1`
s2=`du -b $2|cut -f1`
min=$(($s1 < $s2 ? $s1 : $s2 ))
if [ $min -eq $s1 ]; then
dd if=$2 of=temp bs=$min count=1 >& /dev/null
echo $1 is smaller and its md5sum is:
echo $(md5sum $1)
echo cut $2 to $1\'s size and its md5sum is:
kyon0304 /
Last active May 6, 2018
auto generate YAML front-matter for jekyll post, scrape a background image from bing and normalize it for post's header
cover=`date --iso-8601=seconds | cut -d'+' -f1`.jpg
function getCover {
### get jpeg file from bing home page
echo "Find header image..."
wget -q $url -O index.html
# jpgUrl=`cat index.html | grep background-image | awk -F\' '{print $2}'`
jpgUrl=`cat index.html | tr ";" "\n" | grep -o "url:'http://.*[.]jpg"| cut -d\' -f2`
kyon0304 /
Created Jan 27, 2014
Recursively go through directory and make *.png *.jpg file gradient transparent(half to bottom). ImageMagick needed.
#caution!! for file name with spaces may fail
for f in *.png *.jpg
size=`convert $f -ping -format "%wx%h" info:`
echo $size >> tmp
mkdir -p "$size" && cp $f "$size"
cat tmp | sort -u > index.log
echo "category done"
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import urllib
import urllib2
def safe_add(x, y):
return lshift(msw, 16)|(lsw&0xFFFF)
You can’t perform that action at this time.