Skip to content

Instantly share code, notes, and snippets.

View tobi's full-sized avatar

Tobias Lütke tobi

View GitHub Profile
# Rails production setup via SQLite3 made durable by https://litestream.io/
# Copy this to Dockerfile on a fresh rails app. Deploy to fly.io or any other container engine.
#
# try locally: docker build . -t rails && docker run -p3000:3000 -it rails
#
# in production you might want to map /data to somewhere on the host,
# but you don't have to!
#
FROM ruby:3.0.2
@tobi
tobi / kindle.rb
Last active September 25, 2022 02:37
Download your Kindle Highlights to local markdown files. Great for Obsidian.md.
#!/usr/bin/env ruby
# gem install active_support
require 'active_support/inflector'
require 'active_support/core_ext/string'
# gem install webrick (only ruby3)
require 'webrick'
# gem install mechanize
@tobi
tobi / dark.css
Created July 1, 2019 13:01
Darkmode for slack
body { background: #222; color: #e6e6e6; }
a { color: #949494; }
a:link, a:visited { color: #949494; }
a:hover, a:active, a:focus { color: #c7c7c7; }
hr { border-bottom: 1px solid #424242; border-top: 1px solid #222; }
@tobi
tobi / bm.rb
Created December 24, 2013 15:00
require 'benchmark'
def regular(a, b, c)
[a, b, c]
end
def keyword(a: 1, b: 2, c: 3)
[a, b, c]
end
@tobi
tobi / index.html
Created May 17, 2013 21:34
A CodePen by Tobias Lütke.
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/d3.geo.projection.v0.min.js"></script>
<script src="http://d3js.org/topojson.v0.min.js"></script>
@tobi
tobi / index.html
Created May 17, 2013 21:34
A CodePen by Tobias Lütke.
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/d3.geo.projection.v0.min.js"></script>
<script src="http://d3js.org/topojson.v0.min.js"></script>
@tobi
tobi / database.go
Created July 31, 2012 17:32
Error reading a datetime from
package main
import (
_ "code.google.com/p/go-mysql-driver/mysql"
"database/sql"
"log"
"time"
)
func main() {
trap("INT") { $done = true }
class Forever
def every(timespan, &block)
@threads ||= []
thread = Thread.new do
last_run = 0
while !$done
@tobi
tobi / mess.coffee
Created July 14, 2011 02:34
Quick access to useful timespans for reporting
selectors: ->
today = new Date()
today.setMinutes(0)
today.setHours(0)
today.setSeconds(0)
day = 1000*60*60*24
yesterday = today - day
lastSunday = today - today.getDay() * day
@tobi
tobi / jsonp.html
Created July 9, 2011 15:05
jsonp mini implementation
<!DOCTYPE HTML>
<html>
<head>
<title>MINI JSONp</title>
</head>
<body>
<script>