Skip to content

Instantly share code, notes, and snippets.

View sophieforceno's full-sized avatar

sophiejane sophieforceno

  • Connecticut, USA
View GitHub Profile
@sophieforceno
sophieforceno / insync-info.sh
Created March 19, 2020 03:12
insync-info.sh - Display recent activity and information about your Google Drive account via insyc-headless
#! /bin/bash
echo
echo "------ Insync-headless Status ------"
echo
echo "Sync progress:"; insync-headless get_sync_progress
echo
echo "Actions required:"; insync-headless get_actions_required
echo
echo "Errors:"; insync-headless get_errors
@sophieforceno
sophieforceno / rdiffrm.sh
Last active December 11, 2021 23:35
rdiffrm.sh - Recursively remove old rdiff-backup increments
#! /bin/bash
# rdiffrm.sh - Recursively remove old rdiff-backup increments
# Deletes rdiff-backup increments specified in $REPO that are older than $INCDATE days
#
# by Sophie Forceno
#
# Increment age in days
INCDATE="90"
@sophieforceno
sophieforceno / spush.py
Last active December 11, 2021 23:36
Send push notifications to mobile devices using Simplepush API
#! /usr/bin/python3
# Send push notifications to your mobile device
# using the Simplepush API
#
# Usage: spush.py title body eventid
# Accepts input from stdin
# e.g. sudo tail /var/log/somelog.log | spush.py title eventid
# by Sophie Forceno
@sophieforceno
sophieforceno / plex-update.sh
Last active December 11, 2021 23:37
Updates Plex media server running on Ubuntu
#! /bin/bash
# Downloads and install the latest version of Plex (for Ubuntu) for your arch
# if the version available is newer than what is installed
#
#
# by Sophie Forceno
#
arch=$(uname -m)
@sophieforceno
sophieforceno / nginxfail.sh
Last active January 10, 2022 23:16
Returns daily or all forbidden or refused requests parsed from the Nginx error log
#! /bin/bash
case "$1" in
all)
sudo grep -E "forb|refuse" /var/log/nginx/error.log | awk '{ print $1 " " $2 " " $11 }' | grep -w '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' | tr -d ','
# I also include a pipe to grep to remove all friendly IPs, something like:
# | grep -vE "192.168.1.*|$(curl -s ifconfig.co)|10.8.0.4"
;;
day)
sudo grep -E "forb|refuse" /var/log/nginx/error.log | awk '{ print $1 " " $2 " " $11 }' | grep -w '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' | tr -d ',' | grep "$(date +%Y/%m/%d)"
@sophieforceno
sophieforceno / blockbygeo.sh
Last active December 11, 2021 23:37
Bash script that uses ipset and iptables to block countries
#! /bin/bash
# blockbygeo.sh - Download country ipsets & add to iptables firewall rules
# By: Sophie Forceno
#
# Depends on: wget, ipset, iptables
IFS=$'\n'
action="$1"
country="$2"
@sophieforceno
sophieforceno / netdata-chip.md
Last active August 10, 2020 18:48
Turn your CHIP into a monitoring server with Netdata

This guide will cover installing and configuring netdata to turn your CHIP (or other Linux device) into a monitoring server. I will also review the steps needed to configure a "client" device that sends it's netdata metrics to CHIP. It's actually very easy to do, thanks to the fantastic job the Netdata developers did in making setup and configuration easy. Yes, the sheer number of configuration options is daunting, but getting netdata running on CHIP actually requires no configuration at all.

This guide will cover installing and configuring netdata to turn your CHIP into a monitoring server. Netdata monitors hardware, networking, applications (web servers, db servers, mail servers), as well as many other things, and visualizes the data in real-time on a web dashboard. I will also cover how to configure CHIP as a “server” that receives and makes accessible monitoring data from other Linux devices, or clients. Installing Netdata isn’t difficult, and to just get it running on CHIP requires no configuration.

T

@sophieforceno
sophieforceno / adisc.sh
Last active December 11, 2021 23:38
Bash script to automate archiving of optical discs
#! /bin/bash
#
# adisc - Optical Disc Auto-Transfer Tool - v0.9
# by Sophie Forceno
#
# This script loops until user intervention
# Iteratively creates directories, mounts each disc
# Uses rsync to copy disc contents to dir, unmounts disc
# Then prompts user to insert next disc
@sophieforceno
sophieforceno / wf.sh
Last active December 11, 2021 23:38
Bash script weather forecast via the Weather Underground API
#! /bin/bash
#
# wf.sh - Weather forecasts in your terminal! - v1.0
# by Sophie Forceno
#
# To use this script, you must register for the Weather Underground API:
# https://www.wunderground.com/weather/api/
# Obtain an API key and insert it here:
@sophieforceno
sophieforceno / lastfm-oauth.sh
Last active December 11, 2021 23:39
Last.fm authentication flow for the Bash shell
#! /bin/bash
# Lastfm-oauth - v1.0 (build 20160326)
# A Last.fm OAuth helper script for Bash
#
# by Sophie Forceno
#
# Reporting of bugs/issues or general inquiries are encouraged
# If you found this helpful, let me know :-)