Skip to content

Instantly share code, notes, and snippets.

@srosenberg
srosenberg / giphy_steganography.md
Last active May 18, 2020 15:16
GIPHY Steganography: embedding secrets into animated GIFs

Install the encoder,

git clone https://github.com/vipyne/giffy
make giffy

Encode the secret and upload to https://giphy.com/

@srosenberg
srosenberg / scala_bytecode_complexity.md
Last active May 12, 2017 17:46
scala bytecode complexity

Two ways of checking nullity: slick and pragmatic

Let's consider two somewhat contrived implementations of checking nullity of a field dereference chain in Scala and Java. Note that the use of Try below is an anti-pattern because it's essentially equivalent to using try/catch in Java as a nullity check. We use it for illustrative purposes since its idiomatic use-case involves case matching.

import scala.util._

class X {
  val x = new X
  val y: X = null
{
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "fillColor": "#eeffee",
"fillOpacity": 0.8, "adm1_code": "BGD-1806", "Shape_Leng": 10.815601, "Shape_Area": 2.714485, "diss_me": 1806, "adm1_code_": "BGD-1806", "iso_3166_2": "BD-", "wikipedia": null, "sr_sov_a3": "BGD", "sr_adm0_a3": "BGD", "iso_a2": "BD", "adm0_sr": 5, "admin0_lab": 2, "name": "Dhaka", "name_alt": "Daca|Dacca", "name_local": null, "type": "Bibhag", "type_en": "Division", "code_local": null, "code_hasc": "BD.DA", "note": null, "hasc_maybe": null, "region": null, "region_cod": null, "region_big": null, "big_code": null, "provnum_ne": 6, "gadm_level": 1, "check_me": 10, "scalerank": 2, "datarank": 2, "abbrev": null, "postal": "DA", "area_sqkm": 0.000000, "sameascity": 7, "labelrank": 7, "featurecla": "Admin-1 scale rank", "admin": "Bangladesh"
{
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "adm1_code": "YEM-3498", "Shape_Leng": 1.125322, "Shape_Area": 0.032973, "diss_me": 3498, "adm1_code_": "YEM-3498", "iso_3166_2": "YE-", "wikipedia": null, "sr_sov_a3": "YEM", "sr_adm0_a3": "YEM", "iso_a2": "YE", "adm0_sr": 1, "admin0_lab": 2, "name": "Amanat Al Asimah", "name_alt": null, "name_local": "????? ???????", "type": "Muhafazah", "type_en": "Governorate", "code_local": null, "code_hasc": null, "note": null, "hasc_maybe": null, "region": null, "region_cod": null, "region_big": null, "big_code": null, "provnum_ne": 0, "gadm_level": 0, "check_me": 0, "scalerank": 6, "datarank": 9, "abbrev": null, "postal": null, "area_sqkm": 0.000000, "sameascity": 9, "labelrank": 9, "featurecla": "Admin-1 scale rank", "admin": "Yemen", "name_len": 16, "mapcolor9": 3, "mapco
@srosenberg
srosenberg / aoi_london.js
Created January 14, 2016 04:31
aio_london.js
{
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "adm1_code": "GBR-2060", "Shape_Leng": 0.387788, "Shape_Area": 0.005464, "diss_me": 2060, "adm1_code_": "GBR-2060", "iso_3166_2": "GB-", "wikipedia": null, "sr_sov_a3": "GB1", "sr_adm0_a3": "GBR", "iso_a2": "GB", "adm0_sr": 1, "admin0_lab": 7, "name": "Barking and Dagenham", "name_alt": null, "name_local": null, "type": "London Borough", "type_en": "London Borough", "code_local": null, "code_hasc": "GB.BA", "note": null, "hasc_maybe": null, "region": "London", "region_cod": null, "region_big": null, "big_code": null, "provnum_ne": 20035, "gadm_level": 2, "check_me": 10, "scalerank": 8, "datarank": 5, "abbrev": "Bark&Dag", "postal": "BA", "area_sqkm": 0.000000, "sameascity": -99, "labelrank": 9, "featurecla": "Admin-1 scale rank", "admin": "United Kingdom", "name_le