Skip to content

Instantly share code, notes, and snippets.

💭
I may be slow to respond.

Matthias Lüdtke mat

💭
I may be slow to respond.
View GitHub Profile
@mat
mat / msci-world-performance.csv
Created Nov 21, 2017
MSCI World Performance
View msci-world-performance.csv
Year MSCI World Inflation Germany Net Growth
1970 -1.98% 3.1% -5.08%
1971 19.56% 4.7% 14.86%
1972 23.55% 4.6% 18.95%
1973 -14.51% 6.6% -21.11%
1974 -24.48% 7.2% -31.68%
1975 34.50% 5.4% 29.10%
1976 14.71% 3.2% 11.51%
1977 5.00% 3.9% 1.10%
1978 18.22% 2.4% 15.82%
@mat
mat / hey.txt
Created Jul 27, 2017
hey load testing
View hey.txt
# https://github.com/rakyll/hey
./hey https://google.com
Summary:
Total: 0.8679 secs
Slowest: 0.5881 secs
Fastest: 0.0710 secs
Average: 0.1778 secs
Requests/sec: 230.4501
@mat
mat / mozjpeg_mac_os_x.markdown
Created Dec 8, 2015
Building mozjpeg 3.1 on Mac OS X
View mozjpeg_mac_os_x.markdown
@mat
mat / poor_time_machine.txt
Created Dec 3, 2015
Poor Man's TimeMachine Backup
View poor_time_machine.txt
TimeMachine using cron and rsync ;-)
Backs up in two intervals: 10 and 60 minutes
$ crontab -l
*/10 * * * * rsync -a -q --delete ~/projects/ ~/Desktop/projects10/
0 * * * * rsync -a -q --delete ~/projects/ ~/Desktop/projects60/
@mat
mat / artifacts.py
Last active Jan 19, 2016
Pillow PNG artifacts
View artifacts.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This script reproduces the issue with artifacts when
# handling (semi)transparent PNG files:
# https://github.com/python-pillow/Pillow/issues/1449
# Version used:
#
@mat
mat / Readme.markdown
Last active Apr 25, 2020
apple-app-site-association —with examples
View Readme.markdown

“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": {
View guesstimator.rb
require 'benchmark'
class Guesstimator
@@instances={}
attr_accessor :total_operations
attr_accessor :remaining_operations
attr_reader :exp_moving_average
@mat
mat / typhoeus_to_curl.rb
Created Jul 18, 2014
Typhoeus request to curl command string.
View typhoeus_to_curl.rb
#
# 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 / HowFastIsMax.java
Created Oct 5, 2011
How fast is it: Picking the max out of 1 Mio ints
View HowFastIsMax.java
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 / ruby-prof-irb.rb
Created Aug 31, 2011
ruby-prof irb helper
View ruby-prof-irb.rb
# ~/.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}")
You can’t perform that action at this time.