Skip to content

Instantly share code, notes, and snippets.

View shihanng's full-sized avatar

Shi Han shihanng

View GitHub Profile
@shihanng
shihanng / toggle_desktop_visibility.sh-session
Last active August 29, 2015 14:02
Hide/show icons on Desktop of OS X
defaults write com.apple.finder CreateDesktop -bool false && killall Finder # Hide
defaults write com.apple.finder CreateDesktop -bool true && killall Finder # Show
@shihanng
shihanng / tiff2jpg.sh-session
Created June 22, 2014 04:02
Convert a tiff-file (screen shot with OS X's Grab) to a smaller jpg-file
convert [target-tiff] -compress jpeg -scale 75% [source-jpg]
@shihanng
shihanng / sjis2utf8.sh-session
Created June 22, 2014 07:08
Convert encoding a file from SJIS to UTF8
iconv -f SHIFT_JIS-2004 -t UTF-8 [source-file] > [target-file]
@shihanng
shihanng / mov2gif.sh-session
Created June 25, 2014 02:21
Convert mov-file from a screencast into gif-file
ffmpeg -i [source-mov] -vf "scale=min(iw\,600):-1" -vcodec png -r 20 out%4d.png
sips -s format gif *.png --out .
gifsicle *.gif --colors 128 --optimize=3 --delay=3 --loopcount > [target-gif]
@shihanng
shihanng / Vagrantfile
Last active December 1, 2015 06:09
Developing with Vagrant and Docker @ HDE Blog (Vagrantfile)
Vagrant.configure("2") do |config|
config.vm.define "redis" do |r|
r.vm.provider "docker" do |d|
d.image = "redis:latest"
d.name = "redis"
d.ports = ["6379:6379"]
d.vagrant_vagrantfile = "./docker-host-vm/Vagrantfile"
end
end
@shihanng
shihanng / Vagrantfile
Created December 1, 2015 06:10
Developing with Vagrant and Docker @ HDE Blog (DockerHost/Vagrantfile)
Vagrant.configure("2") do |config|
config.vm.box = "hashicorp/precise64"
config.vm.provision "docker"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.synced_folder "../hello", "/src/hello", type: "nfs"
config.vm.provision "shell", inline:
"ps aux | grep 'sshd:' | awk '{print $2}' | xargs kill"
# web port
config.vm.network :forwarded_port, host: 8080, guest: 8000
package design
import (
. "github.com/goadesign/goa/design"
. "github.com/goadesign/goa/design/apidsl"
)
var _ = API("users", func() {
Title("Users Management")
Scheme("http")
package main
import (
"github.com/goadesign/goa"
"github.com/shihanng/simple-goa-demo/app"
)
type user struct {
name string
email string
@shihanng
shihanng / .chunkwmrc
Last active January 6, 2024 04:17
chunkwm + skhd
#!/bin/bash
#
# NOTE: specify the absolutepath to the directory to use when
# loading a plugin. '~' expansion is supported.
#
chunkc core::plugin_dir /usr/local/opt/chunkwm/share/chunkwm/plugins
#
@shihanng
shihanng / README.md
Last active May 3, 2018 01:15
Auto-mount CIFS on Solus (or any other Linux OS)

Append something like below into /etc/fstab

# /etc/fstab: static file system information.
#
# <fs>      <mountpoint> <type> <opts>      <dump/pass>
...
//192.168.0.10/path/to/source /path/to/target cifs user,uid=1000,_netdev,noauto,x-systemd.automount,credentials=/path/to/cred 0 0
  • The value for uid can be obtained via