Skip to content

Instantly share code, notes, and snippets.

Avatar

John Taylor jftuga

View GitHub Profile
@jftuga
jftuga / update_pihole_block_lists.sh
Created Aug 15, 2020
Update block lists in a dockerized version of PiHole
View update_pihole_block_lists.sh
#!/bin/bash
# Update block lists in a dockerized version of PiHole
# the log file should be: update_pihole_block_lists.log
#
# run this script from cron each Saturday morning with this contab entry:
# 00 3 * * 6 /root/update_pihole_block_lists.sh
IMAGE=pihole
LENGTH=12
View ec2info.sh
#!/bin/bash
# ec2info.sh
# -John Taylor
# Aug-03-2020
# Retrieve EC2 instance type info such as vCPU, clock speed, memory, network
# This queries your default AWS region
# Results are saved to the user-defined file name: $TSV and also to the MacOS clipboard
# Note: the 'RAM in GB' column is rounded to the nearest whole number
@jftuga
jftuga / ec2info.bat
Last active Jul 19, 2020
ec2info: retrieve all EC2 instance type info such as vCPU, clock speed, memory, network
View ec2info.bat
@echo off
setlocal
rem ec2info.bat
rem -John Taylor
rem Jul-19-2020
rem Retrieve all EC2 instance type info such as vCPU, clock speed, memory, network
rem Save results to a tab separated file, named 'ec2_types.tsv'
rem Note: the 'RAM in GB' column is rounded to the nearest whole number
@jftuga
jftuga / create_scheduled_task.ps1
Created Jul 17, 2020
How to create a Scheduled Task with PowerShell
View create_scheduled_task.ps1
# This task will run once per day at 9AM, only on week days
$A = New-ScheduledTaskAction -Execute "c:\scripts\my_project\scheduled_task.bat" -WorkingDirectory "c:\scripts\my_project"
$T = New-ScheduledTaskTrigger -At 9am -Weekly -DaysofWeek Monday,Tuesday,Wednesday,Thursday,Friday
$P = New-ScheduledTaskPrincipal -UserId "LOCALSERVICE" -LogonType ServiceAccount
$S = New-ScheduledTaskSettingsSet
$D = New-ScheduledTask -Action $A -Principal $P -Trigger $T -Settings $S
Register-ScheduledTask "My Project" -InputObject $D
@jftuga
jftuga / active_directory_contacts.cs
Last active Oct 13, 2020
Retrieve Active Directory Contacts Belonging to a Group
View active_directory_contacts.cs
/*
Given an AD group name, return all of the AD Contacts that belong to that group
Return a list of strings in this format:
CN Name|Email Address
*/
using System.DirectoryServices;
@jftuga
jftuga / make_backup.sh
Last active May 19, 2020
Raspberry Pi backup script
View make_backup.sh
#!/bin/bash
# Side note:
# for better performance append to /etc/sysctl.conf (and then reboot)
# vm.vfs_cache_pressure = 50
# vm.swappiness = 10
# vm.dirty_writeback_centisecs = 1500
# location of backups
BASE="/data/backups"
View Remove_PDF_Pages.ps1
<#
Remove_PDF_Pages
-John Taylor
Jan-7-2020
This is a simple, GUI frontend to pdfcpu.
https://github.com/pdfcpu/pdfcpu
The resulting PDF will have the filename appended with "--RemovedPages.pdf"
#>
@jftuga
jftuga / go-aws-new.go
Created Jan 12, 2020
Fixed version of go-aws-new.go
View go-aws-new.go
package main
import (
"fmt"
"log"
"time"
awsNews "github.com/circa10a/go-aws-news"
)
func main() {
@jftuga
jftuga / getNames.bat
Created Dec 31, 2019
Quick jq example
View getNames.bat
@echo off
rem use -r to return strings without surrounding double-quotes
jq -r ".Buckets | .[] | .Name" s3.json
@jftuga
jftuga / chocolateyInstalls_and_VSCodeExtensions.md
Last active Sep 19, 2020
May 2020 Chocolatey installed packages and VSCode extensions
View chocolateyInstalls_and_VSCodeExtensions.md

Chocolatey Notes

Install a package

choco install [package] -a (use -a or -y to install without any prompts)

Non-interactive configuration

choco feature enable -n allowGlobalConfirmation (sets global default to not prompt, assume yes)

You can’t perform that action at this time.