Skip to content

Instantly share code, notes, and snippets.

View zph's full-sized avatar

Zander Hill zph

View GitHub Profile
@zph
zph / photo_to_scan.rb
Created April 26, 2012 00:49
Script to transform images to scanned documents (In Progress)
#!/usr/bin/env ruby
#
# Author : tevic@civet.ws
# License: MIT
# Function: Wrapper for unpaper & imagemagick to allow easy conversions
# Date 2012.04.06
# Credits:
# Requirements:
# Linux
# unpaper
@zph
zph / labeller.rb
Created April 26, 2012 01:16
Embed a label in each image based on filename
#!/usr/bin/env ruby
#
# Author: tevic@civet.ws
# Description: Apply a label at the bottom of each photo in folder
# according to filename.
# Dependencies:
# *nix
# Ruby
# ImageMagick
#####################################
let g:vimrepress_tags_completable = 'true'
let VIMPRESS=[{'username':'blog_user_name', 'password':'SUPERSECRET', 'blog_url':'http://www.base_blog_name.com/'}]
require 'spreadsheet'
require 'pry'
require 'open-uri'
require 'yaml'
# Download spreadsheet
website = "http://www.eia.gov/dnav/ng/hist/n9190us3m.htm"
web_base = "http://www.eia.gov/dnav/ng/hist_xls/"
file_name = open('http://www.eia.gov/dnav/ng/hist/n9190us3m.htm').read.scan(/([\w]+\.xls)/)[0][0]
@zph
zph / vim.rb
Created May 20, 2012 00:44 — forked from mgrouchy/vim.rb
Vim formula for Homebrew
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
url 'https://vim.googlecode.com/hg/', :revision => '6c318419e331'
version '7.3.515'
def features; %w(tiny small normal big huge) end
def interp; %w(lua mzscheme perl python python3 tcl ruby) end
@zph
zph / fft.rb
Created May 22, 2012 00:46 — forked from mro/fft.rb
Discrete Fast Fourier Transform from 'Meyberg, Vachenauer: Hoehere Mathematik II, Springer Berlin, 1991, page 332'
#!/usr/bin/env ruby
require 'complex'
class Array
# DFT and inverse.
#
# Algorithm from
# 'Meyberg, Vachenauer: Hoehere Mathematik II, Springer Berlin, 1991, page 332'
#
# See http://blog.mro.name/2011/04/simple-ruby-fast-fourier-transform/
todo_count(){
if $(which todo.sh &> /dev/null)
then
num=$(echo $(todo.sh ls | grep "^[0-9]" | wc -l))
let todos=num
if [ $todos != 0 ]
then
echo "$todos"
else
echo ""
todo_count(){
if $(which todo &> /dev/null)
then
num=$(echo $(todo ls $1 | wc -l))
let todos=num-2
if [ $todos != 0 ]
then
echo "$todos"
else
echo ""
--- todo_count_tevic.sh 2012-05-28 00:48:34.000000000 -0400
+++ todo_count_wynn.sh 2012-05-28 00:47:41.000000000 -0400
@@ -1,8 +1,8 @@
todo_count(){
- if $(which todo.sh &> /dev/null)
+ if $(which todo &> /dev/null)
then
- num=$(echo $(todo.sh ls | grep "^[0-9]" | wc -l))
- let todos=num
+ num=$(echo $(todo ls $1 | wc -l))
tevic@host tmp % ± <<<[19]