Skip to content

Instantly share code, notes, and snippets.

View brandonsturgeon's full-sized avatar
🙄

Brandon Sturgeon brandonsturgeon

🙄
View GitHub Profile
@brandonsturgeon
brandonsturgeon / _GitForceRewriter.md
Last active December 9, 2021 03:36
Git CLI: Automatically rewrite --force to --force-with-lease

Intro

Do you rebase often? Ever forget to --force on your subsequent push? This annoyance and impatience could tempt you into making a new alias, like:

git config --global alias.pushf 'push --force'

Yes, this will save you time. But will it save you headache? Maybe not.

--force is a destructive command by definition. It changes history.

local RED = Color(255, 0, 0, 235)
local BLUE = Color(0, 0, 255, 235)
local WHITE = Color(255, 255, 255, 230)
local beamColor = RED
local beams = {}
local claws = ents.FindByClass("npc_clawscanner")
local Sounds = {
@brandonsturgeon
brandonsturgeon / bis.md
Last active January 29, 2024 20:15
World of Warcraft 3.3.5a Warmane Complete PvE BiS (Best In Slot) List
@cyphar
cyphar / how-to-pgp-release.md
Last active September 2, 2023 02:44
Document describing how to create PGP-signed releases of projects.

Creating Releases with PGP Signatures

Aleksa Sarai

Creating a release of a free software project with PGP signatures is quite simple, especially if you have everything set up already. This guide uses GnuPG, but it should be roughly applicable to OpenPGP or other implementations. For completeness, I've included a (very) short introduction to how to create a PGP key and how PGP works.

Introduction

@perryqh
perryqh / 1-g5-hub-api.json
Last active February 27, 2017 19:44
Cross CMS Page Copy
// GET /api/v1/cmss (better name needed)
{ "cmss": [
{"client_name": "Cody's Adventure Time",
"site_url": "https://g5-cms-iwmpeigo-cody-test-cms.herokuapp.com"
},
{"client_name": "Another Client",
"site_url": "https://g5-cms-iwmpeigo-another-client.herokuapp.com"
},
]}
@paulirish
paulirish / server-timing-demo.js
Last active January 14, 2024 13:22
Demo of server timing values. visualized in chrome devtools
// see for screenshot:
// https://twitter.com/paul_irish/status/829090506084749312
const http = require('http');
function requestHandler(request, response) {
const headers = {
'Server-Timing': `
sql-1;desc="MySQL lookup Server";dur=100,
sql-2;dur=900;desc="MySQL shard Server #1",
@steinwaywhw
steinwaywhw / One Liner to Download the Latest Release from Github Repo.md
Last active April 14, 2024 15:39
One Liner to Download the Latest Release from Github Repo
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

@bradp
bradp / setup.sh
Last active April 19, 2024 05:21
New Mac Setup Script
echo "Creating an SSH key for you..."
ssh-keygen -t rsa
echo "Please add this public key to Github \n"
echo "https://github.com/account/ssh \n"
read -p "Press [Enter] key after this..."
echo "Installing xcode-stuff"
xcode-select --install
@mwhite
mwhite / git-aliases.md
Last active April 22, 2024 09:22
The Ultimate Git Alias Setup

The Ultimate Git Alias Setup

If you use git on the command-line, you'll eventually find yourself wanting aliases for your most commonly-used commands. It's incredibly useful to be able to explore your repos with only a few keystrokes that eventually get hardcoded into muscle memory.

Some people don't add aliases because they don't want to have to adjust to not having them on a remote server. Personally, I find that having aliases doesn't mean I that forget the underlying commands, and aliases provide such a massive improvement to my workflow that it would be crazy not to have them.

The simplest way to add an alias for a specific git command is to use a standard bash alias.

# .bashrc