Instantly share code, notes, and snippets.

# Andrew Gilmartin andrewgilmartin

Last active July 5, 2024 11:53
A collection of links for streaming algorithms and data structures

## General Background and Overview

1. Probabilistic Data Structures for Web Analytics and Data Mining : A great overview of the space of probabilistic data structures and how they are used in approximation algorithm implementation.
2. Models and Issues in Data Stream Systems
3. Philippe Flajolet’s contribution to streaming algorithms : A presentation by Jérémie Lumbroso that visits some of the hostorical perspectives and how it all began with Flajolet
4. Approximate Frequency Counts over Data Streams by Gurmeet Singh Manku & Rajeev Motwani : One of the early papers on the subject.
Last active June 16, 2024 13:44
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

# Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

``````#!/bin/bash
convert "\$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "\$2"
``````

# Results

Last active September 22, 2017 05:17
Tiny 2048
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 import os,tty;tty.setcbreak(0);M=['']*16 def G(v): p=['']*4;u=list(filter(str,v));i=3 while u:z=u.pop();p[i]=u and z==u[-1]and 2*u.pop()or z;i-=1 return p def Y(M,k):i=1;M=zip(*[iter(M)]*4);exec'M=map([list,G][i*k==k*k],zip(*M))[::-1];i+=1;'*4;return sum(M,[]) while 1: r=id(M)%71+17 while M[r%16]*r:r-=1 if r:M[r%16]=r%7%2*2+2
Last active July 26, 2022 18:43
Poor man's smokeping for OS X
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 #!/bin/bash # https://gist.github.com/joshenders/52cb78bedaea6787faac # This script uses the BSD variants of commands and is intended to # be run on an unmodified installation of OSX. pmset noidle & now=\$(date +%s) duration=\$((86400*3)) # 3days
Last active March 26, 2023 17:22

# Using nc and protoc as protobuf client and server

Inspiration: Linux and Unix nc command

Example protobuf definition:

```message Person {
required string name = 1;
required int32 id = 2;```
Created December 8, 2017 13:11
Expose public IP to JMX on EC2 instance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 JMX_IP=\$(curl http://169.254.169.254/latest/meta-data/public-ipv4) exec java \$JAVA_OPTS -Djava.rmi.server.hostname=\$JMX_IP -jar app.jar \$JAVA_ARGS
Created December 19, 2017 19:08
Showing only populated rows in a JavaFx TableView
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 import javafx.application.Application; import javafx.beans.property.ReadOnlyObjectWrapper; import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.skin.TableHeaderRow; import javafx.stage.Stage;
Created February 7, 2018 11:16
Ignore SSL/TLS trust/certificate errors in Java. Call SSLUtilities.trustAllHttpsCertificates() at init
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 package utils; import java.security.GeneralSecurityException; import java.security.SecureRandom; import java.security.cert.X509Certificate; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager;