Skip to content

Instantly share code, notes, and snippets.

Avatar

Dylan Hildenbrand Dilden

View GitHub Profile
View media.sh
#!/bin/sh
THEDATE=`date +%d%m%y%H%M`
MEDIA_PATH="/mnt/shared/Media/"
LOCAL_BACKUP_PATH="/media/backups/Media/"
# Backup shared media
rsync -r ${MEDIA_PATH} ${LOCAL_BACKUP_PATH}
if [ "$?" -eq "0" ]
then
@Dilden
Dilden / ddns.sh
Last active Feb 12, 2021
DDNS via Cloudflare API
View ddns.sh
#/usr/bin/env sh
# Date
DATE=`date +%Y-%m-%d_%H:%M:%S`
# Get the ZoneID from: https://www.cloudflare.com/a/overview/<your-domain>
DNS_ZONE=YOUR_ZONE_ID_HERE
# Get the existing identifier for DNS entry:
# https://api.cloudflare.com/#dns-records-for-a-zone-list-dns-records
@Dilden
Dilden / backups.sh
Last active Oct 30, 2019
Copy LXC backups
View backups.sh
#!/bin/sh
THEDATE=`date +%d%m%y%H%M`
CONTAINER_PATH="/var/lib/vz/dump/"
#MEDIA_PATH="/ mnt/shared/Media"
LOCAL_BACKUP_PATH="/media/backups/"
# Copy LXC backups (that are < 2 days old) from host to mounted drive
find ${CONTAINER_PATH} -name vzdump-lxc-*.tar.gz -mtime -2 -exec cp {} ${LOCAL_BACKUP_PATH} \;
@Dilden
Dilden / factorial.js
Created May 1, 2018
JS Factorial w/Recursion
View factorial.js
function factorial(n) {
if(n > 0) {
return n * factorial(n - 1);
}
else return 1;
}
console.log(factorial(4));
console.log(factorial(5));
console.log(factorial(6));
@Dilden
Dilden / .storj_aliases
Last active Feb 23, 2018
Handy Storj-CLI aliases + Update script
View .storj_aliases
alias storjstart='storjshare start -c ~/.config/storjshare/configs/STORJ_NODE_ID_HERE.json'
alias storjstop='storjshare stop -i STORJ_NODE_ID_HERE'
alias storjstat='storjshare status'
# mkdir ~/storjstuff and place bash script there
alias storjupdate='cd ~/storjstuff/ && ./storjupdate.sh && cd -'
@Dilden
Dilden / wpbak.sh
Last active Jan 5, 2018
WordPress Backup script
View wpbak.sh
#!/bin/sh
THESITENAME=""
THEDB=""
THEDBUSER=""
THEDBPW=""
THEDATE=`date +%d%m%y%H%M`
# There is a space between the first `/` and the rest of the path in this variable
# It needs to be there for the TAR command to work for some reason
SITE_PATH="/ var/www/"
View keybase.md

Keybase proof

I hereby claim:

  • I am dilden on github.
  • I am dilden (https://keybase.io/dilden) on keybase.
  • I have a public key whose fingerprint is 69DD D9DC 99EE E5FE 46CC B181 99F3 66A4 E861 BFA1

To claim this, I am signing this object:

@Dilden
Dilden / functions.php
Last active Nov 21, 2016
Restrict dates on jQuery UI Datepicker within WordPress/WooCommerce checkout
View functions.php
<?php
if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
// AJAX request to disable days on calendar in checkout
add_action( 'wp_ajax_company_holidays', 'company_holidays_callback' );
add_action( 'wp_ajax_nopriv_company_holidays', 'company_holidays_callback' );
function company_holidays_callback() {
$holidays = [];
@Dilden
Dilden / custom_plugin_WC_templates.php
Created Sep 28, 2016
Useful snippet for overriding WooCommerce templates in your custom WordPress plugin. Just follow the same directory structure as if you were overriding the templates from a theme.
View custom_plugin_WC_templates.php
// Override woocommerce templates with the templates in my plugin
add_filter( 'woocommerce_locate_template', 'custom_plugin_templates');
function custom_plugin_templates ( $template, $template_name, $template_path ) {
$check_dis = str_replace('woocommerce', 'your-plugin-name-goes-here/woocommerce', $template);
if(file_exists($check_dis)) {
$template = $check_dis;
}
return $template;
};
View html-artwork.markdown

HTML artwork

Use the buttons on the top of the screen to add different shapes with different colors, rotate the shapes, or remove them. Build whatever you can imagine.

A Pen by Dylan Hildenbrand on CodePen.

License.