Skip to content

Instantly share code, notes, and snippets.

View darrenpmeyer's full-sized avatar

Darren P Meyer darrenpmeyer

View GitHub Profile
@darrenpmeyer
darrenpmeyer / disconnect.cmd
Last active May 2, 2017 14:12
Shortcut (Run as Administrator!) to disconnect RDP and stay logged in on console
@ECHO OFF
%CSIDL_SYSTEM%\tscon.exe %sessionname% /dest:console
REM - run this as Administrator (or it won't work properly!)
REM
REM - disconnecting from RDP usually locks the console. If you don't want that,
REM - such as when running a headless Steam game server, then use this to end
REM - your sessions instead.
REM
REM - note that it can take up to 30s to disconnect this way, such is life.
@darrenpmeyer
darrenpmeyer / getnet.sh
Last active May 5, 2018 21:09
Get IPv4/netmask network spec (e.g. 192.168.0.0/24) for current network, useful for nmap etc.
#!/usr/bin/env bash
############
# run $ ./getnet.sh [iface]
#
# defaults to first non-local interface, but you can specify an interface.
# prints IP/Network in form 0.0.0.0/0 to STDOUT, so $(./getnet.sh en0) works
#
# e.g. run $ nmap -sP $(./getnet.sh en0)
# ^ will pingscan your current wifi network on macOS
#
@darrenpmeyer
darrenpmeyer / Note from Outlook Meeting.scpt
Created May 21, 2018 17:07
AppleScript to make a new Notes.app Note in an Exchange account from the currently selected Outlook Calendar Events
-- yes, that is an oddly specific use case; I suspect most people will just use this for
-- reference to solve their own problems ;)
tell application "Microsoft Outlook"
set currentEvents to selected objects
--log currentEvents
repeat with ev in currentEvents
try
set theSubject to the subject of ev
--log theSubject
@darrenpmeyer
darrenpmeyer / keybase.md
Last active July 24, 2018 15:35
Keybase Identity Proof

Keybase proof

I hereby claim:

  • I am darrenpmeyer on github.
  • I am calcifer (https://keybase.io/calcifer) on keybase.
  • I have a public key whose fingerprint is 6ECB 9EC6 B8B5 291C 36D6 FB13 1C1E 87EC 2C0B 28B5

To claim this, I am signing this object:

@darrenpmeyer
darrenpmeyer / macos_path_generation.rst
Last active July 25, 2018 17:30
PATH environment variable generation on macOS

Applies to OS X 10.6 (Snow Leopard) and newer; tested through MacOS 10.13 (High Sierra)

The general advice for adding particular directories to your PATH environment variable on MacOS is to add an export PATH to your ~/.bashrc or equivalent. This has some drawbacks. For one, it only affects that shell for that user.

Additionally, sometimes installed Applications modify the system's default PATH in ways that you don't want.

Understanding how MacOS generates the PATH environment variable is instructive.

TL;DR read man path_helper and be enlightened

@darrenpmeyer
darrenpmeyer / pyenv_most_recent.sh
Created July 25, 2018 21:09
Install most recent stable Python with pyenv
#!/usr/bin/env bash
# Get most recent version number of CPython, excluding rc, dev, pypy, etc.
pyver=$(pyenv install --list | grep -v '[^0-9. ]' | sort -r | head -n1 | awk '{print $1}')
# install it
pyenv install $pyver
@darrenpmeyer
darrenpmeyer / fix wemos_d1_mini mac_os crash.md
Created October 17, 2018 18:41
FIX - Wemos D1 mini crashes macOS 10.13 High Sierra when plugged in via USB

tl;dr: the D1 mini's usbserial interface is a little sketchy and macOS doesn't cope well. You need to install the driver from wch.cn. direct link to CH341SER_MAC.ZIP

SHA-512 sum (copy whole line, run pbpaste | shasum -c in your download directory to check):

efb25faeb87d66a10e284629231fad7ebfbdbf2c2a50ed9b35f8dd9793398ff79df3da3312367dbc497dc62103195bc4eaf6399f8084f442bb1d1a7a51551eac *CH341SER_MAC.ZIP
@darrenpmeyer
darrenpmeyer / openconnect_osx_howto.md
Last active October 18, 2018 17:07
Building OpenConnect for OS X with stoken and GnuTLS

This guide helps you build OpenConnect 7.x on OS X. You might want to do this if you want a newer version than the openconnect package in homebrew provides, or if you want to use libstoken support (for having an RSA soft token on your machine be used automatically by OpenConnect).

Shortcut

The version of OpenConnect on Homebrew has been updated, and so this whole guide can now be replaced with:

  1. Install Homebrew from http://brew.sh and make sure it works
  2. brew install openconnect --with-stoken
  3. brew install stoken (See the "Using OpenConnect" section below for information about using stoken to set up soft tokens)
@darrenpmeyer
darrenpmeyer / umake-pycharm-pro.sh
Last active December 16, 2018 15:44
Installing PyCharm Professional on Ubunutu
#!/usr/bin/env bash
## this script installs PyCharm Professional via umake on Ubuntu systems
## You can also use `snap install pycharm-professional` if you don't mind snap
# install umake if it doesn't yet exist
if ! which umake
then
# add the ubuntu-make (umake) repo and update local package caches
sudo add-apt-repository ppa:ubuntu-desktop/ubuntu-make
sudo apt-get update
@darrenpmeyer
darrenpmeyer / darren-sources-bionic.list
Last active April 12, 2019 13:14
Favorite APT repos for Ubuntu 18.04 LTS (bionic)
#KEY https://download.sublimetext.com/sublimehq-pub.gpg
deb https://download.sublimetext.com/ apt/stable/