Skip to content

Instantly share code, notes, and snippets.

View xcodebuild's full-sized avatar
💭
Busy

xcodebuild xcodebuild

💭
Busy
View GitHub Profile
@xcodebuild
xcodebuild / makefile
Created October 5, 2014 04:53
Makefile watch
watch:
while true; do \
make all; \
inotifywait -qre close_write .; \
done
# Then you can use make watch run `make all` once file in . changed
@xcodebuild
xcodebuild / python.sty
Created October 9, 2014 14:02
Use python in latex
\usepackage{verbatim}
\makeatletter
\newwrite\Code@out
\newcommand\python{\obeylines\expandafter\pythonArg\noexpand}
\newcommand\pythonArg[1][tmp.py.in]{%
\gdef\FNameIn{#1}
\gdef\FNameOut{tmp.py.out}
#!/bin/bash
# Author: tim.tang
rm -f changelog.md
git for-each-ref --sort='*authordate' --format='%(tag)' refs/tags | grep -v '^$' | tail -r | while read TAG ; do
echo
if [ $NEXT ];then
echo ' ' >> changelog.md
echo *$NEXT* >> changelog.md
echo '---' >> changelog.md
@xcodebuild
xcodebuild / config
Last active March 8, 2017 14:25
i3wm config
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout somewhen, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
@xcodebuild
xcodebuild / install-for-build-emacs.sh
Last active August 29, 2015 14:17
Install library to build emacs from source in ubuntu
sudo apt-get install build-essential libx11-dev libxpm-dev libjpeg-dev libpng-dev libgif-dev libtiff-dev libgtk2.0-dev libncurses-dev libgtk-3-dev libxaw3dxft6 librsvg2-dev imagemagick libgpm-dev libdbus-1-dev libgconf-2-4 libxml2-dev libgnutls28-dev libm17n-dev libotf-dev -y
./configure --without-makeinfo --with-x-toolkit=lucid
@xcodebuild
xcodebuild / apue.h
Created April 18, 2015 09:32
apue.h with implement from lib/error.c
/* Our own header, to be included before all standard system headers */
#ifndef _APUE_H
#define _APUE_H
#if defined(SOLARIS)
#define _XOPEN_SOURCE 500 /* Single UNIX Specification, Version 2 for Solaris 9 */
#define CMSG_LEN(x) _CMSG_DATA_ALIGN(sizeof(struct cmsghdr)+(x))
#elif !defined(BSD)
#define _XOPEN_SOURCE 600 /* Single UNIX Specification, Version 3 */
@xcodebuild
xcodebuild / current_dir.sh
Created July 25, 2015 04:33
Tell bash script what directory it's stored in.
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
import sys
class ExceptionHook:
instance = None
def __call__(self, *args, **kwargs):
if self.instance is None:
from IPython.core import ultratb
self.instance = ultratb.FormattedTB(mode='Plain',
color_scheme='Linux', call_pdb=1)
@xcodebuild
xcodebuild / __main__.py
Created July 28, 2015 07:21
flask_watch_file.py
extra_dirs = ['./']
extra_files = extra_dirs[:]
for extra_dir in extra_dirs:
for dirname, dirs, files in os.walk(extra_dir):
for filename in files:
filename = os.path.join(dirname, filename)
if os.path.isfile(filename) and os.path.splitext(filename)[1] in ['.py', '.html', '.js']:
extra_files.append(filename)
if __name__ == '__main__':
@xcodebuild
xcodebuild / my-org-screenshot.el
Created August 8, 2015 12:39
Take a screenshot and insert in emacs(Mac only)
(defun my-org-screenshot ()
"Take a screenshot into a time stamped unique-named file in the
same directory as the org-buffer and insert a link to this file."
(interactive)
(setq filename
(concat
(make-temp-name
(concat
"art/"
(buffer-name)