Skip to content

Instantly share code, notes, and snippets.

Magnus magnli10

View GitHub Profile
@magnli10
magnli10 / daemonset-amd64.yaml
Last active Feb 20, 2020
kube-proxy setup for amd64 and arm architecture
View daemonset-amd64.yaml
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
labels:
k8s-app: kube-proxy
name: kube-proxy-amd64
namespace: kube-system
spec:
revisionHistoryLimit: 10
selector:
@magnli10
magnli10 / v8regex.js
Created Jul 28, 2017
v8 regex caching
View v8regex.js
//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])|(?=.*
@magnli10
magnli10 / gist:e2c45621022b794bd69649cbe1517c57
Created Nov 5, 2016
Debug ENOENT errors from spawned processes in node
View gist:e2c45621022b794bd69649cbe1517c57
(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;
@magnli10
magnli10 / changedir
Created Jul 14, 2016
Script snippet to quickly navigate many levels up in the folder structure
View changedir
##
# 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 ../../../../..
@magnli10
magnli10 / logstore
Created Apr 25, 2016
Draft of logging lib for comscore maelstrom
View logstore
'use strict';
var store = {};
module.exports.get = function get() {
var items = {};
Array.prototype.slice.call(arguments)
.filter(function (arg){
return store[arg];
})
View Handlebars
/**
* 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);
});
You can’t perform that action at this time.