Skip to content

Instantly share code, notes, and snippets.

View tarnfeld's full-sized avatar

Tom Arnfeld tarnfeld

View GitHub Profile
@tarnfeld
tarnfeld / README.md
Created December 19, 2018 15:25
Parser for ripe atlas dns measurements

Usage

I ran this with some of the json files provided and it dumps out (in a somewhat readable/searchable text format) the measurement data to make reading it a bit easier.

You can run it like this...

$ pip install -r requirements.pip
$ python parse.py [path to json blob from ripe probes]
{"dst_first_appeared": 1492493030, "serial": 2017041800, "serial_first_appeared": 1492493030, "dst": "198.41.0.4", "delta": 0}
{"dst_first_appeared": 1492473633, "serial": 2017041701, "serial_first_appeared": 1492473633, "dst": "198.41.0.4", "delta": 0}
{"dst_first_appeared": 1492534727, "serial": 2017041801, "serial_first_appeared": 1492534727, "dst": "198.41.0.4", "delta": 0}
{"dst_first_appeared": 1492560020, "serial": 2017041801, "serial_first_appeared": 1492560020, "dst": "198.41.0.4", "delta": 0}
{"dst_first_appeared": 1492577930, "serial": 2017041900, "serial_first_appeared": 1492577930, "dst": "198.41.0.4", "delta": 0}
{"dst_first_appeared": 1492592252, "serial": 2017041901, "serial_first_appeared": 1492592252, "dst": "198.41.0.4", "delta": 0}
@tarnfeld
tarnfeld / readme.md
Last active August 29, 2015 14:01
Lightweight containers with Docker

I was curious to find out if there was a way of maintaing docker's great user experience, while being able to enjoy the simplicity of cgroups on their own.

This has it's benefits, as there's no need to transfer any data in an image that isn't required for your individual service. You can also more easily share packages and installations with the host operating system.

Launch a container with all of the important host stuff mounted

$ sudo docker run -d \
    -v /bin:/bin:ro \
    -v /dev:/dev:ro \
docker build
>> built XXXXX
docker tag registry/test/FOOBAR:my-tag
docker push registry/test/FOOBAR
>> pushes XXXXX to registry/test/FOOBAR (uploaded)
docker build
>> built XXXX1
"""
Test:
Given two strings, `a` and `b`. Sort the letters in `a` by the order of letters in `b`.
For example:
a = "ssttexeste"
b = "test"
result = "ttteeesssx"
"""
def a_by_b(a, b):
var a = [], i = 0;
function addPart(part, callback) {
setTimeout(function(part) {
a.push(part);
callback();
}, 200);
};
function init(callback) {
function check() {
@tarnfeld
tarnfeld / gist:4534175
Created January 14, 2013 22:36
Create a bezier path with rounded corners based on a radius and existing frame. Most useful if you want to add in other shapes into the path while still maintaining rounded corners (for example, an arrow).
- (UIBezierPath *)roundedPathFromRect(CGRect)f
{
UIBezierPath *path = [[UIBezierPath alloc] init];
NSInteger radius = 4.0;
// Draw the path
[path moveToPoint:CGPointMake(radius, 0)];
[path addLineToPoint:CGPointMake(f.size.width - radius, 0)];
[path addArcWithCenter:CGPointMake(f.size.width - radius, radius)
radius:radius
@tarnfeld
tarnfeld / error
Created January 2, 2013 11:52 — forked from m4tthumphrey/error
Exception
NoMethodError
Error
undefined method `id' for nil:NilClass
/home/gitlab/gitlab/app/models/project.rb:104:in `find_with_namespace'
/home/gitlab/gitlab/app/workers/post_receive.rb:9:in `perform'
/**
* Live updating API JS client side class
* @author Tim Davies
*/
function LiveupdatingClient (container)
{
/**
* Set up, include handlebars and setup template
*/
var endpoint = 'liveupdating.php';
@tarnfeld
tarnfeld / Answer.php
Created June 7, 2012 15:07 — forked from JeffreyWay/gist:2889230
Simple PHP Quiz
<?php
$string = "January 5th, 2012";
list($month, $day, $year) = array_map(function($v) { return trim($v, ","); }, explode(" ", $string));
var_dump($month, $day, $year);
// string(7) "January"
// string(3) "5th"
// string(4) "2012"