Skip to content

Instantly share code, notes, and snippets.

View digikata's full-sized avatar

Alan Chen digikata

View GitHub Profile
@digikata
digikata / Go Run.sublime-build
Last active December 14, 2015 07:59
Pickup user env settings by running in a new bash login shell. A gist for Go and one for Ruby settings. This works to get Sublime Text to rbenv specified ruby and brew installed go. For OS X, copy the files into $HOME/Library/Application Support/Sublime Text 2/Packages/User/
{
"cmd": [ "bash", "-lc", "go run $file"],
"selector": "source.go",
"file_regex": "([^:]+):([0-9]+):"
}
@digikata
digikata / simpleserver.rb
Last active December 14, 2015 09:39
plain ruby webrick server for simple web dev on local machine
#!/usr/bin/env ruby
require 'webrick'
port = (ARGV.empty?) ? 8000 : ARGV.shift.to_i
rpath = (ARGV.empty?) ? './' : ARGV.shift
root = File.expand_path rpath
mime_types = WEBrick::HTTPUtils::DefaultMimeTypes
@digikata
digikata / gotour-ex70.go
Created March 2, 2013 18:19
my Go Tour exercise 70 Webcrawler solution
package main
import (
"fmt"
)
type Fetcher interface {
// Fetch returns the body of URL and
// a slice of URLs found on that page.
Fetch(url string) (body string, urls []string, err error)
[
{ "keys": ["f9"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} },
{ "keys": ["ctrl+f9"], "command": "alignment" },
// from Ctags
{ "keys": ["f12"], "command": "navigate_to_definition" },
{ "keys": ["shift+f12"], "command": "show_symbols" },
{ "keys": ["ctrl+f12"], "command": "jump_back" },
{ "keys": ["ctrl+shift+f12"], "command": "show_symbols", "args" : {"type": "multi" } },
@digikata
digikata / Rbenv Ruby.sublime-build
Created April 30, 2013 16:06
Sublime Build file to pickup Ruby specified in your login environment (which doesn't get picked up correctly sometimes by OS X running rbenv) For OS X, copy the files into $HOME/Library/Application Support/Sublime Text 2/Packages/User/
{
"cmd": ["bash", "-lc", "ruby -w $file"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.ruby"
}
@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
@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 / 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 / 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 / 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