Skip to content

Instantly share code, notes, and snippets.

@jasmas
jasmas / ToSafari.py
Created December 10, 2014 06:53
ToSafari.py
# Receives a URL via JS bookmarklet and sends it to Safari
# Bookmarklet: javascript:window.location='pythonista://ToSafari?action=run&argv='+encodeURIComponent(document.location.href);
# Assumes script is in the root of Pythonista and called 'ToSafari'
import sys
import webbrowser
numArgs = len(sys.argv)
@jasmas
jasmas / rmpkg
Created March 3, 2016 07:24
A simple shell script for removing OS X packages installed with .pkg files
#!/bin/sh
[ -n "$1" ] || { echo "usage: rmpkg package-id"; exit 1; }
pkgutil --pkg-info $1 || exit $?
printf "\n"
PKGVOL=`pkgutil --pkg-info $1 | sed -n 's/volume: \(.*\)/\1/p'`
PKGLOC=`pkgutil --pkg-info $1 | sed -n 's/location: \(.*\)/\1/p'`
@jasmas
jasmas / iscsi
Last active December 15, 2016 04:34
Initramfs Script & Hook to iSCSI Boot Ubuntu 14.04 LTS on UCS
# Place in /etc/initramfs-tools/scripts/local-top/ and chmod 755
#!/bin/sh
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
@jasmas
jasmas / keybase.md
Last active January 29, 2019 15:25
Keybase proof

Keybase proof

I hereby claim:

  • I am jasmas on github.
  • I am jasmas (https://keybase.io/jasmas) on keybase.
  • I have a public key ASAEN_6rNkknmbFnqBP5aYqdKjNUtSIathaCSXclci9CGAo

To claim this, I am signing this object:

@jasmas
jasmas / ssh-send-key
Created June 7, 2017 21:40
ssh-send-key
#!/bin/bash
[ -z $1 ] && echo 'usage: ssh-send-key [user@]hostname' && exit 1
KEY=`ssh-add -L` #set to, e.g., `cat ~/.ssh/id_rsa.pub` if not using agent
read -r -d '' CMDS << END
[ ! -d .ssh ] && mkdir .ssh && chmod 700 .ssh
[ ! -f .ssh/authorized_keys2 ] && touch .ssh/authorized_keys
chmod 600 .ssh/authorized_keys
@jasmas
jasmas / nc-template-update
Last active August 1, 2017 19:14
Script to update North Central templates
#!/usr/bin/env bash
USERNAME=jmasker
LOGFILE=${HOME}/Library/Logs/`basename $0`.log
TEMPLATE_DIR="${HOME}/Library/Group Containers/UBF8T346G9.Office/User Content.localized/Templates.localized"
ARCHIVE=".old-nc-templates"
TEMPLATE_EXTS='*.dotm,*.dotx,*.xltm'
TMP=
function exit_fail {
@jasmas
jasmas / umbrellactl
Last active September 20, 2024 14:47
umbrellactl: Bash script to check status, enable or disable Cisco Umbrella Roaming Security Module for AnyConnect on MacOS
#!/usr/bin/env bash
PLUGIN_BASE='/opt/cisco/secureclient/bin/plugins'
read -r -d '' USAGE << EGASU
Usage: `basename $0` [-s|-e|-d|-h]
-s, --status Print Umbrella Roaming Security module status
-e, --enable Enable Umbrella Roaming Security module
-d, --disable Disable Umbrella Roaming Security module
@jasmas
jasmas / hosts.txt
Created February 4, 2019 14:37
Hosts.txt
5.2.76.189 ocsp.apple.com world-gen.g.aampling.com
2a04:52c0:101:1cd::d3c8 ocsp.apple.com world-gen.g.aampling.com
@jasmas
jasmas / acdisable
Created January 26, 2022 17:29
Enable/Disable Cisco AnyConnect Socket Filter Extension on MacOS
#!/bin/sh
echo Disabling vpnagentd...
sudo launchctl disable system/com.cisco.anyconnect.vpnagentd
echo Tearing down vpnagentd...
sudo launchctl bootout system /Library/LaunchDaemons/com.cisco.anyconnect.vpnagentd.plist
echo Deactivating Cisco AnyConnect Socket Filter Extension...
/Applications/Cisco/Cisco\ AnyConnect\ Socket\ Filter.app/Contents/MacOS/Cisco\ AnyConnect\ Socket\ Filter -deactivateExt