Skip to content

Instantly share code, notes, and snippets.

jmurphyau / gist:0007870741e2163f91322e25402fd520
Last active Jul 7, 2021
Powershell: Connect to MS Teams + Azure AD in one line
View gist:0007870741e2163f91322e25402fd520
# 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 /
Created Jan 29, 2021
Download WWDC 2020 Sample Code
curl -s '' | pcre2grep -o1 '<a href="*?)"' | while read sample_suffix; do json_response="$(curl -s ''$sample_suffix'.json')"; redir_url=$(echo "$json_response" | pcre2grep -o1 'Moved Permanently. Redirecting to /documentation/(.*)'); [[ ! -z $redir_url ]] && json_response="$(curl -s ''$redir_url'.json')"; echo $json_response | jq -r '.sampleCodeDownload.action | select(.overridingTitle == "Download") | .identifier' ; done
jmurphyau / generate-network-info.cmd
Last active Jun 27, 2020
One line powershell to output network info and ping test multiple IPs
View generate-network-info.cmd
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 /
Created Feb 9, 2020
Download HLS Stream with FFmpeg
ffmpeg -loglevel debug -f hls -referer '' -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 "" -c copy project5.mp4
# or this
ffmpeg -loglevel debug -f hls -referer '' -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 "" -c copy -bsf:a aac_adtstoasc project3.mp4
jmurphyau /
Created Sep 18, 2018
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 /
Last active Jun 26, 2018

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.

openssl dgst -binary -sha1 "$1" | openssl enc -base64
jmurphyau /
Last active Jan 18, 2019

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 / copy-wde-logs-to-desktop.cmd
Created Apr 24, 2018
one liner to copy WDE logs from default WDE log directory to the desktop
View copy-wde-logs-to-desktop.cmd
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) }"