Skip to content

Instantly share code, notes, and snippets.

@ajorpheus
ajorpheus / google_redirect_remove.user.js
Last active January 21, 2024 09:44 — forked from PolarBearGG/google_redirect_remove.js
Userscript to remove URL redirection from google sites
// ==UserScript==
// @name Google Redirect Remove
// @id google_redirect_remove
// @namespace scripts.zachbrowne.com
// @description Remove URL redirection from google sites
// @license GPL v3
// @include *://www.google.*/*q=*
// @include *://www.google.*/*tbs=*
// @include *://www.google.*/search?*
// @include *://www.google.*/webhp?*
@ajorpheus
ajorpheus / teachable-toggle-sidebar.user.js
Last active October 24, 2023 21:25
Keyboard Shortcut and Button to hide sidebar on Teachable websites
// ==UserScript==
// @name Teachable Toggleable Sidebar
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Get more screen video realstate by toggling the course outline sidebar
// @author ajorpheus
// @match https://learn.cantrill.io/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=cantrill.io
// @require http://code.jquery.com/jquery-3.1.1.slim.min.js
// @require https://gist.githubusercontent.com/BrockA/2625891/raw/waitForKeyElements.js
@ajorpheus
ajorpheus / shell-setup.ps1
Created June 20, 2023 07:59 — forked from mikepruett3/shell-setup.ps1
Packages to install via scoop, winget, choco, and other tools...
<#
.SYNOPSIS
Script to Initialize my custom powershell setup.
.DESCRIPTION
Script uses scoop
.NOTES
**NOTE** Will configure the Execution Policy for the "CurrentUser" to Unrestricted.
Author: Mike Pruett
Date: October 18th, 2018
@ajorpheus
ajorpheus / query-sparsebundle-band-size.sh
Created May 17, 2023 11:02 — forked from sansumbrella/query-sparsebundle-band-size.sh
Query band size of a sparsebundle (also accessible in Info.plist of bundle)
# find out how big the sparse-band-size is in a mounted volume
hdiutil info -verbose | grep band-size
# default Time Machine sparsbundle virtual-band-size = 16384 (8MB)
# create-sparsebundle's virtual-band-size = 262144 (128MB)
@ajorpheus
ajorpheus / jq-case-insensitive.md
Last active May 11, 2023 15:02
JQ: Case-insensitive search for keys containing string

Search for keys in JSON at any level containing the supplied string and strips out any empty results

cat some-json |  jq -c '.. | objects | with_entries(select(.key |match("SEARCH-STRING";"i"))) | select(. != {})'

For instance, to list any keys that contain the word public from a list of AWS instances :

aws ec2 describe-instances --output json | jq -c '.. | objects | with_entries(select(.key |match("public";"i"))) | select(. != {})'
@ajorpheus
ajorpheus / temp
Created March 16, 2023 11:16
Temp
Add-Type -TypeDefinition @'
using System.Runtime.InteropServices;
[Guid("5CDF2C82-841E-4546-9722-0CF74078229A"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
interface IAudioEndpointVolume
{
// f(), g(), ... are unused COM method slots. Define these if you care
int f(); int g(); int h(); int i();
int SetMasterVolumeLevelScalar(float fLevel, System.Guid pguidEventContext);
int j();
int GetMasterVolumeLevelScalar(out float pfLevel);
@ajorpheus
ajorpheus / cwl_insights_parse_regex.sh
Created February 22, 2023 17:34 — forked from vatshat/cwl_insights_parse_regex.sh
An example of how to use regex in the parse statement of a CloudWatch Insights query
#!/usr/bin/env bash
query_string=$(cat << EndOfMessage
fields @timestamp, @logStream, headers.X-Amzn-Trace-Id, @transId, @message
| parse @message /(transactionId:[ ]?)(?<@transId>[a-zA-Z0-9]+)/
| filter @transId = a4c475516be5445a87fbb81bb7a4b365
EndOfMessage
) \
&& \
query_id=`aws logs start-query --log-group-name /aws/lambda/console_log \
@ajorpheus
ajorpheus / encrypt.txt
Created February 10, 2023 15:34 — forked from phrfpeixoto/encrypt.txt
Using SSH public key to encrypt a file or string
# Recently I had to send a password to someone over Skype. Since that's obviously not a good idea, I asked for
# the person's public SSH RSA key, and used it to encrypt the password itself.
# Convert the public key into PEM format
ssh-keygen -f path/to/id_rsa.pub -e -m pem > ~/id_rsa.pub.pem
# Using the public pem file to encrypt a string
echo "sometext" | openssl rsautl -encrypt -pubin -inkey ~/id_rsa.pub.pem > ~/encrypted.txt
@ajorpheus
ajorpheus / 1-setup.md
Created February 1, 2023 11:02 — forked from troyfontaine/1-setup.md
Signing your Git Commits using GPG on MacOS

Methods of Signing with a GPG Key on MacOS

Last updated September 21, 2022

This Gist explains how to do this using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.

There has been a number of comments on this gist regarding some issues around the pinentry-program and M1 Macs. I've finally gotten a chance to try things out on an M1 and I've updated the documentation in 2-using-gpg.md to reflect my findings.

@ajorpheus
ajorpheus / aws_env
Created January 12, 2023 13:40 — forked from mjul/aws_env
Get environment variables from AWS profile (for use with docker-machine)
#!/bin/sh
# Set the AWS environment variables for an AWS profile
# Useful for docker-machine
#
# Example:
#
# aws_env profile-for-testing
#
# Further information:
# See the AWS CLI `aws configure`