Skip to content

Instantly share code, notes, and snippets.

View jacobtomlinson's full-sized avatar

Jacob Tomlinson jacobtomlinson

View GitHub Profile
@jacobtomlinson
jacobtomlinson / gist:8361722
Last active December 14, 2018 13:19
Reload VirtualBox kexts on OS X 10.9 Mavericks
#!/bin/bash
# Reload Virtual Box Kexts
unload() {
kextstat | grep "org.virtualbox.kext.VBoxUSB" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxUSB
kextstat | grep "org.virtualbox.kext.VBoxNetFlt" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxNetFlt
kextstat | grep "org.virtualbox.kext.VBoxNetAdp" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxNetAdp
kextstat | grep "org.virtualbox.kext.VBoxDrv" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxDrv
}
@jacobtomlinson
jacobtomlinson / remove_empty_folders.py
Last active October 19, 2022 04:56
Python Recursively Remove Empty Directories
#! /usr/bin/env python
'''
Module to remove empty folders recursively. Can be used as standalone script or be imported into existing script.
'''
import os, sys
def removeEmptyFolders(path, removeRoot=True):
'Function to remove empty folders'
if not os.path.isdir(path):
@jacobtomlinson
jacobtomlinson / gist:2e5abad238ec47b46cd4
Last active August 29, 2015 14:10
datapoint-python hourly cron log file for site 'Clifton Hill Ski Slope Exeter'
Thu Sep 25 10:00:00 2014 - Partly cloudy (day)
Thu Sep 25 11:00:02 2014 - Sunny day
Thu Sep 25 12:00:03 2014 - Sunny day
Thu Sep 25 13:00:02 2014 - Sunny day
Thu Sep 25 14:00:04 2014 - Partly cloudy (day)
Thu Sep 25 15:00:10 2014 - Partly cloudy (day)
Thu Sep 25 16:00:05 2014 - Cloudy
Thu Sep 25 17:00:04 2014 - Partly cloudy (day)
Thu Sep 25 18:00:04 2014 - Partly cloudy (day)
Thu Sep 25 19:00:06 2014 - Clear night
@jacobtomlinson
jacobtomlinson / get-toolbox.sh
Last active November 22, 2017 21:23
Docker toolbox for linux
#!/bin/bash
# A quick script to install Docker Engine and Compose
# Run with sudo
# Install Docker Engine
curl -sSL https://get.docker.com/ | sh
# Start Docker
# TODO update to handle multiple distros
service docker start
@jacobtomlinson
jacobtomlinson / freenas-disk-temp.py
Last active August 21, 2019 16:06
Get FreeNAS system temperatures in InfluxDB format
#!/usr/bin/env python
import os
import re
import subprocess
def cpuTemp(hostname):
sysctl = subprocess.Popen(['/sbin/sysctl', '-a'],stdout=subprocess.PIPE)
while True:
line = sysctl.stdout.readline()
@jacobtomlinson
jacobtomlinson / publish_temps.py
Created March 29, 2017 07:19
Send 1-wire temperature values from a Raspberry Pi to an MQTT broker
from __future__ import print_function
import os
import time
import paho.mqtt.client as mqtt
from paho.mqtt.client import MQTT_ERR_SUCCESS, MQTT_ERR_NO_CONN
DEVICES_PATH = "/sys/bus/w1/devices"
"""
Support for ONVIF Cameras with FFmpeg as decoder.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/camera.onvif/
"""
import asyncio
import logging
import os
import voluptuous as vol
@jacobtomlinson
jacobtomlinson / minikube-update-hosts.sh
Last active October 26, 2022 15:50
A script to update your /etc/hosts file from minikube ingest records
#!/bin/bash
#
# A script to update your /etc/hosts file from minikube ingest records
#
# Installation
# ------------
# curl -L https://gist.github.com/jacobtomlinson/4b835d807ebcea73c6c8f602613803d4/raw/minikube-update-hosts.sh > /usr/local/bin/minikube-update-hosts
# chmod +x /usr/local/bin/minikube-update-hosts
set -e
@jacobtomlinson
jacobtomlinson / .gitignore_global
Created August 18, 2017 10:08
An example global gitignore file
# An example global gitignore file
#
# Place a copy if this at ~/.gitignore_global
# Run `git config --global core.excludesfile ~/.gitignore_global`
# Compiled source #
###################
*.com
*.class
*.dll
@jacobtomlinson
jacobtomlinson / Starting with daskernetes.ipynb
Last active February 21, 2018 09:17
Starting with daskernetes.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.