Skip to content

Instantly share code, notes, and snippets.

View digikata's full-sized avatar

Alan Chen digikata

View GitHub Profile
@digikata
digikata / go-co-template.make
Last active February 3, 2016 22:31
Makefile for a go/cgo package with standalone project directory structure
#
# Reference makefile for a go project setup to be
# a standalone directory that builds a couple of utilities
# from a external library referenced by cgo
#
.PHONY: tgt1bin tgt2bin clean links
# dir structure
# rootproj/
# tgt1/tgt1main.go (tgt binary referencing pkgname)
@digikata
digikata / go-test-inotify.sh
Last active August 29, 2015 14:17
Wait for go files to be modified and then execute them
#!/bin/bash
# Author: Khaja Minhajuddin (A.Chen modified...)
# Wait for go files to be modified and then execute them
# Dependency: inotify-tools
# Install on ubuntu using: apt-get install inotify-tools
wdir=$1
if [ -z $wdir ]; then
wdir=`pwd`
@digikata
digikata / play-message-proc.go
Created March 25, 2015 20:50
Play around with message processing using go channels (with timeouts)
/*
main.go
*/
package main
import (
"fmt"
"sync"
"time"
@digikata
digikata / Go.sublime-build
Last active August 29, 2015 14:09 — forked from Machx/Go.sublime-build
Golang build system file for Sublime Text 3
{
"cmd": ["go build"],
"selector": "source.go",
"path": "/usr/local/go/bin",
"working_dir": "${file_path}",
"shell": true,
"file_regex": "^([^:\n]+):([0-9]+)",
"variants": [
@digikata
digikata / perrno
Created October 14, 2014 16:14
Print errno codes in columns
#!/bin/sh
# Print errno codes in columns
# second ans. underneath was useful here...
# http://stackoverflow.com/questions/503878/how-to-know-what-the-errno-means
# pr makes the text list into columns
scrwid=`tput cols`
@digikata
digikata / Makefile.template.clu
Created April 16, 2014 21:10
callable by my 'clu' alias clu='make -f Makefile.clu'
#
# callable by my 'clu' alias clu='make -f Makefile.clu'
#
default : list_targets
list_targets :
@echo Targets
@echo
@digikata
digikata / Tab Context.sublime-menu
Created January 30, 2014 17:53
Sublime Text 3, convenient tab context menu selections. Place in user preferences directory to install.
[
{ "caption": "New View into File", "command": "clone_file" },
{ "command": "reveal_in_side_bar", "caption": "Find in sidebar" }
]
@digikata
digikata / gvp
Created September 5, 2013 18:27
short script to use graphviz to generate a png and display it in one command
#!/usr/bin/env ruby
arg_file = ARGV[0]
fbase = File.basename( File.split(arg_file)[1], ".gv")
outfile = fbase + ".png"
cmd = "dot -Tpng #{arg_file} > #{outfile}"
# puts cmd
@digikata
digikata / rapt.sh
Last active December 17, 2015 17:39
Simple script for my most used apt/dpkg commands
#!/bin/bash
# quick script frontend for apt & dpkg
cmd=$1
shift
case $cmd in
search|sea)
apt-cache search $*
;;
@digikata
digikata / gist:5555894
Last active December 17, 2015 05:09
convenience bash functions for finding filenames and searching on linux
ff() {
case $# in
1)
find . -name "*$1*"
;;
2)
find $1 -name "*$2*"
;;
*)
echo ff - find file name