Skip to content

Instantly share code, notes, and snippets.

View davenicoll's full-sized avatar
🖖

Dave Nicoll davenicoll

🖖
View GitHub Profile
@davenicoll
davenicoll / settings.json
Last active March 2, 2022 18:30
VSCode settings
{
"telemetry.telemetryLevel": "off",
"editor.guides.bracketPairs": true,
"go.toolsManagement.autoUpdate" : true,
"explorer.compactFolders" : false,
"todo-tree.general.tags" : [
"BUG",
"HACK",
"FIXME",
"TODO",
#!/bin/bash
if [[ -z "$SSH_CLIENT" ]]; then SSH_CLIENT="127.0.0.1"; fi
TEXT="A user successfully logged on to \`$USER@$HOSTNAME\` ($(hostname -I | awk '{print $1}')) from \`$(echo $SSH_CLIENT | awk '{print $1}')\`.<br/>Please review this activity."
MESSAGE=$( echo ${TEXT} | sed 's/"/\"/g' | sed "s/'/\'/g" )
JSON="{\"title\": \"Unusual user login activity\", \"themeColor\": \"\", \"text\": \"${MESSAGE}\" }"
curl --silent -H "Content-Type: application/json" -d "${JSON}" "https://outlook.office.com/webhook/..." > /dev/null
@davenicoll
davenicoll / update-synology-plex.sh
Last active May 6, 2021 00:21
Automatically update plex on synology NAS
#!/bin/bash
mkdir -p /tmp/plex/ > /dev/null 2>&1
rm -rf /tmp/plex/* > /dev/null 2>&1
token=$(cat /volume1/Plex/Library/Application\ Support/Plex\ Media\ Server/Preferences.xml | grep -oP 'PlexOnlineToken="\K[^"]+')
url=$(echo "https://plex.tv/api/downloads/5.json?channel=plexpass&X-Plex-Token=$token")
jq=$(curl -s ${url})
newversion=$(echo $jq | jq -r .nas.Synology.version)
echo New Ver: $newversion
curversion=$(synopkg version "Plex Media Server")
echo Cur Ver: $curversion
@davenicoll
davenicoll / gmail-auto-archive.js
Created January 17, 2021 13:48
Autoarchive for GMail
function gmailAutoarchive() {
var holdDays = 8;
var maxDate = new Date();
maxDate.setDate(maxDate.getDate()-holdDays);
var threads = GmailApp.getInboxThreads(0,500).filter(function(thread) {
// Return only old threads and without stars
return (thread.getLastMessageDate() < maxDate && thread.hasStarredMessages() == false);
});
@davenicoll
davenicoll / get-keyvault-secrets.ps1
Last active January 29, 2021 22:12
Extract all secrets from keyvault
$IGNORE_LIST = @('not-in-use') #List of keyvaults to ignore, i.e. 'audit-tracked-secrets','nothing-to-see-here'
Write-Output "Getting subscriptions..."
$SUBSCRIPTIONS = Get-AzSubscription | Where-Object {$_.State -eq "Enabled"}
ForEach($SUBSCRIPTION in $SUBSCRIPTIONS)
{
Write-Output "✨ $($SUBSCRIPTION.Name) ($($SUBSCRIPTION.Id))"
Set-AzContext -Subscription $($SUBSCRIPTION.Id) | Out-Null
@davenicoll
davenicoll / random-password.sh
Last active February 4, 2021 20:53
Create a random password in bash
random_password()
{
LENGTH=32; if [[ -n "$1" ]]; then LENGTH=$1; fi
</dev/urandom tr -dc '0-9-a-z-A-Z@#()-=_+[]{},.' | head -c"$LENGTH"; echo ""
}
PASSWORD=$(random_password 20)
@davenicoll
davenicoll / code.sh
Created April 9, 2021 15:47 — forked from harperreed/code.sh
Use VSCode (server) in a google cloud shell. or a chromebook.
./bin/code/bin/code-server --auth none --port 8080
@davenicoll
davenicoll / home-workout.md
Created April 9, 2021 15:50 — forked from harperreed/home-workout.md
Home/Hotel workout

My friend @CJN sent me this workout a few years ago to do while traveling. It also works at home.

  1. 30 Push-ups
  2. 30 Air squats
  3. 30 Crunches
  4. 10 Burpees
  5. 10 Windmills
  6. 30 Push-ups
  7. 30 Mountain climbers
  8. 30 Flutter kicks

RESPONDING TO PEOPLE IN GRIEF

Too often we don’t know what to say to a person in grief, so we offer a cliché to minimize the loss. Too often we can’t stand to witness another person’s pain, so we offer a cliché to hurry the grief process. What may be a healing insight for the survivor is often an empty platitude when dispensed by others. Instead, give your presence, give your patience, and allow the griever to find his or her own path.

There are simple ways to respond that show the person you care and will be there to support them.

What to Say:

  • I'm sorry for your loss.
  • Is there any specific way I can help you right now? (Make specific suggestions, like picking up the kids, cutting the grass, etc.)