This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person | |
def initialize name, dob | |
@name = name | |
@dob = dob | |
end | |
def age | |
(Time.now - @dob) / (365 * 24 * 60 * 60) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# $Id: PKGBUILD 213056 2014-05-18 13:44:18Z andyrtr $ | |
# Maintainer: Jan de Groot <[email protected]> | |
# Contributor: Tobias Powalowski <[email protected]> | |
# Contributor: Thomas Bächler <[email protected]> | |
# Contributor: Alexander Baldeck <[email protected]> | |
pkgname=xf86-input-synaptics | |
pkgver=1.8.0 | |
pkgrel=2 | |
pkgdesc="Synaptics driver for notebook touchpads" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 | 103 | |
---|---|---|
8 | 103 | |
8 | 103 | |
8 | 103 | |
12 | 120 | |
12 | 120 | |
12 | 120 | |
12 | 120 | |
8 | 109 | |
8 | 109 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(' ')}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############## 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 ############## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
OlderNewer