Skip to content

Instantly share code, notes, and snippets.

View imzjy's full-sized avatar

Jerry Chou imzjy

View GitHub Profile
@imzjy
imzjy / .gitignore
Created October 26, 2012 06:44
Git ignore file for .NET on Windows
# Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
bin
obj
# Personal VS settings
*.suo
*.user
# mstest test results
TestResults
@imzjy
imzjy / RSADigest.cs
Last active October 12, 2015 07:27
Degist with private key and verify it with public key(RSA based)
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;
using System.IO;
namespace ConsoleTester
@imzjy
imzjy / scale-image-to-max-keep-ratio.html
Created December 21, 2012 07:46
Maximize the image to the whole view port, and also keeping the aspect ratio. Browser compatibility: IE7+, Chrome, Firefox, Safari, Opera
<!DOCTYPE html />
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Image Stimuli</title>
<style type="text/css">
html, body
{
margin:0px;
padding: 0px;
height:100%;
@imzjy
imzjy / .bash_nav_dirs
Created March 13, 2013 06:50
The simulation of the d command in the Zsh. we got the initial script from http://aijazansari.com/2010/02/20/navigating-the-directory-stack-in-bash/
# An enhanced 'cd' - push directories
# onto a stack as you navigate to it.
#
# The current directory is at the top
# of the stack.
#
function stack_cd {
if [ $1 ]; then
# use the pushd bash command to push the directory
# to the top of the stack, and enter that directory
#!/usr/bin/bash
for SRC in `find $1 -depth`
do
DST=`dirname "${SRC}"`/`basename "${SRC}" | tr '[A-Z]' '[a-z]'`
if [ "${SRC}" != "${DST}" ]
then
mv $SRC $DST || echo $SRC
fi
done
@imzjy
imzjy / gbk-utf8.sh
Created May 3, 2013 23:26
create the GBK to UTF-8(with BOM)
#!/bin/sh
#convert from GBK to UTF-8(with BOM)
#http://stackoverflow.com/questions/4364156/iconv-converting-from-windows-ansi-to-utf-8-with-bom
for file in `find . -iname $1 `
do
echo -ne '\xEF\xBB\xBF' > "$file.new"
iconv -f GBK -t 'UTF-8' "$file" >> "$file.new" &&
mv -f "$file.new" "$file"
@imzjy
imzjy / .zshrc
Last active December 21, 2015 12:18
My zshrc and theme
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="jatsz"
# Example aliases
@imzjy
imzjy / rename-mp3.sh
Last active December 29, 2015 07:39
rename MP3 files, and remove first 4 characters.
#!/bin/sh
if [[ ! -d $1 ]]; then
echo "please specific a MP3 directory"
exit;
fi
SAVEIFS=$IFS
IFS=$( echo -en "\n\b" ) #fix mp3 files contain a space
for file in $( find $1 -name *.mp3 ); do
#/bin/sh
#set -x
TMP_TXT="$(mktemp)"
STAT_TXT="$(mktemp)"
cleanup()
# cleanup the tmp data when exit by CTRL+C
{
@imzjy
imzjy / molokai.vim
Created March 11, 2014 07:59
VIM colorscheme
" Vim color file
"
" Author: Tomas Restrepo <[email protected]>
"
" Note: Based on the monokai theme for textmate
" by Wimer Hazenberg and its darker variant
" by Hamish Stuart Macpherson
"
hi clear