Skip to content

Instantly share code, notes, and snippets.

View SeedyROM's full-sized avatar
🚂
Coding Time

Zack Kollar SeedyROM

🚂
Coding Time
View GitHub Profile
@SeedyROM
SeedyROM / .shortcutsrc
Created August 10, 2019 03:05
Shortcuts for my Linux Box
# General Shortcuts
alias wifi="wicd-curses"
alias connections="sudo iftop -i wlp4s0"
alias restart-network="sudo service network-manager restart"
alias work="cd ~/Workspace"
alias dc="docker-compose"
# Mistake Shortcuts
alias gti="git"
@SeedyROM
SeedyROM / .shortcutsrc
Created August 10, 2019 03:05
Shortcuts for my Linux Box
# General Shortcuts
alias wifi="wicd-curses"
alias connections="sudo iftop -i wlp4s0"
alias restart-network="sudo service network-manager restart"
alias work="cd ~/Workspace"
alias dc="docker-compose"
# Mistake Shortcuts
alias gti="git"
@SeedyROM
SeedyROM / store.js
Created September 27, 2019 08:35
A simple recreation of a SUPER basic redux store.
class Store {
constructor(reducer) {
const [state, dispatch] = reducer;
this.state = Object.freeze(state);
this._dispatch = dispatch;
this._effectFunc = null;
}
dispatch(action) {
const prevState = Object.freeze({ ...this.state });
@SeedyROM
SeedyROM / useDidUpdate.ts
Created September 29, 2019 09:31
React hook to handle if an effect updated.
const useDidUpdate = () => {
const isNotMounted = useRef(true);
useEffect(() => {
if (isNotMounted.current) {
isNotMounted.current = false;
}
});
return !isNotMounted.current;
};
byte incomingBytes[32];
byte powerOn[] = {0x6, 0x01, 0x00, 0x19, 0x02, 0x1C};
byte powerOff[] = {0x6, 0x01, 0x00, 0x19, 0x01, 0x1F};
void setup() {
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
}
@SeedyROM
SeedyROM / injector.cr
Created December 16, 2019 19:20
Crystal Dependency Injector
# A simple DSL for createing dependency injected modules/classes.
module Opaque::Injector
# Full DSL setup, this creates a module for dependencies dynamically.
#
# ```
# include Injector
#
# dependencies do
# dependency :logger, Logger.new(STDOUT, Logger::INFO)
# end
@SeedyROM
SeedyROM / dir-grep.sh
Created March 9, 2020 17:55
Grep Multiple Files and List Their Names
# The /dev/null forces grep to have multiple file names so it tricks the output into listing the files their names
grep ${REPLACE-ME} /dev/null *
@SeedyROM
SeedyROM / launch.json
Last active October 1, 2020 08:22
VSCode debugging with ts-node
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug",
"type": "pwa-node",
"request": "launch",
"runtimeExecutable": "node",
"runtimeArgs": ["--nolazy", "-r", "ts-node/register/transpile-only"],
"args": ["src/{{YOUR_ENTRYPOINT}}.ts"],
@SeedyROM
SeedyROM / launch.json
Created October 1, 2020 08:05
BackpackJS and VSCode Debugging Integration
{
"version": "0.2.0",
"configurations": [
{
"type": "pwa-node", // This is important otherwise the paths and arguments all don't work
"request": "launch",
"name": "Debug {{YOUR_SERVICE}}",
"program": "${workspaceFolder}/node_modules/backpack-core/bin/backpack",
"args": ["dev", "|", "pino-pretty", "-c"], // Last two argument are optional, I use pino at work for logging
// Also pipe our logs into pino-pretty -c for nicer outputs
// -------------------------------------------------------------------------------------------------------------------
import BigNumber from 'bignumber.js';
import { logger, Postgres } from 'node-common';
import { BlockRaw } from '../../types';
import { isContinousSequence, normalizeBlockchainId, normalizeTimestamp } from '../../helpers';
import groupBy from 'lodash/groupBy';
import uniqBy from 'lodash/uniqBy';
import { createKafkaOptions } from '../baseConsumer';