Skip to content

Instantly share code, notes, and snippets.

@Antti
Antti / zoopla_postcode.js
Created October 31, 2017 10:11
zoopla postcode
javascript:$('h2[itemprop="streetAddress"').append('<span style="color: red; font-weight:bold"> (' + $("meta[property='og:postal-code']").attr("content") + ')</span>')
@Antti
Antti / openrent.js
Created November 26, 2017 11:50
openrent bookmark
javascript:(function(){
var targetPostCode="EC4R3TE";
var postCode=$('#Features div div table tr td a')[0].href.split('=')[1].replace('%2520',' ');
var url="https://www.google.com/maps/dir/?api=1&origin="+postCode+"&destination="+targetPostCode+"&travelmode=transit";
$('.property-title').append('<span style="color: red"> ('+"<a target='_blank' href='"+url+"'>"+postCode+"</a>) </span>");
})()
@Antti
Antti / zoopla_postcode.js
Created December 11, 2017 14:42
zoopla postcode bookmark
javascript: (function() {
var postCode = $("meta[property='og:postal-code']").attr("content");
var url = "https://www.google.com/maps/dir/?api=1&origin=" + postCode + "&destination=EC4R3TE&travelmode=transit";
$('h2[itemprop="streetAddress"').append('<span style="color: red"> (' + "<a target='_blank' href='" + url + "'>" + postCode + "</a>) </span>");
})()
@Antti
Antti / HungarianCUDA.cu
Created February 19, 2018 22:18 — forked from paclopes/HungarianCUDA.cu
Fast CUDA implementation of the Hungarian algorithm.
// Fast Block Distributed CUDA Implementation of the Hungarian Algorithm
//
// Annex to the paper:
// Paulo A. C. Lopes, Satyendra Singh Yadav, Aleksandar Ilic, Sarat Kumar Patra ,
// "Fast Block Distributed CUDA Implementation of the Hungarian Algorithm",
// Parallel Computing
//
// Hungarian algorithm:
// (This algorithm was modified to result in an efficient GPU implementation, see paper)
//
(function() {
'use strict';
function download(filename, data) {
var pom = document.createElement('a');
pom.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(data));
pom.setAttribute('download', filename);
if (document.createEvent) {
var event = document.createEvent('MouseEvents');
event.initEvent('click', true, true);
unsafe fn transmute_vec<T, U>(vec: Vec<T>) -> Vec<U> {
use std::mem;
let ratio = mem::size_of::<T>() / mem::size_of::<U>();
let length = vec.len() * ratio;
let capacity = vec.capacity() * ratio;
let ptr = vec.as_ptr();
mem::forget(vec);
Vec::from_raw_parts(ptr as *mut U, length, capacity)
@Antti
Antti / latency.txt
Created December 20, 2018 11:18 — forked from jboner/latency.txt
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
@Antti
Antti / keybase.md
Created March 23, 2020 13:29
keybase.md

Keybase proof

I hereby claim:

  • I am Antti on github.
  • I am andrii (https://keybase.io/andrii) on keybase.
  • I have a public key whose fingerprint is 8EB1 609E 94EF 1BB4 FE5A 460D 8730 4112 E818 B8EA

To claim this, I am signing this object:

@Antti
Antti / Neewer-RGB660_PRO_ReverseEngNotes.txt
Created January 20, 2022 23:59 — forked from JDogHerman/Neewer-RGB660_PRO_ReverseEngNotes.txt
Notes on the reverse engineering of the data for the Neewer-RGB660 PRO leveraging bluetooth low energy.
Notes on the reverse engineering of the data for the Neewer-RGB660 PRO leveraging bluetooth low energy.
NEEWER-RGB660 PRO
02 41 00 0C 00 08 00 04 00 52 0E 00 78 81 01 01 FB
Preamble 02 04 00 0C 00 08 00 04 00 52 0E 00 Value 78 81 01 01 FB
Service UUID: 69400001b5a3f393e0a9e50e24dcca99
Caracteristic: 69400002b5a3f393e0a9e50e24dcca99
Properties: WRITE, WRITE NO RESPONSE
require 'brotli'
module FeedRs
class BrotliDecompressionMiddleware < Faraday::Middleware
ACCEPT_ENCODING = 'Accept-Encoding'.freeze
CONTENT_ENCODING = 'Content-Encoding'.freeze
CONTENT_LENGTH = 'Content-Length'.freeze
SUPPORTED_ENCODINGS = 'br'.freeze
def call(env)