Skip to content

Instantly share code, notes, and snippets.

View leoherzog's full-sized avatar

Leo leoherzog

View GitHub Profile
@kevinoconnor7
kevinoconnor7 / c-ddns.sh
Last active November 24, 2020 11:07
CloudFlare Dynamic DNS
#!/bin/sh
WAN_IP=`curl ifconfig.io/ip`
OLD_WAN_IP=`cat /var/CURRENT_WAN_IP.txt`
if [ "$WAN_IP" = "$OLD_WAN_IP" ]
then
echo "IP Unchanged"
else
curl https://www.cloudflare.com/api_json.html \
-d 'a=rec_edit' \
-d 'tkn=8afbe6dea02407989af4dd4c97bb6e25' \
@aras-p
aras-p / preprocessor_fun.h
Last active May 8, 2024 06:45
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
if [ $EUID != 0 ]; then
echo "It's a weird tree."
else
echo ' _ __'
echo ' / `\ (~._ ./ )'
echo ' \__/ __`-_\__/ ./'
echo ' _ \ \/ \ \ |_ __'
echo ' ( ) \__/ -^ \ / \'
echo ' \_/ " \ | o o |.. / __'
echo " \\. --' ==== / || / \\ "
@chappy84
chappy84 / cloudflare_dyn_dns.sh
Last active October 29, 2023 11:10
CloudFlare Dynamic DNS Shell Script
#!/bin/sh
#
# CloudFlare Dynamic DNS
#
# Updates CloudFlare records with the current public IP address
#
# Takes the same basic arguments as A/CNAME updates in the CloudFlare v4 API
# https://www.cloudflare.com/docs/client-api.html#s5.2
#
# Use with cron jobs etc.
@KonradIT
KonradIT / readme.md
Last active September 25, 2023 01:55
GoPro Studio for Linux
#!/bin/sh
#
# CloudFlare Dynamic DNS
#
# Updates CloudFlare records with the current public IP address
#
# Takes the same basic arguments as A/CNAME updates in the CloudFlare API
# https://www.cloudflare.com/docs/client-api.html#s5.2
#
# Use with cron jobs etc.
@jwbowles
jwbowles / excelToSimpleDateFormat
Last active February 17, 2017 10:28
Javascript function to convert Excel date format syntax (used in Google Apps Script spreadsheets) to simpleDateFormat syntax.
function excelToSimpleDateFormat(date, str) {
var excelNonReserved = /([^(m+|d+|y+|am\/pm|a\/p|h+|s+|0+|\[h+\]|\[m+\]|\[s+\])])/gi;
var excelElements = /("[^"]+"|m+|d+|y+|am\/pm|a\/p|h+|s+|0+|\[h+\]|\[m+\]|\[s+\])/gi;
var restrictedChars = /[a-z]+/gi;
var quotes = /"([^"]+)"/;
var minute = /m/g;
var month = /M/g;
var hour = /h/gi;
var seconds = /s/gi;
var ampm = /(a\/p|am\/pm)/gi;
@erickoledadevrel
erickoledadevrel / xmlToJson.js
Created December 1, 2014 14:30
A function to convert an XML string to a JSON object in Apps Script, using logic similar to the sunset method Xml.parse().
/**
* Converts an XML string to a JSON object, using logic similar to the
* sunset method Xml.parse().
* @param {string} xml The XML to parse.
* @returns {Object} The parsed XML.
*/
function xmlToJson(xml) {
var doc = XmlService.parse(xml);
var result = {};
var root = doc.getRootElement();
@jmiserez
jmiserez / export_google_music.js
Last active December 20, 2023 01:45
(fixed/updated 2016-05-10) Export your Google Music Library and Playlists (Google Play Music All Access) (see http://webapps.stackexchange.com/questions/50311/print-playlist-from-google-play-music for more)
// Copyright 2016 Jeremie Miserez <jeremie@miserez.org>
//
// MIT License
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF O
@superjamie
superjamie / raspberry-pi-vpn-router.md
Last active April 13, 2024 12:22
Raspberry Pi VPN Router

Raspberry Pi VPN Router

This is a quick-and-dirty guide to setting up a Raspberry Pi as a "router on a stick" to PrivateInternetAccess VPN.

Requirements

Install Raspbian Jessie (2016-05-27-raspbian-jessie.img) to your Pi's sdcard.

Use the Raspberry Pi Configuration tool or sudo raspi-config to: