Skip to content

Instantly share code, notes, and snippets.

View mat's full-sized avatar

Matthias Lüdtke mat

View GitHub Profile
@mat
mat / trakkor.js
Created September 9, 2008 21:27
Ubiquity command for http://trakkor.better-idea.org
CmdUtils.CreateCommand({
name: "trakkor",
description: "Notifies you when a web page changes via Trakkor.",
help: "Select text on the current page to be tracked.",
homepage: "http://trakkor.better-idea.org",
author: {name: "Matthias Luedtke", email: "github@matthias-luedtke.de"},
takes: {"text to track": noun_arb_text},
icon: "http://trakkor.better-idea.org/images/favicon.ico",
execute: function(textToTrack) {
@mat
mat / .gitconfig
Created February 10, 2010 13:51
.gitconfig & .gitignore - moved to mat/dotfiles
[alias]
# bread and butter
st = status
s = status -sb
d = diff
dc = diff --cached
p = pull --rebase
ir = rebase -i origin/master
amend = commit --amend
l = log --pretty=format:'%Cred%h%Creset %C(bold blue)<%an> -%C(yellow)%d%Creset %s %Cgreen(%cr) %Creset' --abbrev-commit --date=relative
@mat
mat / rlikestats
Created July 18, 2011 21:29
R like stats, command line style
#!/usr/bin/env ruby
#
# Now living in https://github.com/mat/dotfiles
#
class Rlikestats
attr_accessor :values, :count, :mean, :stdev, :lines
def initialize
@mat
mat / .irbrc
Created July 26, 2011 21:25
.irbrc awesomeness
#
# Now living in https://github.com/mat/dotfiles
#
require 'benchmark'
require 'open-uri'
require 'rubygems'
require 'active_support/all'
require 'nokogiri'
@mat
mat / INSTALL
Created August 12, 2011 19:43
Turn an Ubuntu 10.04 server into a StatsD/Graphite server
TODO:
- edit /opt/statsd/local.js
- correct the graphite host to localhost
- if desired, put 'debug: true' in there
- make the box accessible via the hostname 'graphite'
- update conf/storage-schemas.conf, see example for these retention rules:
6 hours of 10 second data
1 week of 1 minute data
5 years of 10 minute data
@mat
mat / ruby-prof-irb.rb
Created August 31, 2011 11:27
ruby-prof irb helper
# ~/.irbrc
# $ gem install ruby-prof
# $ irb
# >> profile2file { 500_000.times{345345 ** 15} }
# Find profile results in /Users/mat/profile-1314789858.[txt|html]
# => 500000
module Kernel
def profile2file(filename = "profile-#{Time.now.to_i}")
@mat
mat / HowFastIsMax.java
Created October 5, 2011 21:25
How fast is it: Picking the max out of 1 Mio ints
import java.util.*;
public class HowFastIsMax {
private static final int INTEGERS_IN_LIST = 1000000;
private static final int TEST_RUNS = 10;
public static void main(String[] args) {
List<Integer> list = fillRandomIntList();
for (int i = 0; i < TEST_RUNS; i++) {
@mat
mat / typhoeus_to_curl.rb
Created July 18, 2014 16:46
Typhoeus request to curl command string.
#
# Generate curl command from a Typhoeus request.
#
# Example:
#
# > request = Typhoeus::Request.post("http://example.com", {body: "fine stuff"}).request
# > TyphoeusToCurl.new.to_curl(request)
#
# => "curl 'http://example.com' -X POST -H \"User-Agent: Typhoeus" -d 'fine stuff' --compressed"
#
@mat
mat / guesstimator.rb
Created July 22, 2014 08:47
Guesstimator
require 'benchmark'
class Guesstimator
@@instances={}
attr_accessor :total_operations
attr_accessor :remaining_operations
attr_reader :exp_moving_average
@mat
mat / Readme.markdown
Last active February 19, 2024 07:46
apple-app-site-association —with examples

“apple-app-site-association” file

One file for each domain, both www.example.com and example.com need separate files:

{
    "applinks": {
        "apps": [],
        "details": {
 "9JA89QQLNQ.com.apple.wwdc": {