Skip to content

Instantly share code, notes, and snippets.

@thejuan
thejuan / s3.ts
Last active Feb 15, 2021
S3 read-after-update consistency
View s3.ts
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 Aug 26, 2016 — forked from julionc/00.howto_install_phantomjs.md
How to install PhantomJS on Debian/Ubuntu
View 00.howto_install_phantomjs.md

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
View keybase.md

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:

View IIS Logstash
input {
file {
type => "iis"
path => "C:/inetpub/logs/LogFiles/W3SVC/*.log"
}
}
filter {
#ignore log comments
@thejuan
thejuan / IIS Logstash Grok
Created Feb 21, 2014
A Logstash Grok filter for IIS (W3C default fields + bytes sent)
View IIS Logstash Grok
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 Feb 21, 2014
IIS Input Config for Logstash
View Logstash IIS Input
input {
file {
type => "iis"
path => "C:/inetpub/logs/LogFiles/W3SVC/*.log"
}
}
@thejuan
thejuan / gist:7750311
Last active Dec 30, 2015
JSONP ADFS Pre-Auth
View gist:7750311
//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 Apr 24, 2016
Async Execution Queue
View AsyncExecutionQueue
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(() => {