Skip to content

Instantly share code, notes, and snippets.

View henri's full-sized avatar
💭
hacking the mainframe

henri henri

💭
hacking the mainframe
View GitHub Profile
@henri
henri / ping-date-and-time-alias.txt
Last active September 2, 2019 01:48
Ping Tricks
# you can add these as needed
alias ping_test_xyz="while true ; do echo -n \"\`date | tr -d '\n'\` \" ; ping -c 1 -A xyz | head -n 2 | tail -n 1 ; sleep 1 ; done"
# if you are running on macOS the following can be useful
ping --apple-time xyz
# macOS xargs has no -d (delimiter) option. But you can use BASH to do something similar :
cat myfile.txt | grep \n | while read -r line ; do echo "$line"; done
# This lines below are able to be placed into a script and then used to allow switching a system to a specific network interface at a specific time
# If you are looking to have this as an alias then visit this page : http://henri.shustak.org/github/handy-alias/
#
priority_interface_name="name_of_interface_to_prioritize"
echo sudo /usr/sbin/networksetup -ordernetworkservices \\\"${priority_interface_name}\\\" `/usr/sbin/networksetup -listallnetworkservices | grep -v 'An asterisk ' | sed s/\^'*'// | grep -xv "${priority_interface_name}" | sed 's/.*/\"&\"/' | tr '\n' ' ' | sed 's/.$//' | sed 's/\"/\\\\\"/g'` | tr -d "\\" | bash
exit 0
@henri
henri / macOS core storage cheat sheet
Created February 13, 2020 09:02
macOS corestorage encryption notes
# hfs+ conversion notes
# 1. df -h (find the disk partition information
# 2. diskutil cs convert <disk0s2> -passphrase <my_super_secret_passphrase>
# 3. diskutil cs list | grep -i progress
@henri
henri / iOS Calendar Trasnfer (off-line)
Last active March 1, 2020 22:18
iOS Calendar Trasnfer (off-line)
# One approach to the transfer of entire calendars or even multiple calendars
# between iOS devices (or from an iOS device to another device using an .ics file)
# is to backup the iOS device using iMazing <https://imazing.com>, then click on
# the calendar and select the calendar(s) and events to export, then select export.
# You will now have an .ics file which will be able to be imported into almost
# any modern calendar system.
#
# I like using Calanders 5 <https://readdle.com/calendars5> it is a nice iOS
# Calnders App. I origionally started using because it would show multi
# day events as a line over those days which the built in iOS calander app
# Approach 1
sudo nvram StartupMute=%00
# Approach 2
sudo nvram -d StartupMute
@henri
henri / hue-motion-scan.rb
Last active July 17, 2024 22:15
Phillips Hue Hub Logging / Notification
#!/usr/bin/env ruby
# Copyright, All Rights Reserved Henri Shustak 2020
# Released under the GNU/GPL v3 or later licence
#
# requirements:
# - node.js - for hueadm - just install via package macnageer - eg brew.sh
# - hueadm - https://github.com/bahamas10/hueadm
# - datezone - http://www.fresse.org/dateutils/#datezone
#
@henri
henri / pushover.sh
Last active November 15, 2020 23:44
PushOver
#! /bin/bash
#
# RELEASED UNDER MIT LICENCE : https://mit-license.org
# Copyright Allrights Reserved 2020, Henri Shustak
# This Script Works With the PushOver <http://pushover.net> service and is capable of sending notifcations to your phone.
#
# Usage: ./pushover.bash message title url url_title priority device'
#
# Example: ./pushover.sh "this is a test" "test title" "http://mylink.com" "my url title" 0 "iPhone"'
# Note: All parameters except message are optional'
@henri
henri / qrbot-display.rb
Last active June 1, 2020 21:35
Get QRBot WebServer Barcodes Output
#!/usr/bin/ruby
#
# RELEASED UNDER MIT LICENCE : https://mit-license.org
# Copyright Allrights Reserved 2020, Henri Shustak
#
# This is a script which is designed to be called to pull barcode data from a webserver. This specifically relates to QRBot iOS App.
# This is great if you use mobile phones or other barcode scannning devices to feed barcodes to a centalised webserver
#
# Released under MIT Licence
#
@henri
henri / ioreg
Created May 3, 2021 20:58
macOS report Apple machine serial number
/usr/sbin/ioreg -c IOPlatformExpertDevice | grep IOPlatformSerialNumber | tr -d "\"" | awk -F " = " '{print $2}'