Skip to content

Instantly share code, notes, and snippets.

@gfreezy
gfreezy / gocd.plugin.zsh
Created September 13, 2014 14:12
zsh plugin for go
function gorun() {
$GOPATH/bin/$1
}
function gosrc() {
cd $GOPATH/src/${1:-/github.com/gfreezy}
}
function gopkg() {
cd $GOPATH/pkg/${1:-darwin_amd64/github.com/gfreezy}
@gfreezy
gfreezy / mfschunkserver
Last active August 29, 2015 14:01
moosefs init.d
#!/bin/sh -e
# ============================================
# mfschunkserver - Starts the Moosefs chunkserver daemon.
# ============================================
#
# :Usage: /etc/init.d/mfschunkserver {start|stop|reload|restart|test|status}
#
### BEGIN INIT INFO
@gfreezy
gfreezy / .slate.js
Last active November 18, 2021 16:13
slate configuration
var pushRight = slate.operation("push", {
"direction": "right",
"style": "bar-resize:screenSizeX/2"
});
var pushLeft = slate.operation("push", {
"direction": "left",
"style": "bar-resize:screenSizeX/2"
});
@gfreezy
gfreezy / if_not_running
Created June 17, 2013 08:41
run only one process a time. if_not_runnig && cmd
#!/usr/bin/env bash
# exit when no parameter provided
test -z "$*" && exit 0
id=`echo "$*" | md5sum | cut -d " " -f 1`
idfile="/tmp/$id"
if [ ! -e $idfile ]; then
touch $idfile
$@
rm $idfile
exit -1
@gfreezy
gfreezy / index.html
Created October 18, 2012 15:48
This is just an experiment! There are certainly better ways to show an image of a MacBook, but none as fun as this :)
<i class="macbook"></i>
@gfreezy
gfreezy / index.html
Created October 17, 2012 14:30
This is just an experiment! There are certainly better ways to show an image of a MacBook, but none as fun as this :)
<i class="macbook"></i>
@gfreezy
gfreezy / index.html
Created October 17, 2012 14:27
This is just an experiment! There are certainly better ways to show an image of a MacBook, but none as fun as this :)
<i class="macbook"></i>
@gfreezy
gfreezy / PKGBUILD
Created December 5, 2011 11:36
emacs package
# Contributor: zhuqin <zhuqin83@gmail.com>
# Contributor: Mic92 <jthalheim@gmail.com>
pkgname=emacs-gtk3-git
pkgver=20111204
pkgrel=1
pkgdesc="Gnu Emacs with gtk3 enabled from Git and use LC_CTYPE=zh_CN.utf8 for prefix when executing Emacs"
url="http://www.gnu.org/software/emacs/emacs.html"
license=('GPL')
@gfreezy
gfreezy / anything-git-find-file.el
Created November 24, 2011 13:52
use anything to find file in a git repository
(require 'anything)
(defun list-project-files (repo)
"Return an alist of all filenames in the project and their path."
(split-string (shell-command-to-string (format "cd %s && git ls-files" repo))))
(defun find-git-repo (dir)
"Find base git directory"
(if (string= "/" dir)
(message "Not In A Git Repository")
(if (file-exists-p (expand-file-name ".git/" dir))
@gfreezy
gfreezy / Default.sublime-commands
Created October 29, 2011 14:56
Sync plugin for Sumblime Text2 using a script 'sync' written by myself
[
{
"caption": "Sync: Pull",
"command": "sync_pull"
}
,{
"caption": "Sync: Push",
"command": "sync_push"
}
]