Skip to content

Instantly share code, notes, and snippets.

View mathew-fleisch's full-sized avatar

Mathew Fleisch mathew-fleisch

View GitHub Profile
@mathew-fleisch
mathew-fleisch / parse-log.sh
Created January 9, 2020 19:09
parse log to csv
# Provided Input:
# logs = """
# timestamp="Wed Jun 19 09:35:36 PDT 2019" message="test 10" id=10 field_1="test 10" field_6="test 1"
# timestamp="Wed Jun 19 09:35:37 PDT 2019" message="test 4" id=4 field_2="test 4"
# timestamp="Wed Jun 19 09:35:38 PDT 2019" message="test 2" id=3 field_3="test 2" field_9="test 23"
# timestamp="Wed Jun 19 09:35:39 PDT 2019" message="test 3" id=2 field_4="test 3"
# timestamp="Wed Jun 19 09:35:40 PDT 2019" message="test 4" id=1 field_5="test 4"
# timestamp="Wed Jun 19 09:35:37 PDT 2019" message="test 5" id=5 field_3="test 10"
# timestamp="Wed Jun 19 09:35:40 PDT 2019" message="test 6" id=6 field_1="test 5"
@mathew-fleisch
mathew-fleisch / kanban.sh
Last active January 22, 2020 16:14
KANBAN
#!/bin/bash
# Uses docker to set up a local kan-ban board. db.sqlite
# lives in the container, and must be mounted locally to
# persist passed the container terminating. Also assumes
# that there are no running docker containers.
# https://docs.kanboard.org/en/latest/index.html
mkdir -p kanban
cd kanban
@mathew-fleisch
mathew-fleisch / game-of-life.js
Last active October 16, 2019 18:17
Conways Game of Life
/**
*
* Conway's Game of Life
* 1. If a live cell has less than 2 live neighbors, it dies. *
* 2. If a live cell has more than 3 live neighbors, it dies. *
* 3. If a live cell has exactly 2-3 live neighbors, it lives. *
* 4. If a dead cell has exactly 3 live neighbors, it comes to life. *
* 0 == DEAD
* 1 == ALIVE
# Standard
*/5 * * * * cd /path/to/repo && git pull origin master
# Overwrite all changes with master
*/5 * * * * cd /path/to/repo && git fetch --all && git reset --hard origin/master
# Pull changes, but persist local changes (i.e. config that is not checked into repo)
*/5 * * * * cd /path/to/repo && git stash && git pull origin master && git stash pop
# Standard
*/5 * * * * cd /path/to/repo && git pull origin master
# Overwrite all changes with master
*/5 * * * * cd /path/to/repo && git fetch --all && git reset --hard origin/master
# Pull changes, but persist local changes (i.e. config that is not checked into repo)
*/5 * * * * cd /path/to/repo && git stash && git pull origin master && git stash pop
@mathew-fleisch
mathew-fleisch / index.js
Last active November 15, 2018 15:39
sequence thing
'use strict';
var echoPort = '/dev/pts/3';
var track = '';
var _require = require('child_process'),
spawn = _require.spawn,
exec = _require.exec;
var child = spawn('./dejarik');