Skip to content

Instantly share code, notes, and snippets.

View ajsharp's full-sized avatar

Alex Sharp ajsharp

View GitHub Profile
DO NOT GIVE ME HIGH LEVEL SHIT, IF I ASK FOR FIX OR EXPLANATION, I WANT ACTUAL CODE OR EXPLANATION!!! I DON'T WANT "Here's how you can blablabla"
- Be casual unless otherwise specified
- Be terse
- Suggest solutions that I didn't think about—anticipate my needs
- Treat me as an expert
- Be accurate and thorough
- Give the answer immediately. Provide detailed explanations and restate my query in your own words if necessary after giving the answer
- Value good arguments over authorities, the source is irrelevant
- Consider new technologies and contrarian ideas, not just the conventional wisdom
Write short commit messages:
- The first line should be a short summary of the changes
- Remember to mention the files that were changed, and what was changed
- Explain the 'why' behind changes
- Use bullet points for multiple changes, but never for the first line
- Tone: Be short, concise, and to the point. Use emojis only where descriptive.
- If there are no changes, or the input is blank - then return a blank string
- Don't mention "the commit" -- just describe the changes
- Output the commit message as plain text, not wrapped in any formatting, code fences, or other formatting
@ajsharp
ajsharp / migrate-route53-dns
Last active July 3, 2023 18:35
This script makes it very easy to migrate an entire DNS zone from one AWS Route53 zone to another. This script expects you to have downloaded the old zone file via the AWS CLI to a json file called DOMAIN.zone.json. It uses the AWS CLI to perform the request, so make sure that your credentials are properly configured.
#!/usr/bin/env ruby
require 'json'
# This is the json output of the old zone, fetched using the AWS CLI.
zone = JSON.parse(File.read('DOMAIN.zone.json'))['ResourceRecordSets']
new_zone_id = 'NEW_ZONE_ID'
# We don't want to migrate the SOA and NS records from the old zone.
/*******************************************************************************
uBlock Origin - a browser extension to block requests.
Copyright (C) 2019-present Raymond Hill
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
@ajsharp
ajsharp / pg_dump
Last active September 19, 2021 17:35
pg_dump to dump an entire postgres database
pg_dump -a --format=c --no-owner --no-privileges --no-publications --no-subscriptions -d DBNAME -U USERNAME -W -h HOSTNAME -f dump.sql

Keybase proof

I hereby claim:

  • I am ajsharp on github.
  • I am ajsharp (https://keybase.io/ajsharp) on keybase.
  • I have a public key ASDmXBaCqAI8Sm3hHPFTCkaBuK_2dygQEavJKH_2qQriQQo

To claim this, I am signing this object:

@ajsharp
ajsharp / Makefile
Last active January 9, 2021 05:36
This Makefile exposes commands to do a manual deploy to AWS Elastic Beanstalk using the AWS CLI. Normally, you would do a deploy with the `eb` command, but using the AWS CLI is more convenient for orchestrating continuous deployment from a CI server.
VERSION=$(shell git rev-parse --short HEAD)
DESC=$(shell git log -1 --pretty=%B)
BUCKET_NAME="my-bucket"
PROJECT_NAME="my-project"
REGION="us-east-1"
ENV_NAME="elasticbeanstalk-environment-name"
archive:
git archive --format=zip -o $(VERSION).zip HEAD
{"lastUpload":"2020-07-14T23:27:42.748Z","extensionVersion":"v3.4.3"}
@ajsharp
ajsharp / init.lua
Created July 14, 2020 19:53
hammerspoon config
-- hs.hotkey.bind({'cmd', 'shift'}, 'q', function()
-- hs.eventtap.keyStroke({}, "`", 0)
-- -- hs.alert.show('hi')
-- end)
-- four item tuples:
-- fromMod, fromKey, toMod, toKey
KEYMAP = {
{{'cmd', 'shift'}, 'q', {}, '`'}, -- backtick shortcut
{{'cmd'}, 'escape', {'cmd'}, '`'}, -- cycle windows via cmd+esc
@ajsharp
ajsharp / migrate-eb-env
Created May 5, 2020 21:13
Migrate the environment variables from one elastic beanstalk environment to another
#!/usr/bin/env ruby
# Usage: migrate-eb-env FROM_ENV TO_ENV
from, to = ARGV
if !from || !to
$stderr.puts "FROM_ENV and TO_ENV are required"
exit(1)
end