Skip to content

Instantly share code, notes, and snippets.

View rankun203's full-sized avatar
🔨
building things

Kun R rankun203

🔨
building things
View GitHub Profile
@rankun203
rankun203 / idea_shortcut.md
Last active December 30, 2015 02:29
IntelliJ IDEA Shortcut

ctrl + F12 查看文件结构。

From: http://askubuntu.com/a/107735/85224

First install this:

sudo apt-get install imagemagick mplayer gtk-recordmydesktop

those are the required stuff, ImageMagick, MPlayer and Desktop Recorder. Then use Desktop Recorder to capture a portion of the screen/application to use as the screencast. After the Desktop Recorder has saved the recording into an OGV video, MPlayer will be used to capture JPEG screenshots, saving them into the 'output' directory.

On a terminal:

@rankun203
rankun203 / bash.sh
Last active December 31, 2015 14:09
一些常用的bash命令
#统计文件数目
ls -l |grep "^-" | wc -l
#批量改名
for files in `ls *`
do
mv $files `echo "xxx_$i.jpg"`
let "i++"
done
html {
z-index: 0;
filter: grayscale(100%);
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
-ms-filter: grayscale(100%);
-o-filter: grayscale(100%);
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter ….3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale");
filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);
-webkit-filter: grayscale(1);
@rankun203
rankun203 / FileDownloadThumbnailAction.java
Last active August 29, 2015 14:01
Get Cropped image using Scalr.
//get file from Mongo Grid file system.
GridFSDBFile file = fileService.getFile(fileId);
//将图片文件转换成一个BufferedImage对象
BufferedImage image = ImageIO.read(file.getInputStream());
//执行对应的操作
BufferedImage thumbnail = Scalr.resize(image, 150);
//获取文件的格式
#!/bin/bash
#checkHosts.sh
#author rankun203@gmail.com
function success {
echo "isok $1 $2"
echo "$1 $2" >> ./hosts.ok
}
@rankun203
rankun203 / GetGeo.java
Last active August 29, 2015 14:02
The distance between "Chengdu Vocational Technical College" and "Royal Garden"
/**
* Created on 14-6-15
*
* output:
* 2.787433034459691 Miles
* 4.485938629409498 Kilometers
* 2.4206068471247955 Nautical Miles
*
* Original post by dommer on StackOverflow: http://stackoverflow.com/a/3694410/1904043
*
import java.util.Arrays;
/**
* Created on 14-6-18
* output:
50058:49942
So, get0or1 works fine.
[12674, 12405, 12604, 12519, 12321, 12520, 12528, 12429]
* @author rankun203@gmail.com
*/
@rankun203
rankun203 / mwww.sh
Last active August 29, 2015 14:02
监视文件夹并执行操作
#!/bin/bash
#author rankun203@gmail.com
#ref http://unix.stackexchange.com/a/24955
cd /home/rankun203
inotifywait -r -m ./www -e create -e moved_to |
while read path action file; do
echo "The file '$file' appeared in directory '$path' via '$action'"
rsync -avzrhu --update --progress --chmod=u+rwx,g+rwx,o+rwx "$path$file" rankun203@s.rankun.org:/home/rankun203/html/files
done
@rankun203
rankun203 / charascii.c
Last active August 29, 2015 14:06
Print ASCII code of a Character (or an ASCII code table)
#include <stdio.h>
#include <conio.h>
/**
* author: rankun203@gmail.com
* Usage:
* -With Parameter
* CMD: charascii.exe A
* OutPut: A: 65
* -Without Parameter