Skip to content

Instantly share code, notes, and snippets.

View jmcker's full-sized avatar

Jack McKernan jmcker

View GitHub Profile
#!/bin/bash/
git clone --bare https://github.com/jmcker/.cfg.git $HOME/.cfg
function cfg {
/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME $@
}
mkdir -p .cfg-backup
cfg checkout
@jmcker
jmcker / javascript-ajax-get.js
Last active July 15, 2018 23:11 — forked from john-doherty/javascript-http-get.js
Simple, pure JavaScript HTTP Get function (QML, IE8+, Chrome, Safari, Firefox, PhoneGap/Cordova)
/**
* GET contents of a URL
* @access private
* @param {string} url - url to get
* @param {function} error - function to call if there is an error
* @param {function} callback - function to call if success
* @returns {void}
*/
function httpGet(url, error, callback) {
@jmcker
jmcker / install-key.sh
Last active November 9, 2022 18:49
install-key - Generate, install, and manage SSH key rings
#!/bin/bash
RED='\033[0;31m'
YELLOW='\033[1;33m'
BLUE='\033[1;96m'
NC='\033[0m' # No color
GITHUB="false"
USERNAME=""
TARGETNAME=""
@jmcker
jmcker / cs-avail.sh
Last active January 17, 2019 23:38
Tool for viewing lab machine availability and active sessions.
#!/bin/bash
AUTO_LOGIN="true"
LIST_ALL="false"
VERBOSE="false"
USERNAME="${USER}"
TARGETNAME="xinu"
SEARCH_NAME=""
MIN_USER_COUNT=-1
@jmcker
jmcker / git-prot.sh
Last active April 2, 2019 22:11
Switch all remotes in a git repo from HTTP to SSH (and vice-versa) with a single command. (Doesn't work perfectly right now. Be careful)
#!/bin/bash
TO_HTTP="false"
BASE_HOST="github.com"
function help-text() {
echo "git-protocol-switcher (git-prot)"
echo " Switch all remotes in a git repo from HTTP to SSH (and vice-versa) with a single command."
echo " This assumes a host of https://github.com"
echo
@jmcker
jmcker / index.html
Last active May 11, 2019 09:33 — forked from jarek-foksa/index.html
Electron 5.x demo app that demonstrates how to enable ES modules support.
<!DOCTYPE html>
<html>
<head>
<base href="app://./" />
<meta http-equiv="Content-Security-Policy" content="script-src 'self' app:; object-src 'self' app:;">
<script type="module" src="./module.js"></script>
</head>
<body>
Check the console!
@jmcker
jmcker / netsh-profile-export.ps1
Last active September 30, 2023 15:27
Bulk import/export of Windows wireless network profiles.
netsh wlan export profile key=clear
@jmcker
jmcker / block-outside-dns.sh
Last active April 14, 2020 06:52
Touch ups for my massive collection of OpenVPN profiles
#!/bin/bash
backup_dir="backup-$(date +%Y-%m-%d_%H:%M:%S)"
mkdir -p "${backup_dir}"
cp *.ovpn "${backup_dir}"
for file in $(ls *.ovpn)
do
if ! cat "${file}" | grep "block-outside-dns" > /dev/null; then
echo "Adding 'block-outside-dns' to ${file}..."
@jmcker
jmcker / spin.sh
Created December 4, 2019 05:55
Simple bash spinner
function spin-wait() {
spin="/-\|"
echo -n "${1:-Press any key to continue...} "
while true
do
printf "\b${spin:i++%${#spin}:1}"
read -n 1 -t 0.25 noop
if [ "${?}" == "0" ]; then
break
@jmcker
jmcker / wiki.py
Last active April 10, 2020 07:21
Fetch the plain-text representation of any Wikipedia page.
#!/usr/bin/env python3
import sys
import urllib.parse
import requests
def get_article_text(page_titles):
'''
Fetch the plaintext for all of the given pages.