Skip to content

Instantly share code, notes, and snippets.

View darrenpmeyer's full-sized avatar

Darren P Meyer darrenpmeyer

View GitHub Profile
@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 / openconnect-7-ubuntu-build.md
Last active June 10, 2020 16:24
Building OpenConnect 7 on Ubuntu 14 (trusty), 15 (vivid), and 16 (xenial)
@darrenpmeyer
darrenpmeyer / autobuild-openconnect-7-ubuntu.sh
Last active June 10, 2020 16:22
Autobuild script for OpenConnect 7 (Ubuntu 14/15/16 trusty/vivid/xenial)
#!/usr/bin/env bash
## NOTE! OpenConnect is now on Version 8, and this is only for historical use
## See https://gist.github.com/darrenpmeyer/1a56d0d4817352998fe9d7cfe5a79684 for new script
oc_ver="7.08"
echo "Autobuild OpenConnect $oc_ver"
echo " "
echo "This script uses apt-get and make install via sudo rights"
echo "To simplify this, we're going to use sudo -v to pre-authenticate you"
@darrenpmeyer
darrenpmeyer / unix_dates.scpt
Created August 31, 2015 21:04
Convert AppleScript date objects to UNIX timestamp or POSIX date format
-- convert an AppleScript Date object to a POSIX date CCYYMMDDHHmm.SS
on posixDate(datetime)
-- date -j -f "%A, %B %e, %Y at %I:%M:%S %p" "Tuesday, September 1, 2015 at 11:00:00 AM" +%Y%m%d%H%M
set command to "date -j -f '%A, %B %e, %Y at %I:%M:%S %p' '" & datetime & "'"
set command to command & " +%Y%m%d%H%M.%S"
set thePosixDate to do shell script command
return thePosixDate
end posixDate
@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 / 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 / open-vm-tools-vmware-ubuntu-sharing.md
Last active April 10, 2024 19:18
open-vm-tools and VMWare Shared Folders for Ubuntu guests

(NB: adapted from this Ask Ubuntu thread -- tested to work on Ubuntu 16.04 LTS through Ubuntu 22.04 LTS (Jammy).

Unlike using VMWare Tools to enable Linux guest capabilities, the open-vm-tools package doesn't auto-mount shared VMWare folders. This can be frustrating in various ways, but there's an easy fix.

TL;DR

Install open-vm-tools and run:

sudo mount -t fuse.vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other
@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 / 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