Skip to content

Instantly share code, notes, and snippets.

@thejuan
thejuan / script.turf-sandbox
Created May 9, 2022 01:45
turf-sandbox snippet
// simply return a valid GeoJSON and it will be rendered on the map
/**
* [bounds.west, bounds.north],
[bounds.east, bounds.north],
[bounds.east, bounds.south],
[bounds.west, bounds.south],
*/
@thejuan
thejuan / s3.ts
Last active February 15, 2021 01:26
S3 read-after-update consistency
import { writeS3Obj, getS3FileAsObj, listObjects, deleteS3Files } from "./S3";
/**
* S3 does not provide read-after-update consistency.
* It does provide read-after-firstWrite consistency (as long as no GET has been requested)
* We write a new file every time it changes, and we read the latest file.
* S3 guarantees list of files are sorted in ascending UTF-8 Binary Order
*
*/
@thejuan
thejuan / 00.howto_install_phantomjs.md
Created August 26, 2016 04:43 — forked from julionc/00.howto_install_phantomjs.md
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev

Keybase proof

I hereby claim:

  • I am thejuan on github.
  • I am adammills (https://keybase.io/adammills) on keybase.
  • I have a public key whose fingerprint is 0F8D 0BF9 10C2 C609 9127 B42D D8BD DCC9 1B01 4D4F

To claim this, I am signing this object:

input {
file {
type => "iis"
path => "C:/inetpub/logs/LogFiles/W3SVC/*.log"
}
}
filter {
#ignore log comments
@thejuan
thejuan / IIS Logstash Grok
Created February 21, 2014 18:16
A Logstash Grok filter for IIS (W3C default fields + bytes sent)
filter{
grok {
match => ["message", "%{TIMESTAMP_ISO8601:log_timestamp} %{WORD:iisSite} %{IPORHOST:site} %{WORD:method} %{URIPATH:page} %{NOTSPACE:querystring} %{NUMBER:port} %{NOTSPACE:username} %{IPORHOST:clienthost} %{NOTSPACE:useragent} %{NOTSPACE:referer} %{NUMBER:response} %{NUMBER:subresponse} %{NUMBER:scstatus} %{NUMBER:bytes:int} %{NUMBER:timetaken:int}"]
}
}
@thejuan
thejuan / Logstash IIS Input
Created February 21, 2014 17:57
IIS Input Config for Logstash
input {
file {
type => "iis"
path => "C:/inetpub/logs/LogFiles/W3SVC/*.log"
}
}
@thejuan
thejuan / gist:7750311
Last active December 30, 2015 00:29
JSONP ADFS Pre-Auth
//Requires Jquery 1.9+
var hasPreAuthenticated = false;
var webAPIHtmlPage = "http://webapi.somedomain/preauth.html"
function preauthenticate() {
//ADFS breaks Ajax requests, so we pre-authenticate the first call using an iFRAME and "authentication" page to get the cookies set
return $.Deferred(function (d) {
@thejuan
thejuan / AsyncExecutionQueue
Last active April 24, 2016 16:46
Async Execution Queue
export class AsyncExecutionQueue{
private tail: JQueryPromise = $.Deferred().resolve();
public enqueue(cmd:()=>any): JQueryPromise {
console.log("Queuing Command");
var next = $.Deferred();
var client = $.Deferred();
this.tail.always(() => {