Skip to content

Instantly share code, notes, and snippets.

View shostakovich's full-sized avatar
🚩
Focusing

Robert Curth shostakovich

🚩
Focusing
View GitHub Profile
@shostakovich
shostakovich / blocked-timesinks.txt
Created March 1, 2022 06:35
List of blocked timesinks.
nytimes.com
zeit.de
sz.de
heise.de
spiegel.de
twitter.de
morgenpost.de
finanzen.net
newyorker.com
br.de
@shostakovich
shostakovich / garmin_to_google_maps.rb
Last active January 3, 2016 01:19
Dirty Little Tools to convert data from my Garmin into a Google Maps Compatible CSV
def minimum_distance(a, b)
((a[0] - b[0]).abs > 0.1) || ((a[1] - b[1]).abs > 0.1)
end
last_coordinate = [0,0]
txt = File.read("/Users/shostakovich/data.txt")
puts "lat,lon,Name"
@shostakovich
shostakovich / ca.pem
Created June 17, 2013 17:01
An assembled ca.pem for StartSSL
-----BEGIN CERTIFICATE-----
MIIGNDCCBBygAwIBAgIBGDANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJJTDEW
MBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwg
Q2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNh
dGlvbiBBdXRob3JpdHkwHhcNMDcxMDI0MjA1NDE3WhcNMTcxMDI0MjA1NDE3WjCB
jDELMAkGA1UEBhMCSUwxFjAUBgNVBAoTDVN0YXJ0Q29tIEx0ZC4xKzApBgNVBAsT
IlNlY3VyZSBEaWdpdGFsIENlcnRpZmljYXRlIFNpZ25pbmcxODA2BgNVBAMTL1N0
YXJ0Q29tIENsYXNzIDEgUHJpbWFyeSBJbnRlcm1lZGlhdGUgU2VydmVyIENBMIIB
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtonGrO8JUngHrJJj0PREGBiE
gFYfka7hh/oyULTTRwbw5gdfcA4Q9x3AzhA2NIVaD5Ksg8asWFI/ujjo/OenJOJA
@shostakovich
shostakovich / .gitconfig
Last active December 14, 2015 15:49
Pre-push hook that rejects force pushes to master. Requires Git 1.8.2 and above.
[push]
default = current
[alias]
pfush = "push --force"
@shostakovich
shostakovich / .hash_style_accessors.rb
Created November 30, 2012 12:13
Reading of OpenStruct
def [](name)
@table[name.to_sym]
end
def []=(name, value)
modifiable[new_ostruct_member(name)] = value
end
@shostakovich
shostakovich / pressure_sensor.rb
Created November 26, 2012 13:23
Pressure Sensor
class Sensor
OFFSET_IN_MBAR = 1000
def current_pressure
OFFSET_IN_MBAR + random_pressure();
end
private
def random_pressure
class PseudoPrimeGenerator
include Enumerable
def initialize(ubound = nil)
@ubound = ubound
end
def upper_bound=(ubound)
@ubound = ubound
end
class EratosthenesGenerator < PseudoPrimeGenerator
def initialize
@last_prime = nil
super
end
def succ
@last_prime = @last_prime ? EratosthenesSieve.instance.next_to(@last_prime) : 2
end
@shostakovich
shostakovich / aritmethics.rb
Created October 7, 2012 11:36
Set.rb illuminated
# given enumerable object.
def |(enum)
dup.merge(enum)
end
alias + | ##
alias union | ##
# Returns a new set built by duplicating the set, removing every
# element that appears in the given enumerable object.
def -(enum)
@shostakovich
shostakovich / bootstrap.sh
Created October 1, 2012 17:16
Chef Solo on Mac OS X - examples
#!/bin/sh
USERNAME=shostakovich
mkdir ~/tmp
cd ~/tmp
# Install GCC + Git
curl https://github.com/downloads/kennethreitz/osx-gcc-installer/GCC-10.7-v2.pkg > GCC-10.7-v2.pkg
sudo installer -pkg GCC-10.7-v2.pkg -target /