Skip to content

Instantly share code, notes, and snippets.

View hghmn's full-sized avatar

Nathan Hughes hghmn

View GitHub Profile
@hghmn
hghmn / README.md
Last active November 17, 2021 20:44

This is a test

@hghmn
hghmn / README.md
Created May 28, 2021 18:02
Overriding `require(...)` behavior in node to block specific modules

Overriding require(...)

NOTE: this is terrible advice, and shouldn't be used. This is purely educational to warn our youth about the dangers of trusting computers.

Sometime as node.js developer, you may find yourself in an unfortunate position where you inherit a codebase that is set up in such a way that npm resolves packages through module hoisting.

Example

@hghmn
hghmn / IDEA.md
Created April 17, 2020 16:10
Grep

A tool to grep files for a specific pattern - primarily to be used for tracking TODO/FIXME in a codebase

@hghmn
hghmn / README.md
Created April 10, 2020 16:17
IP Camera Webcam
@hghmn
hghmn / Dockerfile
Created February 20, 2020 17:29
init image for docker
FROM alpine
# Setup base image
RUN apk add --update bash && rm -rf /var/cache/apk/*
# Add entrypoint
COPY docker-entrypoint.sh /docker-entrypoint.sh
# Copy in binaries to use, and ensure they are executable
ONBUILD COPY bin/* /usr/local/bin
@hghmn
hghmn / voice-memo.sh
Created October 18, 2017 16:24
cli helper for voice memos (macOS)
#!/bin/bash
# Inspired by https://gist.github.com/shariat/0541913b220ca09571102a8cd165916c
memos_dir="$HOME/memos"
if [ ! -d "$memos_dir" ]; then
mkdir -p $memos_dir;
fi
@hghmn
hghmn / journal.sh
Created October 18, 2017 16:24
cli helper for note taking
#!/bin/bash
# Inspired by the comment in https://news.ycombinator.com/item?id=15473702#15475352
journal_dir="$HOME/journal"
year_folder="${journal_dir}/$(date +%Y)/"
if [ ! -d "$year_folder" ]; then
mkdir -p $year_folder;
fi
@hghmn
hghmn / editor.html
Created March 30, 2017 14:56
Resx Editor
<!DOCTYPE html>
<html>
<head>
<title>Resx Editor</title>
</head>
<body>
<div class="app">
<input id="file-input" type="file">
<hr>
<table id="resx-table">
@hghmn
hghmn / array-funcs.js
Created February 27, 2017 05:59
js snippets
function flatten(/*args*/) {
return [].concat.apply([], [].slice.call(arguments));
}