Skip to content

Instantly share code, notes, and snippets.

View nataliefl's full-sized avatar

Natalie Lien nataliefl

  • Iterate AS
  • Oslo
View GitHub Profile
@nataliefl
nataliefl / gist:21880de378d266237c6c8fe7781f836b
Created July 15, 2020 06:59
Create id without collision guarantee
Math.random().toString(16).slice(2)
@nataliefl
nataliefl / daemonset-amd64.yaml
Last active October 25, 2021 03:16
kube-proxy setup for amd64 and arm architecture
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
labels:
k8s-app: kube-proxy
name: kube-proxy-amd64
namespace: kube-system
spec:
revisionHistoryLimit: 10
selector:
@nataliefl
nataliefl / v8regex.js
Created July 28, 2017 08:29
v8 regex caching
//https://stackoverflow.com/questions/14352100/does-v8-cache-compiled-regular-expressions-automatically
function isFooBar(str) {
return str.match(/^(?:(?=.*[a-z])(?:(?=.*[A-Z])(?=.*[\d\W])|(?=.*\W)(?=.*\d))|(?=.*\W)(?=.*[A-Z])(?=.*\d)).{8,}(?:(?=.*[a-z])(?:(?=.*[A-Z])(?=.*[\d\W])|(?=.*\W)(?=.*\d))|(?=.*\W)(?=.*[A-Z])(?=.*\d)).{8,}(?:(?=.*[a-z])(?:(?=.*[A-Z])(?=.*[\d\W])|(?=.*\W)(?=.*\d))|(?=.*\W)(?=.*[A-Z])(?=.*\d)).{8,}(?:(?=.*[a-z])(?:(?=.*[A-Z])(?=.*[\d\W])|(?=.*\W)(?=.*\d))|(?=.*\W)(?=.*[A-Z])(?=.*\d)).{8,}(?:(?=.*[a-z])(?:(?=.*[A-Z])(?=.*[\d\W])|(?=.*\W)(?=.*\d))|(?=.*\W)(?=.*[A-Z])(?=.*\d)).{8,}(?:(?=.*[a-z])(?:(?=.*[A-Z])(?=.*[\d\W])|(?=.*\W)(?=.*\d))|(?=.*\W)(?=.*[A-Z])(?=.*\d)).{8,}(?:(?=.*[a-z])(?:(?=.*[A-Z])(?=.*[\d\W])|(?=.*\W)(?=.*\d))|(?=.*\W)(?=.*[A-Z])(?=.*\d)).{8,}(?:(?=.*[a-z])(?:(?=.*[A-Z])(?=.*[\d\W])|(?=.*\W)(?=.*\d))|(?=.*\W)(?=.*[A-Z])(?=.*\d)).{8,}(?:(?=.*[a-z])(?:(?=.*[A-Z])(?=.*[\d\W])|(?=.*\W)(?=.*\d))|(?=.*\W)(?=.*[A-Z])(?=.*\d)).{8,}(?:(?=.*[a-z])(?:(?=.*[A-Z])(?=.*[\d\W])|(?=.*
@nataliefl
nataliefl / gist:e2c45621022b794bd69649cbe1517c57
Created November 5, 2016 14:14
Debug ENOENT errors from spawned processes in node
(function() {
var childProcess = require("child_process");
var oldSpawn = childProcess.spawn;
function mySpawn() {
console.log('spawn called');
console.log(arguments);
var result = oldSpawn.apply(this, arguments);
return result;
}
childProcess.spawn = mySpawn;
@nataliefl
nataliefl / changedir
Created July 14, 2016 14:26
Script snippet to quickly navigate many levels up in the folder structure
##
# Go back multiple directories at once.
#
# Example :
#
# shell> .. 5
#
# This will take you 5 directories back in the file structure. This is the same as typing
#
# shell> cd ../../../../..
@nataliefl
nataliefl / logstore
Created April 25, 2016 11:58
Draft of logging lib for comscore maelstrom
'use strict';
var store = {};
module.exports.get = function get() {
var items = {};
Array.prototype.slice.call(arguments)
.filter(function (arg){
return store[arg];
})
/**
* If not equal
* {{#ifnoteq "valueA" "valueB"}} ... {{else}} ... {{/if}}
*/
Handlebars.registerHelper('ifnoteq', function ifnoteq(a, b, opts) {
return (a != b) ? opts.fn(this) : opts.inverse(this);
});