Skip to content

Instantly share code, notes, and snippets.

View zushane's full-sized avatar

Shane Doucette zushane

View GitHub Profile
@zushane
zushane / convert-json-to-csv.py
Created June 30, 2020 20:49
A simple python script to convert json to csv, using Pandas.
import os,pandas
for file in os.listdir('./'):
if file.endswith('.json'):
print'Processing: ', os.path.join('./', file)
newfilename = str(file) + ".csv"
pandas.read_json(file).to_csv(newfilename, encoding = 'utf-8
@zushane
zushane / README.md
Created June 24, 2019 18:56 — forked from mosquito/README.md
Add doker-compose as a systemd unit

Docker compose as a systemd unit

Create file /etc/systemd/system/docker-compose@.service

[Unit]
Description=%i service with docker compose
Requires=docker.service
After=docker.service
@zushane
zushane / get-macos-serialnumber.sh
Created March 4, 2019 16:19
Use ioreg to print out a macOS serial number.
# From: https://apple.stackexchange.com/a/40244
ioreg -c IOPlatformExpertDevice -d 2 |awk '/IOPlatformSerialNumber/ {print $3}' |sed s/\"//g
#!/bin/bash
# A bash script to create a time machine disk image suitable for
# backups with OS X 10.6 (Snow Leopard)
# This script probably only works for me, so try it at your own peril!
# Use, distribute, and modify as you see fit but leave this header intact.
# (R) sunkid - September 5, 2009
#
# This will create a time machine ready disk image named with your
# computer's name with a maximum size of 600GB and copy it to
# /Volumes/backup. The image "file" (it's a directory, really) will
@zushane
zushane / stress-runner.sh
Last active June 2, 2017 21:29
A simple script to run a pile of applications all at once to stress a Mac computer.
#!/bin/bash
while true; do
/usr/bin/open -F -a "/Applications/Firefox.app" 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
sleep 50
/usr/bin/open -a "/Applications/Firefox.app" 'https://google.ca'
sleep 5
/usr/bin/open -a "/Applications/Firefox.app" 'https://zu.com'
@zushane
zushane / kapture.sh
Created November 17, 2016 19:47 — forked from nmarley/kapture.sh
OSX can capture WiFi packets using only tcpdump (and without needing a clunky interface such as KisMAC). Used for testing security strength of home WiFi setup.
#! /bin/bash
# This is for Mac OSX only.
# =============================================
# explanation of arguments used with 'tcpdump':
# =============================================
# -y IEEE802_11_RADIO => makes it capture __WIFI__ packets, turns resultant file
# into a dump which can be read by aircrack-ng, etc.
#
# -I => puts interface into monitor mode (required to capture packets)
#!/bin/bash
if [[ $# -ne 1 ]]; then
echo "Usage: $(basename $0) user"
exit 99
fi
HOST=ldap.example.com
BASE_DN="dc=example,dc=com"
ROOT_DN="cn=admin,${BASE_DN}"
@zushane
zushane / reboot_airports.applescript
Last active November 17, 2015 16:51
A simple script to do unattentded reboot of Airport devices. It assumes that all of the devices are sequential, with none to skip. Works best on a server.
--
-- Simple script to do unattented reboot of Airport devices.
-- Assumptions: all the devices are sequential, with none to skip.
--
-- only run this script if it's before 5am.
set foo to do shell script "date +%H"
set thisHour to foo as number
if thisHour < 5 then
@zushane
zushane / xvfb.service
Created October 20, 2015 19:09
systemd Xvfb startup configuration
# Copy this file to /etc/systemd/system/xvfb.service
# Then execute:
# systemctl enable /etc/systemd/system/xvfb.service
# systemctl start xvfb.service
[Unit]
Description=X Virtual Frame Buffer Service
After=network.target
[Service]
@zushane
zushane / mailtest.sh
Last active August 29, 2015 14:15
Simple mail test script.
#!/bin/bash
server=`hostname`
timestamp=`date +%s`
mail_subject="${1-"$timestamp"} ($server)"
mail_address=${2-"test@example.com"}
mail_message="/tmp/$timestamp.message"
mail_program="/bin/mail"
echo "Sending test mail to $mail_address, with subject \"$mail_subject\""