Skip to content

Instantly share code, notes, and snippets.

@gfreezy
gfreezy / capture_webpage_as_picture.py
Created September 12, 2011 08:01
capture an webpage as a picture with pyqt4
import sys
from PyQt4.QtCore import (pyqtSlot, pyqtSignal, QObject, QSize, QUrl,
SIGNAL)
from PyQt4.QtGui import (QApplication, QImage, QPainter)
from PyQt4.QtWebKit import QWebPage
class Thumbnailer(QObject):
finished = pyqtSignal()
def __init__(self, parent=None):
@gfreezy
gfreezy / sync
Created October 29, 2011 14:53
Sync files between remote and local with rsync
#!/usr/bin/env python
import os
import sys
import subprocess
APP = 'demo_app'
REMOTE_USER = 'gfreezy'
REMOTE_HOST = 'norida.me'
REMOTE_DIR = '/home/gfreezy/rails/'
@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"
}
]
@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 / 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 / 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 / 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 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 / 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 / .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"
});