Skip to content

Instantly share code, notes, and snippets.

View brandonb927's full-sized avatar

Brandon Brown brandonb927

View GitHub Profile
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active March 27, 2024 06:33
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@brandonb927
brandonb927 / meta-tags.md
Last active February 21, 2024 11:41 — forked from kevinSuttle/meta-tags.md
List of Usable HTML Meta and Link Tags
@brandonb927
brandonb927 / template.pkr.hcl
Created March 23, 2021 16:36
A "truly noninteractive" Ubuntu-based Packer HCL template for dist-upgrade
build {
# ...
provisioner "shell" {
inline = [
"echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections",
"sudo apt-get update",
"sudo apt-get dist-upgrade -o Dpkg::Options::=--force-confold -o Dpkg::Options::=--force-confdef -y --allow-downgrades --allow-remove-essential --allow-change-held-packages",
"sudo apt-get autoremove -y",
"sudo apt-get clean",
{
"meta": {
"theme": "classy"
},
"basics": {
"firstName": "Brandon",
"lastName": "Brown",
"name": "Brandon Brown",
"email": "resume@brandonb.ca",
"phone": "",
@brandonb927
brandonb927 / index.js
Last active June 28, 2022 18:05
Cypress + Typescript ts-loader option `transpileOnly` config helps with memory-contrained machines if you're not running in the Cypress Dashboard but rather using custom Jenkins CI, etc.
module.exports = (on, config) => {
// ...
const wpOptions = webpack.defaultOptions
wpOptions.webpackOptions.resolve = {
extensions: ['.ts', '.js'],
}
wpOptions.webpackOptions.module.rules.push({
test: /\.ts$/,
exclude: [/node_modules/],
@brandonb927
brandonb927 / raspi-motd.sh
Created December 8, 2012 20:47 — forked from piksel/raspi-motd.sh
Script for setting a nice raspberry pi logo as MOTD on debian.
#!/bin/bash
logo="$(tput setaf 2)
.~~. .~~.
'. \ ' ' / .'$(tput setaf 1)
.~ .~~~..~. $(tput sgr0) _ _ $(tput setaf 1)
: .~.'~'.~. : $(tput sgr0) ___ ___ ___ ___| |_ ___ ___ ___ _ _ ___|_|$(tput setaf 1)
~ ( ) ( ) ~ $(tput sgr0) | _| .'|_ -| . | . | -_| _| _| | | | . | |$(tput setaf 1)
( : '~'.~.'~' : ) $(tput sgr0) |_| |__,|___| _|___|___|_| |_| |_ | | _|_|$(tput setaf 1)
~ .~ ( ) ~. ~ $(tput sgr0) |_| |___| |_| $(tput setaf 1)
@brandonb927
brandonb927 / gist:9587436
Created March 16, 2014 18:13
Simple JSON database with Node.JS

From: http://run-node.com/littlest-database-that-could/

I've written numerous tiny databases. They don't have much features, but they don't need much features. Usually I'm looking for fast simple key/value stores and Node never disappoints. The point here is, why abstract key value store when JS gives us one for free, as it's most basic component: object.

Will it meet every need? No. But it will meet ALOT of scenarios.

In memory JS object lookups, were talking hundreds of thousands of lookups (you'll easily flood http before the db), and save hundreds of thousands of records in a JSON file written to disk. Not a 200ms r/t to some hosted Redis. Hey, that's fine if that's your thing.

Here's the requirements:

#!/bin/bash
# This script will delete *all* local and remote tags from any git repo you run
# it in, unless they are a major branch, or the most previous minor branches.
# If 1.4.3 is the latest patch/hotfix branch, all 1.*.* branchs will be deleted,
# but all major/minor releases will be left
#
# This script will not delete branches; just tags.
set -e
@brandonb927
brandonb927 / ErrorHandler.js
Last active February 22, 2022 01:26 — forked from mikevalstar/ErrorHandler.js
Modified again to use Handlebars template instead of Jade
/**
* Modified from the Connect project: https://github.com/senchalabs/connect/blob/master/lib/middleware/errorHandler.js
*
* Flexible error handler, providing (_optional_) stack traces and logging
* and error message responses for requests accepting text, html, or json.
*
* Options:
*
* - `showStack` respond with both the error message and stack trace. Defaults to `false`
* - `showMessage`, respond with the exception message only. Defaults to `false`
@brandonb927
brandonb927 / dropbox
Last active February 22, 2022 01:25
Dropbox init.d script for Ubuntu 14.04 Server LTS - Dropbox has (recently) changed the CLI daemon from `dropbox` to `dropboxd`.
#!/bin/sh
# Usernames who will be using the Dropbox service
DROPBOX_USERS="username"
DAEMON=.dropbox-dist/dropboxd
start() {
echo "Starting dropbox..."
for dbuser in $DROPBOX_USERS; do