This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Place this file in /usr/local/sbin/backup-script.sh | |
# Add passwords with: | |
# security add-generic-password -s "password_label" -a "username" -w "your_password_here" | |
SAMBA_PASS=$(security find-generic-password -s "samba_pass" -a "username" -w) | |
BACKUP_PASS=$(security find-generic-password -s "backup_pass" -a "username" -w) | |
# Configuration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
!!!!! README !!!! | |
v1.3, released 2/15/23 | |
Tested with ACF 5.12.3 and ACF Pro 5.12.3 | |
Screenshot: https://i.imgur.com/IJlvzVp.png | |
How is this different from the default in date/time picker? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/ash | |
# This script takes a bare Alpine install and installs/configures all the apps required by my use case. | |
if [[ $EUID -ne 0 ]]; then | |
echo "This script must be run as root" | |
exit 1 | |
fi | |
echo "Update" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Parse an HTML from hubspot and get a clean HTML representation. | |
function get_email_html($email) { | |
$html = ""; | |
// The email HTML comes in via an array of widgets | |
$widgets = array(); | |
foreach($email->widgets as $widget) { | |
$widgets[] = $widget; | |
} | |
// The wdigets must be sorted to get the content in order |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use rand::Rng; | |
fn calc_uuid() -> String { | |
let mut result: String = "".to_owned(); | |
let mut rng = rand::thread_rng(); | |
for x in 0..16 { | |
let rand_value = if x == 6 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// frontend -> templates -> blocks -> default-blocks.php | |
/** | |
* Retrieve the post meta-data key value | |
* | |
* @since 1.0.0 | |
* | |
* @param string $key Meta-data key. | |
*/ | |
function wpgb_get_metadata( $key = '' ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// given a number of intervals and number of backup slots, console log out each backup slots age for every interval | |
const printBackupIntervals = (intervals, backupSlots) => { | |
let points = {}; | |
const pad = String(Math.pow(2, backupSlots - 1)).split("").map(c => "0").join(""); | |
for (let i = 1; i < intervals; i++) { | |
Object.keys(points).forEach(k => points[k]++); | |
const k = tower(i, backupSlots).charCodeAt(0); | |
points[k] = 1; | |
console.log("Day " + i + ": " + Object.keys(points).map(p => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* PixiJS Background Cover/Contain Script | |
* Returns object | |
* . { | |
* container: PixiJS Container | |
* . doResize: Resize callback | |
* } | |
* ARGS: | |
* bgSize: Object with x and y representing the width and height of background. Example: {x:1280,y:720} | |
* inputSprite: Pixi Sprite containing a loaded image or other asset. Make sure you preload assets into this sprite. |