Skip to content

Instantly share code, notes, and snippets.

View tuupola's full-sized avatar

Mika Tuupola tuupola

View GitHub Profile
!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){(function(e){"use strict";function t(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=n(54),i=t(o),u=n(65),a=t(u),s=n(66),c=t(s),f=n(44),l=t(f),d=n(67),p=t(d),h=n(68),y=t(h),v=n(23),m=n(24),g=(t(m),n(31)),w=t(g),b=n(42),_=(t(b),n(28)),S=t(_),E=n(19),M=(t(E),n(78)),D=t(M),k=n(21),T=t(k),$=n(22),C=(t($),n(79)),x=t(C),I=n(25),R=n(26),L=(t(R),n(53)),A=t(L),N=n(80),j=t(N),O="A-58D7961E94DC7D7B14415473-2",P="//limpingline.com/1beb70a0b347952342a45dbe72002af35d2809ad3e23c60be0a952fab0e54066e89465751acc2d6e02ed909299881cc0bc72587e9ec20b5af7873c7b831aa4a365563c0a4b4393824ae1fdf2",B="",F=true,q=false,W=window,H=document.currentScript,U=H&&H.src,z="preview-engage",J=O.split("-")[1]+"-m",X=true,G=new Error("duplicate
/* https://pgl.yoyo.org/adservers/admiral-domains.txt */
abandonedclover.com
abruptroad.com
actuallysheep.com
ambitiousagreement.com
anxiousapples.com
baskettexture.com
bawdybeast.com
beamincrease.com
@tuupola
tuupola / branca-compare.php
Last active July 21, 2017 21:03
Compare generated (API) token length between Branca and JWT.
<?php
/* https://github.com/tuupola/branca */
require __DIR__ . "/vendor/autoload.php";
use Branca\Branca;
use Branca\Protobuf\Payload as Protobuf;
use Firebase\JWT\JWT;
use MessagePack\Packer;
@tuupola
tuupola / trilateration.r
Last active May 31, 2017 08:09
Nonlinear least squares trilateration with n points in R: https://appelsiini.net/2017/trilateration-with-n-points/
library(geosphere)
locations <- data.frame(
latitude = c(
59.42606837, 59.42610146, 59.42654852, 59.42609108,
59.42603039, 59.42666361
),
longitude = c(
24.72553151, 24.72552969, 24.72467492, 24.72555759,
24.72565661, 24.72449149
library("pracma")
# Earth radius in metres
EARTH_RADIUS <- 6378137
# Helper function for converting to ECEH coordinates
eceh <- function (s) {
vx <- EARTH_RADIUS * (cos(deg2rad(s[1])) * cos(deg2rad(s[2])))
vy <- EARTH_RADIUS * (cos(deg2rad(s[1])) * sin(deg2rad(s[2])))
vz <- EARTH_RADIUS * (sin(deg2rad(s[1])))
@tuupola
tuupola / protomower.sh
Last active June 29, 2021 21:52
Extract protocol buffer messages from binary data
#!/bin/bash
#
# Try to decode hidden protocol buffers message from binary
size=$(wc -c < $1)
for ((i=1; i<=$size; i++))
do
# Skip $i bytes and decode
dd if=$1 bs=1 skip=$i | protoc --decode_raw
$ vendor/bin/phpunit --testsuite=Slim
PHPUnit 5.7.15 by Sebastian Bergmann and contributors.
.F.F.............................F...................F.... 58 / 58 (100%)
Time: 1.65 seconds, Memory: 6.00MB
There were 4 failures:
1) Http\Psr7Test\Tests\Slim\RequestTest::testMethod
@tuupola
tuupola / plugin.php
Last active November 11, 2016 12:10
<?php
require __DIR__ . "/vendor/autoload.php";
use Http\Client\Curl\Client as Curl;
use Http\Adapter\React\Client as React;
use Http\Adapter\Guzzle6\Client as Guzzle;
use GuzzleHttp\Client as GuzzleClient;
use Http\Client\Socket\Client as Socket;
use Http\Client\Common\PluginClient;
<?php
require __DIR__ . "/vendor/autoload.php";
use Http\Client\Curl\Client as Curl;
use Http\Adapter\React\Client as React;
use Http\Adapter\Guzzle6\Client as Guzzle;
use Http\Client\Socket\Client as Socket;
use GuzzleHttp\Client as GuzzleClient;
use Http\Message\MessageFactory\DiactorosMessageFactory;
<?php
require __DIR__ . "/vendor/autoload.php";
use Http\Client\Curl\Client;
use Http\Message\MessageFactory\DiactorosMessageFactory;
use Http\Message\StreamFactory\DiactorosStreamFactory;
use Http\Discovery\HttpAsyncClientDiscovery;
use Http\Discovery\HttpClientDiscovery;
use Psr\Http\Message\ResponseInterface;