Skip to content

Instantly share code, notes, and snippets.

View timokoola's full-sized avatar

Timo Koola timokoola

  • Skadi Oy
  • Helsinki
View GitHub Profile
@baconpat
baconpat / RecycleViewMatcher.java
Created March 30, 2016 01:13
RecycleViewMatcher (updated for scrolling)
package com.foo.RecyclerViewMatcher;
import android.content.res.Resources;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
@subfuzion
subfuzion / curl.md
Last active October 11, 2025 00:58
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@kpuputti
kpuputti / fold.js
Last active May 6, 2024 05:20
Functional acrobatics using folds in JavaScript.
/*eslint-env es6 */
// Inspired by the paper "A tutorial on the universality and
// expressiveness of fold" by Graham Hutton (available at
// http://www.cs.nott.ac.uk/~gmh/fold.pdf), implementing some generic
// list handling functions in JavaScript in terms of `fold`.
// Personally I had an enlightnening moment when I realised the
// beautiful interplay of cons lists and foldr during the FP101x
// Haskell course. JavaScript's syntax doesn't make this very apparent
@JohnPreston
JohnPreston / Debbuging
Last active August 29, 2015 14:06
EDGE Debugging
# Run instances in AZs
for i in 1 2 3 4 ; do for j in 1 2 3 4 ; do euca-run-instances -z az_$i -n 60 -k key emi-ID -d Hello ;done done ;date
# Gets connected to every instances using the public address
for i in `euca-describe-instances verbose | grep INST | awk '{print $13}'`; do ssh -i /root/.euca/admintest.pem -o UserKnownHostsFile=/dev/null $i -o StrictHostKeyChecking=no curl -s 169.254.169.254/latest/user-data 2>/dev/null; echo ; done | wc -l
# gets information from NC about the IP and instances state
ansible nc -m shell -a 'echo -n "N*eucanted processes:"; ps faux | grep eucanetd| grep \/\/ | wc -l ; echo -n "PUB IPs :" ; ip addr sh eth0 | grep inet | grep -v inet6| wc -l; echo -n "N* VNET : "; ifconfig | grep vnet | wc -l ; echo -n "InstanceRunning :"; virsh list | grep i- | wc -l' > ips_instances_proc_`date +%Y-%m-%d_%H-%M`.log
# makes sure that the meta-data rule is set on NCs
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active August 25, 2025 12:52 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@jboner
jboner / latency.txt
Last active October 28, 2025 10:58
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD