Skip to content

Instantly share code, notes, and snippets.

@markcaudill
markcaudill / app-track.sh
Created June 22, 2019 19:55
Linux App Usage Tracker
#!/bin/sh
DATABASE=${HOME}/.app-track.db
touch "${DATABASE}" && chmod 0600 "${DATABASE}"
active_window_id() {
xprop -root _NET_ACTIVE_WINDOW | rev | cut -d' ' -f1 | rev
}
window_pid_by_id() {

WSL 2 Cisco AnyConnect Networking Workaround

Overview

WSL 2 uses a Hyper-V Virtual Network adapter. Network connectivity works without any issue when a VPN is not in use. However when a Cisco AnyConnect VPN session is established Firewall Rules and Routes are added which breaks connectivity within the WSL 2 VM. This issue is tracked WSL/issues/4277

Below outline steps to automatically configure the Interface metric on VPN connect and update DNS settings (/etc/resolv.conf) on connect/disconnect.

Manual Configuration

Set Interface Metrics

Keybase proof

I hereby claim:

  • I am markcaudill on github.
  • I am mcaudill (https://keybase.io/mcaudill) on keybase.
  • I have a public key whose fingerprint is 18CE 2C8A 296D 5D73 AE7E E794 2501 13B2 56B5 42E9

To claim this, I am signing this object:

@markcaudill
markcaudill / lic.sh
Last active September 30, 2022 18:35
#!/bin/bash
set -o pipefail
PREREQS=(curl fmt jq)
usage() {
cat <<USAGE
Usage: ${0##*/} [-h] [ID]
Generate a LICENSE.txt file.
@markcaudill
markcaudill / 55-bytes-of-css.md
Created September 29, 2022 12:30 — forked from JoeyBurzynski/55-bytes-of-css.md
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@markcaudill
markcaudill / centos8-sysprep.sh
Created November 23, 2021 15:42
An approximation of virt-sysprep
#!/bin/bash
systemctl stop rsyslog
# Cleanup (approximating the defaults of https://libguestfs.org/virt-sysprep.1.html#operations)
# Remove the crash data generated by ABRT
rm -rfv /var/spool/abrt/*
# Remove editor backup files from the guest
@markcaudill
markcaudill / zip_code_coordinates.csv
Last active March 31, 2020 15:39 — forked from erichurst/US Zip Codes from 2013 Government Data
All US zip codes with their corresponding latitude and longitude coordinates. Comma delimited for your database goodness. Source: https://www2.census.gov/geo/docs/maps-data/data/gazetteer
We can't make this file beautiful and searchable because it's too large.
ZIP,LAT,LNG
00601,18.180555,-66.749961
00602,18.361945,-67.175597
00603,18.455183,-67.119887
00606,18.158327,-66.932928
00610,18.294032,-67.127156
00612,18.402253,-66.711397
00616,18.420412,-66.671979
00617,18.447538,-66.557681
00622,17.991245,-67.153993

Keybase proof

I hereby claim:

  • I am markcaudill on github.
  • I am mcaudill (https://keybase.io/mcaudill) on keybase.
  • I have a public key whose fingerprint is 22DD 2ACE 6746 60A1 33A0 A523 2ED3 96FC E25E 7F77

To claim this, I am signing this object:

@markcaudill
markcaudill / README.md
Created November 8, 2017 15:15
letsencrypt certbot cloudflare zone pause and unpause

Description

This makes it easy to automate pausing your Cloudflare zone(s), renewing your letsencrypt certs, and then unpausing your zone(s).

Installation

  • Ensure python-cloudflare is installed either in system or virtualenv.
  • Make sure you chmod 0700 certbot-renew.sh before you add your credentials.
  • Replace your existing certbot renew cron job with something like @daily /path/to/certbot-renew.sh.
  • It's helpful to have MAILTO="youremail" in the top of your crontab to easily see the output whenever it runs.

Author

#!/bin/bash
#
# btsync Start up the btsync server daemon
#
# chkconfig: 2345 55 25
# description: btsync is like this sync thing. Google it.
#
# processname: btsync
# config: /etc/btsync.conf
# pidfile: /var/run/btync/btsync.pid