Skip to content

Instantly share code, notes, and snippets.

View andykais's full-sized avatar

Andrew Kaiser andykais

View GitHub Profile
@andykais
andykais / login.config.js
Last active September 18, 2018 16:28
Possible new spec for passing vars like login to scraper. Essentially passing one scraper as input variables to another scraper. New syntax includes limiting the number of parsed values ("max"), parsing headers ("expect": "header") and "asInput" clause,
{
"input": ["username","password"],
"scrape": {
"download": {
"urlTemplate": "http://example-site.com/login",
"headers": {
"username": "{username}",
"password": "{password"
},
"parse": {
@andykais
andykais / .bash_aliases.sh
Created August 7, 2018 22:51
test a npm package locally in as close a manner to a published package as possible
function test_package_local() {
local cwd="$PWD"
local package_folder=$1
cd $1
local tarball=$(npm pack)
local fullpath="$package_folder/$tarball"
npm install "$fullpath"
cd "$cwd"
}
@andykais
andykais / make-url-from-zipped-string.js
Created July 25, 2018 17:25
store (compressed) text input on a static page in the url
import LZUTF8 from 'lzutf8'
const config = {
// scrape...
}
// on config text box input
const configUrlParam = LZUTF8.compress(config, { outputEncoding: "Base64" })
history.replaceState(null, '', "?config=" + configUrlParam)
@andykais
andykais / .travis.yml
Created July 5, 2018 23:44
travis config to test against multiple node versions but lint only once
language: node_js
stages:
- test
- lint
cache:
directories:
- $HOME/.npm
@andykais
andykais / observable-queue.js
Last active June 12, 2018 22:36
continually accept values and perform some async task on them until there are no more to add
const EventEmitter = require('events')
const { fromEvent } = require('rxjs')
const { tap, takeUntil, mergeMap } = require('rxjs/operators')
class Queuer {
constructor({ maxConcurrent = 1, debug = false } = {}) {
// node event emitter
const queueEmitter = new EventEmitter()
// event emitter to keep track of each task finishing
const taskEmitter = new EventEmitter()
FROM node:8-alpine
COPY entrypoint.sh /usr/bin/entrypoint.sh
# create npmrc with enviroment variable
RUN echo "\$NPM_TOKEN" > /root/.npmrc
# entrypoint script performs envsubst on npmrc
RUN printf '#!/bin/sh\n\
sed -i "s~\$NPM_TOKEN~$NPM_TOKEN~" /root/.npmrc\n\
$@' > /usr/bin/entrypoint.sh \
process.stdin.resume();
process.stdin.setEncoding('ascii');
var input_stdin = "";
var input_stdin_array = "";
var input_currentline = 0;
process.stdin.on('data', function (data) {
input_stdin += data;
});
@andykais
andykais / my_tools.md
Last active March 8, 2017 02:18
cool new tech on the web

This is just really cool to me, service workers allow mobile websites to act like native

@andykais
andykais / cisco.md
Last active February 22, 2017 18:59
  • how much mobility do we have in cisco? After a year am I able to try working on different things?

    • what I want out of this job is to be able to be in contact with multiple areas so I can keep learning, I don't want to get stagnant especially because in my last internship I really valued discovering things I didn't know how to do that helped me improve my code later.
  • how closely knit are teams? Do they hang out outside of work?

  • how much software goes back into the cisco? How much dogfooding do you do?

Algorithm Arsenal

  • sort
    • merge sort n log n
    • insertion sort
    • heap sort (n log n)
    • bubble sort n log n
  • graph search
    • DFS
    • BFS
  • shortest path - Djikstra's algorithm