Skip to content

Instantly share code, notes, and snippets.

View jacobsalmela's full-sized avatar
:octocat:
To all that makes us unique

Jacob Salmela jacobsalmela

:octocat:
To all that makes us unique
View GitHub Profile
@jacobsalmela
jacobsalmela / .profile
Last active August 29, 2015 14:01
single-user-mode-ids
#!/bin/bash
#----------VARIABLES---------
# Manually set ethernet device ID
ethernetID="en0"
# Put static IPv4 with subnet mask here
ethernetIP="10.x.x.x 255.x.x.x"
# Organization name (reverse-domain plist format)
orgName="org.enterprise.casper"
@jacobsalmela
jacobsalmela / single-user-mode-ids-geeklet
Last active August 29, 2015 14:01
Sounds a klaxon whenever a computer on the network boots to single-user mode.
#!/bin/bash
# Pings the IP address that any computer gets when booted to Single-User Mode
# Works best to set it to ping every 2 seconds (set refresh rate in Geektool)
ping -c 1 10.x.x.x &> /dev/null
# If that address is pingable,
if [ $? = 0 ];then
# Sound the "red alert" klaxon for speakers connected to this computer
afplay /Users/Shared/klaxon.mp3
@jacobsalmela
jacobsalmela / gravity.sh
Created June 8, 2014 15:07
Pi-hole: Pulls List of Ad Servers Into the event horizio
#!/bin/bash
# URL to pull list of known ad servers from
adListURL="http://pgl.yoyo.org/adservers/serverlist.php?hostformat=dnsmasq&showintro=0&mimetype=plaintext"
# Address to send ads to
piholeIP="127.0.0.1"
# Where the list of ad servers are stored once downloaded
# Any file in /etc/dnsmasq.d is loaded automatically when the service starts
@jacobsalmela
jacobsalmela / set-wallpaper-universal.py
Last active August 29, 2015 14:03 — forked from gregneagle/gist:6957826
(OS X) Universal script for setting the wallpaper. Works on 10.6-10.9
#!/usr/bin/python
# Universal wallpaper script for 10.6 and up
from AppKit import NSWorkspace, NSScreen
from Foundation import NSURL
from platform import mac_ver
from subprocess import call
from os import system
# Set path here for 10.9
picture_path = "/Library/Desktop Pictures/Custom.jpg"
@jacobsalmela
jacobsalmela / fixMultipleRecoveryHDs.sh
Created July 11, 2014 13:16
(OS X) Merges multiple Recovery HDs back into Macintosh HD (JAMF Casper Suite Defect D-007146)
#!/bin/bash
# Jacob Salmela
# 2014-07-11
# Fix multiple Recovery HDs created by Casper Imaging from Defect D-007146
# Get last extra Recovery HD by parsing out the bootable Recovery HD, leaving only the extra partitions
lastExtraRecovery=$(diskutil list | awk "/Recovery HD/" | grep -v "Apple_Boot" | awk '{print $7}' | tail -n1)
# Get Macintosh disk ID
systemVolume=$(diskutil list | awk "/Macintosh HD/" | grep -v "Apple_Boot" | awk '{print $7}')
@jacobsalmela
jacobsalmela / ryo-say-command.sh
Created August 12, 2014 12:24
(Linux) Roll-your-own say command
#!/bin/bash
#----------AUTHOR------------
# Jacob Salmela
# 12 August 2013
# https://github.com/jakesalmela/
#---------DESCRIPTION--------
# Say command for Linux
# Save as /usr/bin/say
@jacobsalmela
jacobsalmela / ssh-histmon.sh
Created August 12, 2014 12:47
Real-time SSH history monitor
#!/bin/bash
#----------AUTHOR------------
# Jacob Salmela
# 15 November 2013
# https://github.com/jakesalmela/
#----------RESOURCES---------
# http://askubuntu.com/questions/80371/bash-history-handling-with-multiple-terminals
# http://www.csgnetwork.com/epochtime.html
@jacobsalmela
jacobsalmela / speak-copy-serial.sh
Created August 12, 2014 12:27
(OS X) Speak and copy the serial number
#!/bin/bash
#----------AUTHOR------------
# Jacob Salmela
# 3 December 2013
#----------RESOURCES---------
# http://stackoverflow.com/questions/12230762/insert-characters-into-a-string-in-bash
#---------DESCRIPTION--------
# Copies the computers serial number into the clipboard and then speaks it aloud so you can write it down
@jacobsalmela
jacobsalmela / disableUAC.cmd
Created August 18, 2014 12:31
(Windows) Disable UAC
%windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f\
@jacobsalmela
jacobsalmela / analytics-geeklet.sh
Created August 18, 2014 23:33
(OS X) Geeklet to display Google Analytics daily vists
#----------VARIABLES--------
# API credentials
clientID=""
clientSecret=""
redirectURI=""
# OAuth tokens and codes
authorizationCode=""
# Once you have these two tokens, the script can run automatically.
accessToken=""
refreshToken=""