Skip to content

Instantly share code, notes, and snippets.

View jarib's full-sized avatar

Jari Bakken jarib

View GitHub Profile
[
"Anadarko Petroleum",
"BAE Systems",
"BP",
"Boeing",
"Booz Allen Hamilton",
"CACI International",
"Chevron",
"ConocoPhillips",
"DARPA",
SELECT
title,
CONCAT('http://en.wikipedia.org/w/index.php?diff=', STRING(revision_id)) AS diff_url,
revision_id,
SEC_TO_TIMESTAMP(timestamp) AS ts,
timestamp,
contributor_ip
FROM publicdata:samples.wikipedia
WHERE (REGEXP_MATCH(contributor_ip, r'^(6|11|21|22|25|26|29|30|33|34|55|214|215)\.'))
ORDER BY ts DESC
var XmlStream = require('xml-stream'),
stream = new XmlStream(process.stdin);
var currentPageTitle = null,
currentPageId = null,
rx = {
storting: /^85\.88\.(6[4-9]|[7-8]\d|9[0-5])\./,
regjering: /^132\.150\./
},
require 'csv'
class DisagreementVoteFinder
include Rails.application.routes.url_helpers
def initialize(session, a = ['frp', 'h'], b = ['v', 'krf'])
@session = session
@a = Party.where(slug: a).to_a
@b = Party.where(slug: b).to_a
end
$ sudo mtr --report rubygems.org
HOST: sch-bp-2338.local Loss% Snt Last Avg Best Wrst StDev
1.|-- 192.168.40.6 0.0% 10 0.9 1.2 0.9 3.1 0.7
2.|-- 192.168.8.70 0.0% 10 1.0 1.0 0.9 1.2 0.1
3.|-- 80.91.32.3 0.0% 10 1.6 4.7 1.4 13.8 5.2
4.|-- 193.69.11.81 0.0% 10 1.6 6.7 1.6 27.2 10.5
5.|-- oso-b4-link.telia.net 0.0% 10 1.7 1.8 1.7 1.9 0.1
6.|-- kbn-bb4-link.telia.net 0.0% 10 14.6 16.2 14.6 21.3 2.5
7.|-- nyk-bb2-link.telia.net 0.0% 10 106.6 118.2 106.6 161.0 21.7
8.|-- chi-bb1-link.telia.net 0.0% 10 128.5 128.8 128.5 129.0 0.1
Calculating -------------------------------------
ruby 3 i/100ms
java -client 1 i/100ms
java -server 1 i/100ms
node 3 i/100ms
python 4 i/100ms
-------------------------------------------------
ruby 37.9 (±2.6%) i/s - 381 in 10.054042s
java -client 11.6 (±0.0%) i/s - 117 in 10.054871s
java -server 11.6 (±0.0%) i/s - 116 in 9.997524s
$ make tarball tarball-test
=> Ensuring ruby gems dependencies are in vendor/bundle...
Using bson 1.10.2
Using builder 3.2.2
Using extlib 0.9.16
Using multipart-post 2.0.0
Using beefcake 0.3.7
Using excon 0.31.0
Using ffi 1.9.3
Using formatador 0.2.5
@jarib
jarib / extract-positions.rb
Last active August 29, 2015 14:02
hdo-half-pie
# -*- coding: utf-8 -*-
# hdo-site> rails r /hdo/hdo-half-pie/extract-positions.rb >| /hdo/hdo-half-pie/index.html
HEADER = <<HTML
<!doctype html>
<html>
<meta charset="utf-8">
<head>
$ time cat hdo-csv-dump/public.vote_results.csv | dat import --csv
884 rows imported. Elapsed: 562s. 1 rows/second
cat hdo-csv-dump/public.vote_results.csv 0.00s user 0.04s system 0% cpu 8:42.17 total
dat import --csv 585.01s user 6.78s system 101% cpu 9:40.34 total
#/bin/sh
cat <<EOF | gcc -o test-sem-open -lrt -x c - && ./test-sem-open && echo "ok!"
#include <fcntl.h>
#include <semaphore.h>
#include <errno.h>
#include <string.h>
#include <stdio.h>
int main(int argc, char** argv) {