Skip to content

Instantly share code, notes, and snippets.

Nicholas Blexrud nicholasblexrud

Block or report user

Report or block nicholasblexrud

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jasonrdsouza /
Last active Sep 27, 2019
Python script to efficiently concatenate S3 files
This script performs efficient concatenation of files stored in S3. Given a
folder, output location, and optional suffix, all files with the given suffix
will be concatenated into one file stored in the output location.
Concatenation is performed within S3 when possible, falling back to local
operations when necessary.
Run `python -h` for more info.
View rxjs-example-poll-url.js
let timeout = 1000;
* Create a custom observable that creates a XHR request and returns complete when the promise is fulfilled
let observable = Rx.Observable.create((o) => {
.then((data) => {
Filirom1 /
Last active Jun 9, 2017
ElasticSearch dynamic default mapping for nested objects

First start ES with /etc/elasticsearch/default-mapping.json, then index several documents with inner objects

curl -XPOST -d '{"key":{"subkey1":1, "subkey2":1}}' localhost:9200/toto/toto/1
curl -XPOST -d '{"key2":{"subkey1":1, "subkey2":1}}' localhost:9200/toto/toto/2
curl -XPOST -d '{"key3":{"subkey1":1, "subkey2":1}}' localhost:9200/toto/toto/3

Finally, launch the query

jramsahai / push_to_ga.html
Last active Sep 13, 2017
Using Google Analytics Event tracking and the Vidyard player API, we can push player events into Google Analytics to allow us to capture some useful viewership data along side the standard web traffic reporting.
View push_to_ga.html
<!-- Vidyard player API script -->
<script src="//"></script>
<!-- Google Analytics tracking code -->
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
View networks hosting crawlers.html
<!-- Regexp to recognize fake trafic from JS enabled crawlers
For use in Google Analytics **Filters** on the "ISP Organization" field, corresponding dimension in reporting is "Service Provider"
This lists fits within the 255 characters limit (!doesn't any more, to be optimized) of the filter field if you want to have a Profile/View that will include only that traffic
Most crawlers have Java disabled
You can also disable logging the activity of web monitoring services through a test on user-agent string, see
yyx990803 /
Last active Oct 10, 2019
npm list only top level modules.
alias ng="npm list -g --depth=0 2>/dev/null"
alias nl="npm list --depth=0 2>/dev/null"
nuxlli / azure_upload_async.js
Last active Aug 13, 2019
Example uploaded file to azure with Q and without Q
View azure_upload_async.js
var blob = require('azure').createBlobService()
, fs = require('fs')
, Q = require('q');
var options = { publicAccessLevel: 'blob' };
// With Q
var fsLstat = Q.nbind(fs.lstat, fs);
var getContainer = Q.nbind(blob.createContainerIfNotExists, blob);
var streamFile = Q.nbind(blob.createBlockBlobFromStream, blob);
peterherrmann / gist:2700284
Created May 15, 2012
GASRetry - Exponential backoff JavaScript implementation for Google Apps Script (Library project key: "MGJu3PS2ZYnANtJ9kyn2vnlLDhaBgl_dE")
View gist:2700284
* Invokes a function, performing up to 5 retries with exponential backoff.
* Retries with delays of approximately 1, 2, 4, 8 then 16 seconds for a total of
* about 32 seconds before it gives up and rethrows the last error.
* See:
* <br>Author: (Peter Herrmann)
<pre>//Calls an anonymous function that concatenates a greeting with the current Apps user's email
var example1 ={return "Hello, " + Session.getActiveUser().getEmail();});
</pre><pre>//Calls an existing function
n1k0 / gist:1501173
Created Dec 20, 2011 — forked from fbuchinger/gist:1501115
PhantomJS: Capturing single dom elements as png files
View gist:1501173
var page = new WebPage(),
address, output, size;
//capture and captureSelector functions adapted from CasperJS -
capture = function(targetFile, clipRect) {
var previousClipRect;
var clipRect = {top: 0, left:0, width: 40, height: 40};
if (clipRect) {
if (!isType(clipRect, "object")) {
throw new Error("clipRect must be an Object instance.");
You can’t perform that action at this time.