This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getCache = function(url) { | |
var supportsLocalStorage = 'localStorage' in window; | |
// Both functions return a promise, so no matter which function | |
// gets called inside getCache, you get the same API. | |
function getJSON(url) { | |
var promise = $.getJSON(url); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config_files = Dir.glob("#{ENV['HOME']}/Library/Application Support/Viscosity/OpenVPN/*/config.conf") | |
config_files.each do |file| | |
certificate_files = ['ca', 'cert', 'key', 'tls-auth'] | |
config_dir = File.dirname(file) | |
connection_name = nil | |
new_config = [] | |
File.read(file).each_line do |line| | |
line.strip! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# this is pid of the bash we are in | |
bash_pid=$$ | |
bash_pid=$(echo -e ${bash_pid} | tr -d '[[:space:]]'); | |
# this is shell of the bash | |
shell_pid=$(ps -p ${bash_pid} -o ppid=;) | |
shell_pid=$(echo -e ${shell_pid} | tr -d '[[:space:]]'); |