Skip to content

Instantly share code, notes, and snippets.

@robsonke
robsonke / switchOsxLocation.sh
Last active May 9, 2016 06:48
A simple bash script switching osx locations based on the active wifi network
#! /bin/bash
#######################################################
## Simple bash script to change OSX network location ##
## based on the wifi network you're connected too. ##
## Author: Rob Sonke ##
#######################################################
#
# NOTE: Make sure you add this line to the /etc/sudoers file to allow
@robsonke
robsonke / checkDockerDisks.sh
Last active September 30, 2024 09:34
This Bash script will loop through all running docker containers on a host and list the disk usage per mount. In case it's breaching the 65%, it will email you.
#!/bin/bash
# get all running docker container names
containers=$(sudo docker ps | awk '{if(NR>1) print $NF}')
host=$(hostname)
# loop through all containers
for container in $containers
do
echo "Container: $container"
on alfred_script(q)
tell application "iTerm"
activate
tell the first terminal
launch session "Default"
tell the last session
-- give the iterm tab the name of the process
set name to q
#!/bin/sh
#
#
# Usage: ./scriptName.sh www.google.com
#
ADDRESS=$1
echo Fetching ssl certificate for $ADDRESS
-- Modified script, based on:
-- http://peterdowns.com/posts/open-iterm-finder-service.html
on run {input, parameters}
tell application "Finder"
set dir_path to quoted form of (POSIX path of (folder of the front window as alias))
end tell
CD_to(dir_path)
end run
@robsonke
robsonke / createTreeStructureFromArray.php
Created June 14, 2014 08:17
Group a php array to a tree structure
$original = array
(
"1" => array
(
"id" => 1,
"type" => "mtb",
"brand" => "scott",
"name" => "scott1"
),
array