Skip to content

Instantly share code, notes, and snippets.

View joyrexus's full-sized avatar

J. Voigt joyrexus

View GitHub Profile
@joyrexus
joyrexus / http.sh
Created October 16, 2012 14:42
Shell function for managing a simple HTTP server
# Manage a simple HTTP server
#
# Usage:
# http start|stop|restart [port]
#
# Notes:
# Add to .bashrc and resource (source ~/.bashrc)
http () {
local port="${2:-8000}"
@joyrexus
joyrexus / rst2html.sh
Created October 16, 2012 14:49
Shell function to convert a restructuredText file to HTML
# Convert restructuredText file to HTML
#
# Usage:
# rst2html file.rst
#
# Notes:
# Add to .bashrc
# Set stylesheet path and/or default stylesheet
# Source .bashrc
@joyrexus
joyrexus / svn.sh
Created October 16, 2012 15:10
Three shell functions for subversion repo management
# Three little shell functions of use when managing
# subversion repos.
#
# nosvn - remove a directory from revision control
# svnrev - print repo rev number
# startsvn - start the subversion daemon
# Remove directory from revision control
nosvn () {
DIR=${1:-"."}
@joyrexus
joyrexus / xls2tsv.py
Created October 16, 2012 15:18
Print the sheetnames or contents of a worksheet from an excel workbook (.xls file) to STDOUT
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
xls2tsv - print the sheetnames or contents of a worksheet from an excel workbook.
Usage: xls2tsv [options]
Options:
-h, --help show this help message and exit
@joyrexus
joyrexus / md2html.py
Created October 16, 2012 15:51
Convert a markdown file to html
#!/usr/bin/env python
'''
md2html - convert a markdown file to html
Dependencies: markdown module (pip install Markdown)
Usage:
md2html file.md > file.html
md2html file.md | browser
@joyrexus
joyrexus / index.html
Last active December 11, 2015 06:39
Render a markdown file or just run fenced code blocks within.
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="style.css">
<body>
<h1>READ.ME</h1>
<p>Why can&#39;t we just fence our code?</p>
<pre><code>print = console.log</code></pre>
<p>Another chunk of code:</p>
<pre><code>print &#39;hello world!&#39;</code></pre>
@joyrexus
joyrexus / coffee.vim
Last active December 14, 2015 15:39
Supplements for ~/.vim/ftplugin/coffee.vim.
" Supplements for ~/.vim/ftplugin/coffee.vim.
" Use Mick Koch's [plugin](http://github.com/kchmck/vim-coffee-script) as base.
setlocal tabstop=2
setlocal softtabstop=2
setlocal shiftwidth=2
ab bang! #!/usr/bin/env coffee
" ,r run/execute code in file (faster to type than ,x)
@joyrexus
joyrexus / python.vim
Created March 7, 2013 16:46
Basic conventions for ~/.vim/ftplugin/python.vim.
" Language: Python
setlocal tabstop=4
setlocal softtabstop=4
setlocal shiftwidth=4
ab bang! #!/usr/bin/env python
" run tests in current file
nmap <LocalLeader>t :!nosetests %<CR>
@joyrexus
joyrexus / d3-coffee-skeleton.html
Created March 7, 2013 16:49
Minimalist template for your coffee blocks.
<!DOCTYPE html>
<meta charset="utf-8">
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://github.com/jashkenas/coffee-script/raw/master/extras/coffee-script.js"></script>
<style>/* CSS */</style>
<body>
<div id="viz"></div>
<script type="text/coffeescript">
alert("hello world")
# CODE #
@joyrexus
joyrexus / ftdetect-md-litcoffee.vim
Last active December 14, 2015 16:08
Vim utils for litcoffee. (Provisional tweaks and supplements for https://github.com/mintplant/vim-literate-coffeescript)
" Add this to ~/.vim/ftdetect/md-litcoffee.vim
" Language: Literate CoffeeScript
autocmd BufNewFile,BufRead *.litcoffee set filetype=litcoffee
autocmd BufNewFile,BufRead *.coffee.md set filetype=litcoffee