Skip to content

Instantly share code, notes, and snippets.

View davidguttman's full-sized avatar

David Guttman davidguttman

View GitHub Profile
@dimkir
dimkir / nightmare-on-amazon-linux.MD
Last active February 6, 2021 17:45
How to run nightmare on Amazon Linux

Running nightmare on Amazon Linux

You may have thought of running nightmare on AWS Lambda. But before we can run it on Lambda, we need first to make it run on Amazon Linux.

Provision instance which replicates Lambda environment

According to AWS Documentation on Lambda Execution Environment and available Libraries we would need this AMI image with this alias amzn-ami-hvm-2016.03.3.x86_64-gp2. Keep in mind that AMI-image-id for this instance would be different in different regions (eg):

  • In eu-west-1 - ami-f9dd458a
  • In us-east-1 - ami-6869aa05
@dotproto
dotproto / unicode_string_comparison.js
Last active January 20, 2017 02:38
Examining raw unicode values and their normalized forms. TL:DR; comparing unicode strings using a `.normalized()` and `. localeCompare()`
// References
//
// - https://tc39.github.io/ecma262/#sec-ecmascript-language-types-string-type
// - http://unicode.org/reports/tr15/#Norm_Forms
// - http://unicode.org/faq/normalization.html#7 (What is the difference is between W3C normalization and Unicode normalization?)
// - https://developer.mozilla.org/en-US/docs/Web/API/DOMParser
//
// Resources
//
// - http://stackoverflow.com/questions/8936984/uint8array-to-string-in-javascript
@beaugunderson
beaugunderson / cool-modules.md
Last active February 2, 2023 19:58
cool modules from nodeconf

from streams session

  • end-of-stream - specify a callback to be called when a stream ends (which is surpsingly hard to get right)
  • duplexify - compose a Duplex stream from a Readable and a Writable stream
  • pump - pipe streams together and close all of them if one of them closes
  • pumpify - combine an array of streams into a single duplex stream using pump and duplexify
  • through2 - tools for making Transform streams
  • from2 - tools for making Readable streams

from "participatory modules" session

@chrismdp
chrismdp / s3.sh
Last active March 5, 2024 12:57
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
@max-mapper
max-mapper / index.js
Last active August 29, 2015 14:06
node tcp + http speed test
var net = require('net')
var through = require('through2')
var server = process.argv[2]
var path = process.argv[3]
var host = process.argv[4]
var socket = net.connect(80, server)
var req = ["GET " + path + " HTTP/1.1\r\n",
@staltz
staltz / introrx.md
Last active April 19, 2024 18:49
The introduction to Reactive Programming you've been missing
@jdx
jdx / boot.js
Last active March 16, 2023 18:08
zero-downtime node.js app runner
// This script will boot app.js with the number of workers
// specified in WORKER_COUNT.
//
// The master will respond to SIGHUP, which will trigger
// restarting all the workers and reloading the app.
var cluster = require('cluster');
var workerCount = process.env.WORKER_COUNT || 2;
// Defines what each worker needs to run
@juliangruber
juliangruber / gist:7356625
Last active December 27, 2015 16:39
setup custom local.host

So you might have set up dnsmasq with this tutorial but then you notice that you can't set cookies to subdomains of localhost or for all of localhost's subdomains (see why).

So we set up a custom "localhost", that I'll call local.host, but you can pick whatever you want, as long as it contains at least one dot. Just adapt the first two commands.

$ # add to hosts list
$ sudo echo "127.0.0.1 local.host" >> /private/etc/hosts
$ # tell your dns server about it
@juliangruber
juliangruber / gist:7356251
Last active May 5, 2021 17:53
localhost subdomains on osx

First, install dnsmasq using brew:

$ brew update
$ brew install dnsmasq

Then create your configuration