Skip to content

Instantly share code, notes, and snippets.

View mgwalker's full-sized avatar

Greg Walker mgwalker

View GitHub Profile
@mgwalker
mgwalker / gh-admins.md
Created March 29, 2023 17:44
Get a list of GitHub repo admins

List GitHub repo admins

This assumes you have GitHub CLI and jq installed. To get a list of admins on a repo, you can run this:

gh api --paginate repos/{{ OWNER }}/{{ REPO }}/collaborators | jq '[ .[] | select(.permissions.admin == true) | .login ]'
@mgwalker
mgwalker / Block Mastodon instances.md
Created December 26, 2022 20:22
Block lots of Mastodon instances, quickly

If you're a Mastodon moderator looking to quickly suspend a bunch of other instances from federation, here's some code that'll let you do it as a batch. It requires interating with your browser's Javascript console.

  1. Open your web browser to your Mastodon instance and log in
  2. Open your browser's Javascript console.
    • Safari: command-option-c
    • Firefox: command-option-k
    • Chrome: command-option-j
  3. Copy block.js below, edit lines 5 and 27 to point to your own instance (replace [your-instance-domain]), and then paste that into the console and press enter. (There should be an input box at the bottom of the console window.)
    • You can also edit line 22 if you want to add an internal-only message about why the domains are being blocked. If you don't want a message, change line 22 to just "".
  4. Turn your list of domains to block into a JSON array
@mgwalker
mgwalker / README.md
Last active March 29, 2023 17:49
Hide the Firefox chrome

Hiding Firefox browser chrome

To hide all of the browser chrome in Firefox, you will need to use the browser console, which is similar to the web console but applies to the whole browser. By default, the browser console is readonly. To enable interpretted commands, you'll need to edit the browser config:

  • navigate to about:config
  • find devtools.chrome.enabled
  • set it to true
@mgwalker
mgwalker / Dockerfile
Created December 15, 2020 15:44
ora2pg dockerfile
FROM ubuntu
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
alien \
git \
libdbi-perl \
wget \
&& rm -rf /var/lib/apt/lists/*
RUN wget https://download.oracle.com/otn_software/linux/instantclient/211000/oracle-instantclient-basic-21.1.0.0.0-1.x86_64.rpm
@mgwalker
mgwalker / script.sh
Created November 14, 2019 19:02
PostgreSQL dumps into DOT files or PNGs
docker exec <database image> pg_dump -s -U <database username> <database name> | \
# Strip out the namespace because graphviz doesn't know what to do with it
sed 's/ public\./ /g' | \
# Turn that thing into a DOTfile!
docker run -i --rm mgwalker/sql_graphviz:1.0 > docs/database-diagram.dot
docker exec <database image> pg_dump -s -U <database username> <database name> | \
# Strip out the namespace because sql_graphviz doesn't know what to do with it
sed 's/ public\./ /g' | \
# Turn that thing into a DOTfile
@mgwalker
mgwalker / script.sh
Created November 14, 2019 18:48
Cleanup white noise in a transparent gif
docker run -i --rm -v \
`pwd`:/img \
v4tech/imagemagick \
convert \
/img/your-current-emoji-filename.gif \
-white-threshold 95% \
-transparent white \
/img/your-new-emoji.gif
; Written: Fall 2003
; Location: Mississippi State University
; For: ECE 4532, CPE Design I
; Instructor: Dr. Joe Picone
;
; Description: Converts analog signals from fiber
; optic dataglove into digital signals and
; communicates the digital information to a PC
; over a RS232 (serial port) link. The code
; assumes a 14.7456MHz clock.
@mgwalker
mgwalker / Building.md
Created November 29, 2016 15:34
FIPS-mode OpenSSL and Postgres

Postgres with FIPS OpenSSL

1. Build the OpenSSL FIPS module

  • Obtain the OpenSSL FIPS module 2.0 source from the OpenSSL source download page

     wget https://www.openssl.org/source/openssl-fips-2.0.13.tar.gz
     tar -zxvf openssl-fips-2.0.13.tar.gz
     cd openssl-fips-2.0.13.tar.gz