Skip to content

Instantly share code, notes, and snippets.

@herry13
herry13 / scala-syntax-color.sh
Created June 9, 2013 02:29
Installing scala syntax color module to VIM.
mkdir -p ~/.vim/{ftdetect,indent,syntax} && for d in ftdetect indent syntax ; do wget --no-check-certificate -O ~/.vim/$d/scala.vim https://raw.github.com/scala/scala-dist/master/tool-support/src/vim/$d/scala.vim; done
@herry13
herry13 / speedup-mail.sh
Created July 2, 2013 12:05
Solving slow performance of Mail application in Mac 10.7 or 10.8
sqlite3 ~/Library/Mail/V2/MailData/Envelope\ Index vacuum;
@herry13
herry13 / do_curl.sh
Last active December 19, 2015 08:49
cURL example commands
# send data which is kept in a file through HTTP Post method
curl -i -X POST -F "json=@data.json" localhost:8080/save
# send data through HTTP Post method
curl -i -X POST -d json='{"key":"value"}' localhost:8080/save
# send binary file through HTTP Post method
curl -i -X POST -F data=@filepath localhost:8080/save
We couldn’t find that file to show.
@herry13
herry13 / app.rb
Created July 14, 2013 16:34 — forked from carlhoerberg/app.rb
HTTPS with Webrick
require 'sinatra/base'
require 'openssl'
require 'webrick'
require 'webrick/https'
class App1 < Sinatra::Base
get '/' do
'app1'
end
end
@herry13
herry13 / nanohttp.rb
Created September 19, 2013 11:51
Simple Ruby HTTP Server
#!/usr/bin/env ruby
require 'webrick'
server = WEBrick::HTTPServer.new :Port => 80
dir = (ARGV.length > 0 ? ARGV[0] : './')
server.mount "/", WEBrick::HTTPServlet::FileHandler, dir
trap('INT') { server.stop }
server.start
require 'rubygems'
require 'rubygems/package'
require 'zlib'
require 'fileutils'
module Util
module Tar
# Creates a tar file in memory recursively
# from the given path.
#
@herry13
herry13 / create-vm.sh
Created November 13, 2013 14:19
Script to create VM on Qemu using libvirt
#!/bin/sh
STORAGE="/var/lib/libvirt/images"
NAME="ubuntu1204-64"
#MAC="54:52:00:6C:46:01"
#IMAGE=$STORAGE/$NAME.img
IMAGE=/root/ubuntu1204-64.qcow2
LOCATION="http://archive.ubuntu.com/ubuntu/dists/precise/main/installer-amd64/"
#LOCATION="http://archive.ubuntu.com/ubuntu/dists/precise/main/installer-i386/"
#NET_BRIDGE=br0
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
#!/usr/bin/env ruby
require 'rubygems'
require 'roo'
pwd = File.dirname(__FILE__)
Dir.glob("#{pwd}/*.xls") do |file|
file_path = "#{pwd}/#{file}"
file_basename = File.basename(file, ".xls")
xls = Excel.new(file_path)