Skip to content

Instantly share code, notes, and snippets.

@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 / data.tsv
Created May 31, 2014 14:42
ABS_TOOL_WIDTH vs ABS_MT_PRESSURE
8 103
8 103
8 103
8 103
12 120
12 120
12 120
12 120
8 109
8 109
@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
@silverhammermba
silverhammermba / mancala.rb
Created November 15, 2015 18:23
An SVG mancala board generator
def pathdef d
<<-XML
<path style="#$linestyle" d="#{d}" />
XML
end
def roundedpath rad, *points
meth = "M"
sides = points.each_slice(2).map.with_index do |p, i|
corner = "#{meth} #{p[0].join(' ')} A #{rad} #{rad} 0 0 1 #{p[1].join(' ')}"
############## Kodi CRASH LOG ###############
################ SYSTEM INFO ################
Date: Sun Dec 6 10:08:44 EST 2015
Kodi Options:
Arch: x86_64
Kernel: Linux 4.2.5-1-ARCH #1 SMP PREEMPT Tue Oct 27 08:13:28 CET 2015
Release: Arch Linux
############## END SYSTEM INFO ##############
@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 / themer.rb
Last active April 22, 2016 02:53
Generate awesome theme from background image
#!/usr/bin/env ruby
# pick a random background and generate an awesome theme based on it
require 'color'
require 'color/palette/monocontrast'
require 'erb'
require 'fileutils'
require 'imlib2'
require 'optparse'
require 'shellwords'
@silverhammermba
silverhammermba / example.rb
Last active May 20, 2016 01:42
method for testing a program with various settings
require_relative './test_run'
x = run(key_max: 25_000, threads: (1..4), iters: 1_000_000, n: 21, read: 10, branch: %w{locking2})
File.open('box.data', 'w') do |f|
x.each do |r|
r[:ticks].each { |y| f.puts "#{y} #{r[:threads]}" }
end
end
@silverhammermba
silverhammermba / log.txt
Created May 4, 2017 15:42
Wine Steam Log
err:winediag:xrandr12_init_modes Broken NVIDIA RandR detected, falling back to RandR 1.0. Please consider using the Nouveau driver instead.
err:winediag:xrandr12_init_modes Broken NVIDIA RandR detected, falling back to RandR 1.0. Please consider using the Nouveau driver instead.
err:winediag:xrandr12_init_modes Broken NVIDIA RandR detected, falling back to RandR 1.0. Please consider using the Nouveau driver instead.
err:winediag:xrandr12_init_modes Broken NVIDIA RandR detected, falling back to RandR 1.0. Please consider using the Nouveau driver instead.
fixme:ver:GetCurrentPackageId (0x32e470 (nil)): stub
fixme:process:ProcessIdToSessionId Unsupported for other processes.
fixme:winhttp:get_system_proxy_autoconfig_url no support on this platform
fixme:winhttp:WinHttpDetectAutoProxyConfigUrl discovery via DHCP not supported
fixme:ntdll:EtwEventRegister ({47a9201e-73b0-42ce-9821-7e134361bc6f}, 0x3f006740, 0x3f041d28, 0x3f041d20) stub.
fixme:ntdll:EtwEventRegister ({58a9201e-73b0-42ce-9821-7e134361bc70}, 0x3f0067
@silverhammermba
silverhammermba / gamma.html
Created December 7, 2017 20:53
hackin on gamma
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<article>
<h1>Yet another article about gamma correction</h1>
<style>
.gradstop {