This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os, sys, gtk, pynotify | |
import optparse | |
def print_version(*args): | |
print os.path.basename(sys.argv[0]) + " 1.0" | |
exit() | |
def parse_hint(option, opt_str, value, parser): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# Author: Ian Yang <doit dot ian (at) gmail dot com> | |
# URL: http://gist.github.com/gists/173151 | |
# | |
# This script depends on script `notify-send.py', which can be | |
# downloaded from http://gist.github.com/172910. Script | |
# `notify-send.py' requires python library `pynotify'. | |
# | |
# This script sends mpc status to `notify-osd'. I have not tested in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(dbus-call-method | |
:session "org.freedesktop.Notifications" | |
"/org/freedesktop/Notifications" | |
"org.freedesktop.Notifications" "Notify" | |
"GNU Emacs" ;; Application name. | |
0 ;; No replacement of other notifications. | |
"" ;; No icon. | |
"Notification summary" ;; Summary. | |
(format ;; Body. | |
"This is a test notification, raised from %s" (emacs-version)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Author: Ian Yang | |
_is_emacs_daemon_started () { | |
netstat -nlpx 2> /dev/null | awk '{print $NF}' | grep -qF "/tmp/emacs$UID/server" | |
} | |
_is_emacs_window_exist () { | |
wmctrl -lx 2> /dev/null | awk '{print $3}' | grep -qF 'emacs.Emacs' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# paths | |
PREFIX = /usr/local | |
INCS = | |
LIBS = | |
CXX_FLAGS = -O2 -g -Wall ${INCS} | |
LD_FLAGS = ${LIBS} | |
# compiler and linker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
groot() { | |
local dir=`pwd` | |
dir=${dir%/} | |
until [ -z "$dir" -o -d "$dir/.git" ]; do | |
dir=${dir%/*} | |
done | |
cd "$dir/" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ -n "$SSH_AUTH_SOCK" ] && netstat -nlpx 2> /dev/null | awk '{print $NF}' | grep -qF "$SSH_AUTH_SOCK"; then | |
echo "export SSH_AUTH_SOCK=$SSH_AUTH_SOCK" > /tmp/ssh-agent$UID | |
if [ -n "$SSH_AGENT_PID" ]; then | |
echo "export SSH_AGENT_PID=$SSH_AGENT_PID" >> /tmp/ssh-agent$UID | |
elif [ -n "$GNOME_KEYRING_PID" ]; then | |
echo "export GNOME_KEYRING_SOCKET=$GNOME_KEYRING_SOCKET" >> /tmp/ssh-agent$UID | |
echo "export GNOME_KEYRING_PID=$GNOME_KEYRING_PID" >> /tmp/ssh-agent$UID | |
fi | |
else | |
SSH_AUTH_SOCK= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Example of a user's .screenrc file | |
# | |
# This is how one can set a reattach password: | |
# password ODSJQf.4IJN7E # "1234" | |
# no annoying audible bell, please | |
vbell off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# | |
# Author: Ian Yang <doit dot ian at gmail dot com> | |
# Updated: <2009-10-24 22:11:10> | |
# | |
# This script will separate header file into block and sort them in | |
# each block | |
# | |
# Usage: | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This snippet is indended to be paseted in `.xinitrc'. Then D-Bus Daemon | |
# can be started on startup and all sub-processes the windows manager can | |
# communicate with the daemon. | |
# | |
# `.bashrc' also can source the file `/tmp/dbus-session$UID' to restore the | |
# environment variables | |
dbus_address=$(echo "$DBUS_SESSION_BUS_ADDRESS" |\ | |
awk 's/^.*unix:abstract=\([^,]*\),.*$/\1/') | |
if [ -S "$dbus_address" ] && netstat -nlpx 2> /dev/null |\ |