Skip to content

Instantly share code, notes, and snippets.

View ciarancoffey's full-sized avatar
💭
⌨️

Ciarán Coffey ciarancoffey

💭
⌨️
View GitHub Profile
@ciarancoffey
ciarancoffey / update_ip.sh 
Created December 19, 2022 10:13
Update cloudflare IP
#!/usr/bin/env bash
TARGET_DNS=me.mydomain.ie
ZONE_ID=<hex number> # The target zone you want to update
X_AUTH_KEY=<hex number> #Global API Key
X_AUTH_EMAIL="you@login.email"
DNS_ID=$(curl -X GET "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records?name=$TARGET_DNS" -H "Content-Type:application/json" -H "X-Auth-Key:$X_AUTH_KEY" -H "X-Auth-Email:$X_AUTH_EMAIL" | jq '.["result"][0]["id"]' -r)
EXTERNAL_IP=$(curl httpbin.org/ip | jq '.["origin"]' -r)
curl -X PUT "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records/$DNS_ID" \
-H "Content-Type:application/json"\
-H "X-Auth-Key:$X_AUTH_KEY"\
@ciarancoffey
ciarancoffey / resize.bat
Created October 5, 2017 23:03
Batch resize images on Windows using imagemagick
@echo off
rem HEIGHT is a variable that will be the MAX height of the image
IF [%1] ==[] GOTO SET1
rem If no options are sizes are specifed, set them to defualt
set HEIGHT=%1
GOTO SKIP1
:SET1
set HEIGHT=800
:SKIP1
IF [%2] ==[] GOTO SET2
#!/usr/bin/env bash
# Run with Execute plugin
# http://dev.deluge-torrent.org/wiki/Plugins/Execute
# On Event "Torrent Complete"
# It will extract the archive into a new folder "extracted"
# in the base of the torrent
# Useful if you want to keep seeding.
# This is similar to the script on the above page, but cleaner directory layout, suits plex and Kodi.
formats=(zip rar)
commands=([zip]="unzip -u" [rar]="unrar -o- e")
@ciarancoffey
ciarancoffey / YearlyTotal.cs
Created November 24, 2015 12:46
Google Script Crosss Sheet totals
function YearTotal()
{
//YearTotal, when called, will addup the cell it is called from in All Sheets besides the last sheet.
//This mean it'll only work when called from the last sheet.
//Set the output to be a float
output=0.0;
//ss is the class for the SpeadSheet. The spreadsheet contains the individual sheets.
ss = SpreadsheetApp.getActiveSpreadsheet();