Skip to content

Instantly share code, notes, and snippets.

@bekce
bekce / SSLUtilities.java
Created February 7, 2018 11:16
Ignore SSL/TLS trust/certificate errors in Java. Call SSLUtilities.trustAllHttpsCertificates() at init
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;
@dmolesUC
dmolesUC / TableHeightDemo.java
Created December 19, 2017 19:08
Showing only populated rows in a JavaFx TableView
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;
@jklingsporn
jklingsporn / run.sh
Created December 8, 2017 13:11
Expose public IP to JMX on EC2 instance
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

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;
@joshenders
joshenders / smokeping.sh
Last active July 26, 2022 18:43
Poor man's smokeping for OS X
#!/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
@justecorruptio
justecorruptio / 2048.py
Last active September 22, 2017 05:17
Tiny 2048
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
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active February 25, 2024 13:47
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

@debasishg
debasishg / gist:8172796
Last active March 15, 2024 15:05
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.
  5. [Methods for Finding Frequent Items in Data Streams](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9800&rep=rep1&t