Skip to content

Instantly share code, notes, and snippets.

View michaelmcdonald's full-sized avatar

Michael McDonald michaelmcdonald

  • Facility for Rare Isotope Beams
  • Lansing, MI
  • 01:45 (UTC -04:00)
View GitHub Profile
@ShvaykaD
ShvaykaD / upgrade-postgresql-service-ubuntu.md
Last active July 3, 2023 22:17 — forked from delameko/upgrade-postgres-9.5-to-9.6.md
Upgrading PostgreSQL service from 9.x or 10.x to 11 version on Ubuntu server

TL;DR

Create a backup:

sudo -Hiu postgres pg_dumpall > mybackup.sql

Install Postgres 11, and then:

@snmishra
snmishra / switcher.ahk
Created September 13, 2019 15:09
Switch windows by process name using Alt+` and S
; Based on https://superuser.com/a/768060/542406
!`:: ; Next window
WinGet, ActiveProcessName, ProcessName, A
WinGet, WinClassCount, Count, ahk_exe %ActiveProcessName%
IF WinClassCount = 1
Return
Else
WinSet, Bottom,, A
WinActivate, ahk_exe %ActiveProcessName%
return
@ttscoff
ttscoff / sizes.rb
Last active July 12, 2021 03:33
sizes: Calculate and sort all filesizes for current folder
#!/usr/bin/env ruby
# Sizes - Calculate and sort all filesizes for current folder Includes
# directory sizes, colorized output Brett Terpstra 2019 WTF License
VERSION = "1.0.1"
require 'shellwords'
# Just including term-ansicolor by @flori and avoiding all the
# rigamarole of requiring multiple files when it's not a gem... - Brett
#
@mrinalwadhwa
mrinalwadhwa / GetBinaryState (0 is OFF, 1 is ON)
Last active October 16, 2021 20:51
curl wemo connected switch
curl -0 -v -X POST http://wemo:49153/upnp/control/basicevent1 -H 'SOAPACTION: "urn:Belkin:service:basicevent:1#GetBinaryState"' -H 'Content-Type: text/xml; charset=utf-8' -d @- << EOF
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<u:GetBinaryState xmlns:u="urn:Belkin:service:basicevent:1" />
</s:Body>
</s:Envelope>
EOF
@majora2007
majora2007 / removeNonEnglish.py
Last active February 1, 2024 20:26
Remove foreign language audio and subtitle tracks from mkv files in bulk
#!/usr/bin/python
# Removes non-LANG audio tracks and subtitles from mkv files in a directory.
# Original script by greenbender at https://forum.videohelp.com/threads/343271-BULK-remove-non-English-tracks-from-MKV-container
# Modified by Joseph Milazzo for updated MkvMerge commands.
# 12/3/2021: Updated to Python 3.9
import os
import re
import sys
@onedr0p
onedr0p / transmission-gc.sh
Last active October 21, 2023 19:04
Transmission Garbage Collector
#!/bin/sh
#
# INFO
#
# This works if sonarr and radarr are set up to have a Category of sonarr and radarr respectively
# If you are using other Categories to save your automated downloads, update the script where you see:
# "radarr"|"sonarr")
# This script will not touch anything outside those Categories
@vista-
vista- / .chromatermrc
Last active October 5, 2019 15:18
A fully-loaded configuration for highlighting Cisco keywords for Chromaterm (Linux)
#config regex on
#event {SESSION DISCONNECTED} {#end}
#highlight {{^([^$#(]+)(\$|#|\([^)]+\)#)}} {bold white}
#highlight {{(?:[\W\s]|^)([0-9a-f]{4}\.){2}[0-9a-f]{4}(?=[\W\s]|$)}} {bold light jade}
#highlight {{(?:[\W\s]|^)((::FFFF)?::?(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9]))(?=[\W\s]|$)}} {bold cyan}
#highlight {{(?:[\W\s]|^)(\[\d{1,10}:\d{1,10}\](?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}|(?=(?:[0-9A-Fa-f]{0,4}:){0,7}[0-9A-Fa-f]{0,4}(?![:.\w]))(([0-9A-Fa-f]{1,4}:){1,7}|:)((:[0-9A-Fa-f]{1,4}){1,7}|:)|(?:[0-9A-Fa-f]{1,4}:){7}:|:(:[0-9A-Fa-f]{1,4}){7})(?![:.\w]))(?=[\W\s]|$)}} {bold cyan}
#highlight {{(?:[\W\s]|^)(\[\d{1,3}(\.\d{1,3}){3}:\d{1,10}\](?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}|(?=(?:[0-9A-Fa-f]{0,4}:){0,7}[0-9A-Fa-f]{0,4}(?![:.\w]))(([0-9A-Fa-f]{1,4}:){1,7}|:)((:[0-9A-Fa-f]{1,4}){1,7}|:)|(?:[0-9A-Fa-f]{1,4}:){7}:|:(:[0-9A-Fa-f]{1,4}){7})(?![:.\w]))(?=[\W\s]|$)}} {bold cyan}
#highlight {{(?:[\W\s]|^)((\d{1,10}:){2}(?:(?:25[0-5]|2[0-4]
@lacostenycoder
lacostenycoder / README.md
Last active November 2, 2023 17:18
Ruby script to toggle night-mode hack on Slack Desktop app - Mac only, maybe linux

- IMPORTANT

For security, since this script injects CSS via AJAX, first fork the main slack night mode repo. The reason is explained here

UPDATE: The code has been modified to download the remote css to a local file and use ruby sass compiler to verify there is no malicious code in the remote css. This will error if the code has been modified to include anything malicious (i.e. script or img tags etc.) It's also been refactored to use the local file inside the js injection, it makes sure it's safe first in the very unlikely event the local file somehow differs from the remote css. The chances of this happening are remote, but this should suffice for safety.

Installation

  • save this script wherever you keep your ruby scripts for example ~/lacostenycoder/scripts/ruby/
  • change the URL in the remote_repo variable in ruby script to use YOUR repo. The rawgit.com file is crea
@roycewilliams
roycewilliams / same-quad-list.txt
Last active March 21, 2024 07:03
same-quad-list.txt: a list of same-quad IPs by owner, with DNS status
#-----------------------------------------------------------------------
# same-quad-list.txt: a list of same-quad IPs by owner w/DNS status
#
# The CIDR network is the largest contiguous/bit-boundary-aligned block
# that is allocated to that entity (actual allocated range may be larger)
# NOTE: some ranges not yet converted to CIDR.
# Updates welcome - leave comment and/or ping royce@techsolvency.com
#-----------------------------------------------------------------------
# For human efficiency, some records are repeated here as comments.
#
@bmaddy
bmaddy / csd-responder-exec.sh
Last active June 15, 2021 09:18
Connecting to Cisco's AnyConnect SSL VPN on MacOS (bypassing the EOL'd Cisco Secure Desktop)
Moved to https://github.com/bmaddy/csd-vpn/blob/master/csd-responder-exec.sh