Skip to content

Instantly share code, notes, and snippets.

View jmurphyau's full-sized avatar

James Murphy jmurphyau

View GitHub Profile
@jmurphyau
jmurphyau / gist:0007870741e2163f91322e25402fd520
Last active July 7, 2021 00:45
Powershell: Connect to MS Teams + Azure AD in one line
# works on mac and pc, prompts in terminal for both
$u=(read-host 'User'); $p=(read-host 'Password' -assecurestring); $cred=New-Object System.Management.Automation.PSCredential ($u, $p); Connect-MicrosoftTeams -Credential $cred; Connect-MsolService -Credential $cred;
@jmurphyau
jmurphyau / download-wwdc2020-sample-code.sh
Created January 29, 2021 08:06
Download WWDC 2020 Sample Code
curl -s 'https://developer.apple.com/wwdc20/sample-code/' | pcre2grep -o1 '<a href="https://developer.apple.com/documentation/(.*?)"' | while read sample_suffix; do json_response="$(curl -s 'https://developer.apple.com/tutorials/data/documentation/'$sample_suffix'.json')"; redir_url=$(echo "$json_response" | pcre2grep -o1 'Moved Permanently. Redirecting to /documentation/(.*)'); [[ ! -z $redir_url ]] && json_response="$(curl -s 'https://developer.apple.com/tutorials/data/documentation/'$redir_url'.json')"; echo $json_response | jq -r '.sampleCodeDownload.action | select(.overridingTitle == "Download") | .identifier' ; done
@jmurphyau
jmurphyau / generate-network-info.cmd
Last active June 27, 2020 05:34
One line powershell to output network info and ping test multiple IPs
powershell.exe -noprofile -command "& { function dt(){get-date -uformat '%Y-%m-%d-%H%M%S'};$c=$args[0];$ips=$args[1..$args.length];$j=@();$nl=[Environment]::NewLine;$d=('{0}\Desktop\network-info-{1}' -f ($Env:USERPROFILE,(dt))); function iscmd($cmd){[bool](get-command $cmd -erroraction silentlycontinue)} function ping() { start-job -ScriptBlock { ping.exe $args[0] -n $args[1] | foreach-object {('{0}: {1}' -f (get-date -uformat '%Y-%m-%d-%H%M%S'), $_)} >$args[2]} -argumentlist $args } ((test-path $d) -or (md $d)) >$null;write-host ('{0}{1}: Network info will be written to {2}' -f ($nl,(dt),$d));netsh dump >$d\netsh-dump.txt;netsh interface ipv4 show subinterfaces >$d\netsh-interface-ipv4-show-subinterfaces.txt;netsh wlan show interfaces >$d\netsh-wlan-show-interfaces.txt;ipconfig -all >$d\ipconfig-all.txt; foreach ($i in $ips) {$j+=(ping $i $c ('{0}\ping-{1}.txt' -f ($d,$i)))} if (iscmd 'get-netipaddress') { get-netipaddress | format-table >$d\get-netipaddress.txt; if (iscmd 'get-netneighbor') { get-netneighbo
@jmurphyau
jmurphyau / download.sh
Created February 9, 2020 22:47
Download HLS Stream with FFmpeg
#this
ffmpeg -loglevel debug -f hls -referer 'https://10play.com.au/live' -user_agent 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/82.0.4050.0 Safari/537.36' -f hls -i "https://manifest.prod.boltdns.net/manifest/v1/hls/v4/aes128/2199827728001/6bd7fe89-1f2f-42d0-b7a5-c676791a0d83/10s/master.m3u8?fastly_token=NWUzZDliOGZfNTJhZjJhN2IxMzQ5OTdjNGVkYmEzODkwNjYwZTYyMWY2ZmY1YjNmNGJkNWM3NjdiNDFiZmViNjczNzMwMmJlYQ%3D%3D" -c copy project5.mp4
# or this
ffmpeg -loglevel debug -f hls -referer 'https://10play.com.au/live' -user_agent 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/82.0.4050.0 Safari/537.36' -f hls -i "https://manifest.prod.boltdns.net/manifest/v1/hls/v4/aes128/2199827728001/6bd7fe89-1f2f-42d0-b7a5-c676791a0d83/10s/master.m3u8?fastly_token=NWUzZDliOGZfNTJhZjJhN2IxMzQ5OTdjNGVkYmEzODkwNjYwZTYyMWY2ZmY1YjNmNGJkNWM3NjdiNDFiZmViNjczNzMwMmJlYQ%3D%3D" -c copy -bsf:a aac_adtstoasc project3.mp4
@jmurphyau
jmurphyau / script-location.sh
Created September 18, 2018 02:00
Shell Script Location
# include this at the top of a script to get script location
script_location=$([[ -d $0 ]] && d=${0}/. || d=$0; ( cd -P "$( /usr/bin/dirname "$d" )" && pwd; ))
@jmurphyau
jmurphyau / genesys-mcp-and-rm-tuning.md
Last active June 26, 2018 06:31
genesys-mcp-and-rm-tuning

Genesys MCP and RM Tuning

Add vm.swappiness = 10 to /etc/sysctl.conf

The recommendation is:

  • Use enough physical memory.
  • Disable the swap or make the swapping rare.

The default value is 60. Reducing the value means Linux uses the swap less.

@jmurphyau
jmurphyau / click-once-sha1-digest-value.sh
Created May 11, 2018 05:17
Click Once SHA1 Digest Value
#!/bin/bash
openssl dgst -binary -sha1 "$1" | openssl enc -base64
@jmurphyau
jmurphyau / tomcat-log-retention.md
Last active January 18, 2019 04:21
tomcat-log-retention.md

Tomcat Log Retention

Below is information that will assist in configuring log retention for Tomcat.

Version Requirements

Specific versions of Tomcat are required to configure the logging as per the directions in this guide.

  • For version 8.5.x, you require 8.5.16 or newer
  • For version 8.0.x, you require 8.0.45 or newer
@jmurphyau
jmurphyau / copy-wde-logs-to-desktop.cmd
Created April 24, 2018 00:16
one liner to copy WDE logs from default WDE log directory to the desktop
powershell.exe -command "& { $dt=(get-date -UFormat \"%Y-%m-%d-%H%m%S\"); $s=\"$Env:APPDATA\Genesys Telecommunication\InteractionWorkspace\log\*\"; $d=(\"{0}\Desktop\wde-logs-{1}\" -f ($Env:USERPROFILE,$dt)); if ((test-path $d) -eq $false) { md $d > $null; } cp $s $d; write-host \"\"; write-host (\"WDE logs have been copied to {0}\" -f $d) }"