Skip to content

Instantly share code, notes, and snippets.

View JSzaszvari's full-sized avatar

John Szaszvari JSzaszvari

  • All over the World
View GitHub Profile
@JSzaszvari
JSzaszvari / 0_reuse_code.js
Created June 17, 2017 01:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
#!/bin/bash
# Script adds the VPN item to the menu bar and enables the 'show time
# connected' & 'show status while connecting' options. Last tested on 10.11
currentUser=$(python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\n");')
currentUserHomeDirectory=$(dscl . -read "/users/$currentUser" NFSHomeDirectory | cut -d " " -f 2)
vpnMenuItemExists=$(defaults read "$currentUserHomeDirectory/Library/Preferences/com.apple.systemuiserver" menuExtras | grep -o VPN)
if [ "$vpnMenuItemExists" ]; then
printf "VPN menu item is already on the status bar!"