Skip to content

Instantly share code, notes, and snippets.

@kenpusney
kenpusney / code.js
Created December 1, 2020 08:50
Pack up all your code into single file
const glob = require('glob');
const fs = require("fs");
const EXCLUSION_PATTERNS = /min/;
glob("**/*.*", function(err, files) {
files.forEach(f => {
if (fs.statSync(f).isDirectory() || EXCLUSION_PATTERNS.test(f)) {
return
#!/usr/bin/env bash
# Subtree archive script
# -------
#
# Archive your repos into single and keeps all commit history.
#
# Please change github username before you use.
REPO=$1
@kenpusney
kenpusney / wstories.js
Last active May 19, 2020 07:15
Generate story list using Balsamiq Wireframes story map
const fs = require("fs")
function borderColorToType(borderColor) {
return {
2848996: "Integration",
10027263: "Decision",
40463: "Authentication",
13576743: "Technical"
https://press.one/p/v?s=6f1036adf9aa7696078f264821a0a455036000dda0c1aed609bcea373e3afdba31f5fb6bf5bca4c031b75a991dc258b3f79b867ede2aa9c9ef9e2de92257070d01&h=2e93097a91c5b05e4484eab68e9d1fcbd9e2c900f5328d14bf2a84c241ca3b92&a=43c0f7e052d170387e2a6648347a69ea50bba7b0&f=P1&v=3
function validate(schema, value, strict = false, key = undefined) {
if (value === undefined) {
if (strict) {
throw new TypeError(`undefined value for ${key}: ${schema}`)
} else {
return;
}
}
if (schema instanceof Schema) {
#include <string>
using namespace std;
constexpr char to_char(unsigned x)
{
return x % 10 + '0';
}
template <unsigned... digits>
#include <cassert>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iterator>
#include <iostream>
#include <fstream>
const REPLACEMENT = "1234590"
const ORIGINAL = "lzeasgo"
const MATCHER = new RegExp("["+ORIGINAL+"]", "ig")
module.export = function (text) {
return text.replace(MATCHER, function(c) {
return REPLACEMENT.charAt(ORIGINAL.indexOf(c.toLowerCase()))
})
}
@kenpusney
kenpusney / App.java
Last active October 23, 2018 10:50
Visitor
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
interface Freight {
void accept(FreightVisitor visitor);
}
interface FreightVisitor {
#!/usr/bin/env bash
KUBEENV=$1
KUBECFG="${HOME}/.kube/config.${KUBEENV}"
TARGET="${HOME}/.kube/config"
die() {
echo $1
exit 1
}