Skip to content

Instantly share code, notes, and snippets.

View xcodebuild's full-sized avatar
💭
Busy

xcodebuild xcodebuild

💭
Busy
View GitHub Profile
@xcodebuild
xcodebuild / mk_index.py
Created April 4, 2016 04:21
Generate sidebar for github wiki
import os
def createIndexFile(startpath, indexFile):
for root, dirs, files in os.walk(startpath):
files = [f for f in files if not (f[0] == '.' or f[0] == '_')]
dirs[:] = [d for d in dirs if not (d[0] == '.' or d[0] == '_')]
level = root.replace(startpath, '').count(os.sep) - 1
indent = ' ' * 2 * (level)
directory = os.path.basename(root)
if directory != '.':
@xcodebuild
xcodebuild / org-archive-subtree-hierarchical.el
Last active January 13, 2019 16:24
Keeping the context when archiving in Emacs org-mode
;; org-archive-subtree-hierarchical.el
;; modified from https://lists.gnu.org/archive/html/emacs-orgmode/2014-08/msg00109.html
;; In orgmode
;; * A
;; ** AA
;; *** AAA
;; ** AB
;; *** ABA
;; Archiving AA will remove the subtree from the original file and create
_proxychains(){
local old="$READLINE_LINE"
local cmd="proxychains $old"
history -a $old
$cmd
READLINE_LINE=""
}
bind -x '"\C-[": _proxychains'
// Insall WenQuanYi Micro Hei
*
:not [class*="code"] > *
{
font-family: "FontAwesome", "octicons", "icon","Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "WenQuanYi Micro Hei" !important;
}
[class*="code"] > *
{
font-family: "WenQuanYi Micro Hei Mono" !important;
@xcodebuild
xcodebuild / ec.sh
Created December 10, 2015 13:38
A shell script to run emacsclient with Emacs GUI daemon
#!/bin/sh
# Run emacsclient in the gui with emacs --daemon
exec emacsclient -c -n -F '((fullscreen . maximized) (font . "Ubuntu Mono derivative Powerline-18"))' "$@"
@xcodebuild
xcodebuild / fswatch-rsync.sh
Created December 2, 2015 08:36
fswatch + rsync.
#!/usr/bin/env sh
#
# Description:
# Make your local folder to remote server synchronization.
# Requirements:
# brew install fswatch
SRC=/Users/liuxd/Documents/guess_cheat_new/
DES=liuxidong@172.16.0.37:/home/liuxidong/project/cheat/
EXCLUDE=/Users/liuxd/Downloads/rsync-exlcude.txt
@xcodebuild
xcodebuild / gist:59f151597cc9110f618a
Created November 24, 2015 02:07
Applescript to keep vpn connect
on idle
tell application "System Events"
tell current location of network preferences
-- check vpn connection status
set connected_vpn to get name of every service whose (kind is greater than 10 and kind is less than 17) and connected of current configuration is true
set connect_status to count of connected_vpn
if connect_status is 0 then
-- get vpn list
@xcodebuild
xcodebuild / makefile
Created August 18, 2015 09:01
Makefile watch for file
watch:
while true; do \
<what you want to do> \
inotifywait -qre close_write .; \
done
;; This piece is taken from:
;; http://sachachua.com/blog/2007/12/clocking-time-with-emacs-org/
(eval-after-load'org
'(progn
(defun wicked/org-clock-in-if-starting ()
"Clock in when the task is marked STARTED."
(when (and (string= org-state "STARTED")
(not (string= org-last-state org-state)))
(org-clock-in)))
@xcodebuild
xcodebuild / org-capture-templates-schedule.el
Created August 12, 2015 02:04
org-capture-templates to schedule a TODO for repeat
SCHEDULED:%(org-insert-time-stamp (org-read-date nil t) nil nil nil nil \" .+1d\")