Skip to content

Instantly share code, notes, and snippets.

@ssstonebraker
ssstonebraker / sed cheatsheet
Created August 2, 2013 14:06 — forked from un33k/sed cheatsheet
Sed Cheatsheet
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
@aras-p
aras-p / preprocessor_fun.h
Last active December 26, 2025 00:20
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@grenade
grenade / 01-generate-ed25519-ssh-key.sh
Last active January 12, 2026 09:58
generate ed25519 ssh and gpg/pgp keys and set file permissions for ssh keys and config
#!/bin/bash
mkdir -p ~/.ssh
# generate new personal ed25519 ssh keys
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "rob thijssen <[email protected]>"
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_robtn -C "rob thijssen <[email protected]>"
# generate new host cert authority (host_ca) ed25519 ssh key
# used for signing host keys and creating host certs
@ondrek
ondrek / express.js
Last active October 22, 2019 15:33
How structure big nodejs express application
---------------------------------------------------
Sample of Structure
/express.js
/views/javascript/jquery.js
/views/javascript/mootools.js
/views/stylesheets/resets.css
/views/stylesheets/globals.css
@tueda
tueda / gist+x.sh
Last active May 23, 2020 12:37
A script to give executable file permissions to files in a Gist.
#! /bin/sh
#
# @file gist+x.sh
#
# Gives executable file permissions to files in a Gist.
#
set -e
prog=`basename "$0"`
# Command line options.
@chrismccoy
chrismccoy / gitcheats.txt
Last active January 13, 2026 20:09
git cheats
# alias to edit commit messages without using rebase interactive
# example: git reword commithash message
reword = "!f() {\n GIT_SEQUENCE_EDITOR=\"sed -i 1s/^pick/reword/\" GIT_EDITOR=\"printf \\\"%s\\n\\\" \\\"$2\\\" >\" git rebase -i \"$1^\";\n git push -f;\n}; f"
# delete all repos in an org
gh repo list YOUR_ORG_NAME --limit 4000 --json nameWithOwner --jq '.[].nameWithOwner' | xargs -I {} gh repo delete {} --yes
# delete all forks in an org
gh repo list YOUR_ORG_NAME --limit 4000 --json nameWithOwner,isFork --jq '.[] | select(.isFork) | .nameWithOwner' | xargs -I {} gh repo delete {} --yes
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active January 14, 2026 12:03
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@telent
telent / gist:9742059
Last active January 9, 2026 12:09
12 factor app configuration vs leaking environment variables
App configuration in environment variables: for and against
For (some of these as per the 12 factor principles)
1) they are are easy to change between deploys without changing any code
2) unlike config files, there is little chance of them being checked
into the code repo accidentally
3) unlike custom config files, or other config mechanisms such as Java
@acgetchell
acgetchell / brew-cask-uninstall-3
Last active June 5, 2021 15:58
Uninstalling then reinstalling
┌─[getchell][Hapkido][~]
└─▪ brew install brew-cask
==> Cloning https://github.com/phinze/homebrew-cask.git
Updating /Library/Caches/Homebrew/brew-cask--git
==> Checking out tag v0.32.0
🍺 /usr/local/Cellar/brew-cask/0.32.0: 1438 files, 5.7M, built in 2 seconds
┌─[getchell][Hapkido][~]
└─▪ brew cask list
alfred firefox macfusion skype textmate virtualbox
anki github menumeters steam torbrowserbundle xquartz
@ixisio
ixisio / README.md
Last active September 7, 2019 14:32
The LEBRON stack