Skip to content

Instantly share code, notes, and snippets.

@jmurphyau
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
jmurphyau / download-wwdc2020-sample-code.sh
Created Jan 29, 2021
Download WWDC 2020 Sample Code
View download-wwdc2020-sample-code.sh
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 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
jmurphyau / download.sh
Created Feb 9, 2020
Download HLS Stream with FFmpeg
View download.sh
#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 Sep 18, 2018
Shell Script Location
View script-location.sh
# 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 Jun 26, 2018
genesys-mcp-and-rm-tuning
View genesys-mcp-and-rm-tuning.md

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.

View click-once-sha1-digest-value.sh
#!/bin/bash
openssl dgst -binary -sha1 "$1" | openssl enc -base64
@jmurphyau
jmurphyau / tomcat-log-retention.md
Last active Jan 18, 2019
tomcat-log-retention.md
View 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 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) }"