Skip to content

Instantly share code, notes, and snippets.

View HammyHavoc's full-sized avatar
🏠
Working from home

Hammy Havoc HammyHavoc

🏠
Working from home
View GitHub Profile
@crabdancing
crabdancing / backup-mainrouter.lan
Created October 5, 2021 10:33
Automatically backup your OpenWRT router configuration to a local tarball under ~/Backups
#!/usr/bin/env bash
# script based on instructions from:
# https://openwrt.org/docs/guide-user/troubleshooting/backup_restore
router_hostname=mainrouter.lan
# Generate/update backup
ssh "$router_hostname" 'umask go=; sysupgrade -b /tmp/backup-${HOSTNAME}-$(date +%F).tar.gz'
@jscher2000
jscher2000 / syncedTabsToBookmarksHTML.js
Last active May 11, 2026 07:58
Export Synced Tabs List to "bookmarks.html" file (Browser Console script)
// Run code in Browser Console after enabling chrome debugging --
// about:config => devtools.chrome.enabled => true
// https://developer.mozilla.org/docs/Tools/Browser_Console
try {
var tabPromise = SyncedTabs._internal.getTabClients();
tabPromise.then((arrDevices) => {
if (arrDevices && arrDevices.length > 0){
// Generate a string with the format of a bookmark export file
var d, e, out = '<!DOCTYPE NETSCAPE-Bookmark-file-1>\n<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">\n<TITLE>Bookmarks</TITLE>\n<H1>Bookmarks Menu</H1>\n<DL><p>\n';
const escapeHtmlEntities = function(aText){return (aText || '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;')};
@yuna0x0
yuna0x0 / PVE_Customization_README.txt
Last active February 25, 2026 05:48
Proxmox VE Customization
This customization method references "https://lunar.computer/posts/persistent-customizations-proxmox-60/" and has been fixed and tl;dr by @edisonlee55.
Note: If you are logged in as "root", leave out "sudo" in the commands below.
1. Create folder "/usr/share/custom/" and "/usr/share/custom/backup"
$ sudo mkdir /usr/share/custom
$ sudo mkdir /usr/share/custom/backup
2. Backup "proxmoxlib.js"
$ sudo cp /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js /usr/share/custom/backup/
@jameshwartlopez
jameshwartlopez / functions.php
Last active March 2, 2025 22:19
Remove/Hide add to cart button in Woocommerce if the user is not logged in
//Option One (if you decided to use Option Two then remove this function and its action hook)
function remove_add_cart_button(){
$isLoggedIn = is_user_logged_in();
if(false == $isLoggedIn){
//if the user is not login then remove add to cart button by removing the action hook
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
}
}
add_action('wp','remove_add_cart_button');

Google Apps Script Gmail Utilities

##sendAndLabel(recipient, subject, body, options, label)##

An alternative to GmailApp.sendEmail(), which applies a label to the message thread in the sender's account.

Sends an email message with optional arguments. The email can contain plain text or an HTML body. The size of the email

@adamgit
adamgit / .gitignore
Last active April 10, 2026 20:33
.gitignore file for Xcode4 / OS X Source projects
#########################
# .gitignore file for Xcode4 and Xcode5 Source projects
#
# Apple bugs, waiting for Apple to fix/respond:
#
# 15564624 - what does the xccheckout file in Xcode5 do? Where's the documentation?
#
# Version 2.6
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#
Options +FollowSymlinks
RewriteEngine on
# No intersticial for direct reference and self-reference
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://box.leebyron.com/.*$ [NC]
# Add a line item for every website you don't need an intersticial for
# I've added my own website, gmail and facebook
RewriteCond %{HTTP_REFERER} !^http(s)?://([^\.]*.)?leebyron.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://mail.google.com/.*$ [NC]