Skip to content

Instantly share code, notes, and snippets.

Avatar

J. Voigt joyrexus

View GitHub Profile
@joyrexus
joyrexus / http.sh
Created Oct 16, 2012
Shell function for managing a simple HTTP server
View http.sh
# 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 Oct 16, 2012
Shell function to convert a restructuredText file to HTML
View rst2html.sh
# 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 Oct 16, 2012
Three shell functions for subversion repo management
View svn.sh
# 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 Oct 16, 2012
Print the sheetnames or contents of a worksheet from an excel workbook (.xls file) to STDOUT
View xls2tsv.py
#!/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 Oct 16, 2012
Convert a markdown file to html
View md2html.py
#!/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 Dec 11, 2015
Render a markdown file or just run fenced code blocks within.
View index.html
<!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 Dec 14, 2015
Supplements for ~/.vim/ftplugin/coffee.vim.
View 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 Mar 7, 2013
Basic conventions for ~/.vim/ftplugin/python.vim.
View 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 Mar 7, 2013
Minimalist template for your coffee blocks.
View d3-coffee-skeleton.html
<!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 Dec 14, 2015
Vim utils for litcoffee. (Provisional tweaks and supplements for https://github.com/mintplant/vim-literate-coffeescript)
View ftdetect-md-litcoffee.vim
" 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
You can’t perform that action at this time.