Skip to content

Instantly share code, notes, and snippets.

@silverhammermba
silverhammermba / PKGBUILD
Created May 30, 2014 22:40
Synaptics Palm Detection patch
# $Id: PKGBUILD 213056 2014-05-18 13:44:18Z andyrtr $
# Maintainer: Jan de Groot <jgc@archlinux.org>
# Contributor: Tobias Powalowski <tpowa@archlinux.org>
# Contributor: Thomas Bächler <thomas@archlinux.org>
# Contributor: Alexander Baldeck <alexander@archlinux.org>
pkgname=xf86-input-synaptics
pkgver=1.8.0
pkgrel=2
pkgdesc="Synaptics driver for notebook touchpads"
@silverhammermba
silverhammermba / gist:9202455
Created February 25, 2014 04:02
Mobius Ring Generator
#!/usr/bin/env ruby
# generate OBJ of Mobius wedding band
require 'matrix'
if ARGV.size != 6
STDERR.puts "usage: #$0 SIDES RADIUS SAMPLES STRETCH TURNS CURVE"
exit 1
end
@silverhammermba
silverhammermba / terrible.rb
Last active May 23, 2022 17:45
Generates word searches with only a single word to find, but every letter in the grid is in the word.
#!/usr/bin/env ruby
# terrible word search generator
# inspired by http://cnlohr.blogspot.com/2014/02/to-make-terrible-wordsearches.html
if ARGV.length != 3
STDERR.puts "usage: #$0 WIDTH HEIGHT WORD"
exit 1
end
$word = ARGV[2].upcase
@silverhammermba
silverhammermba / roll.rb
Created April 25, 2013 23:04
Dice Rolling Script
#!/usr/bin/env ruby
# dice rolling from the command line
# e.g. 2x3d6+4, d6
def parse str
raise ArgumentError.new("Bad roll string: #{str}") unless str =~ /^((\d+)x)?(\d+)?d(\d+)([+-]\d+)?$/
times = 1
times = $2.to_i if $2
number = 1
number = $3.to_i if $3
@silverhammermba
silverhammermba / person.rb
Created August 31, 2012 03:09
Ruby OOP example
class Person
def initialize name, dob
@name = name
@dob = dob
end
def age
(Time.now - @dob) / (365 * 24 * 60 * 60)
end