Skip to content

Instantly share code, notes, and snippets.

@pjv
pjv / NODEJS_MAJOR=14.log
Created December 4, 2021 10:55
ztncui-aio build logs
Sending build context to Docker daemon 243.2kB
Step 1/34 : FROM debian:buster-slim AS builder
---> 105744913aa9
Step 2/34 : ENV NODEJS_MAJOR=14
---> Running in dad572d3d2b0
Removing intermediate container dad572d3d2b0
---> baa06d7d9efa
Step 3/34 : ARG DEBIAN_FRONTEND=noninteractive
---> Running in 5e2aefc7af21
Removing intermediate container 5e2aefc7af21
@pjv
pjv / compact-custom-header-legacy.js
Last active January 12, 2020 12:58
Lovelace Compact Custom Header for old devices
See below
Verifying that "pjv___.id" is my Blockstack ID. https://onename.com/pjv___
@pjv
pjv / update_ungoogled_chromium_extensions.sh
Created June 7, 2017 12:35
get latest version of installed ungoogled chromium extensions
#!/usr/bin/env bash
# dependencies:
# https://www.npmjs.com/package/chrome-web-store-item-property-cli
# https://stedolan.github.io/jq/
# curl
# configure these:
EXTENSIONS_DIR="/path/to/Chromium/Profile/Extensions" ## e.g. on macos ~/Library/Application Support/Chromium/Profile 1/Extensions
DOWNLOAD_DIR="/path/to/where/you/want/latest/extensions"
@pjv
pjv / functions.php
Last active October 9, 2018 18:22
put into functions.php to make WooCommerce cart default to choosing the cheapest shipping option
// https://github.com/woothemes/woocommerce/issues/3641
// http://stackoverflow.com/questions/36300773/woocommerce-programmatically-changing-the-default-shipping-method
// guts of function straight copy of function get_default_method from WC v. 2.5.5 includes/class-wc-shipping.php
function plx_default_cheapest_shipping_method( $current_chosen_method, $available_methods ) {
$selection_priority = get_option( 'woocommerce_shipping_method_selection_priority', array() );
if ( ! empty( $available_methods ) ) {
@pjv
pjv / cf_ban
Created May 13, 2016 13:17
Cloudflare v4 API ban and urban bash scripts
#!/bin/bash
# dependencies: curl
# example usage: cf_ban 192.168.0.1
# append cloudflare email address and API token:
USER=
TOKEN=
@pjv
pjv / hhvm_supervisor.sh
Last active August 29, 2015 14:10
HHVM memory monitor
#!/usr/bin/env bash
# depends on ps_mem : https://github.com/pixelb/ps_mem/
PID=`pidof hhvm`
MEM=`/path/to/ps_mem.py -p $PID -t`
# restart hhvm daemon if using more than 2650000000 bytes
if [[ $MEM > 2650000000 ]] ; then
service hhvm restart
@pjv
pjv / hhvm.conf
Last active January 18, 2016 18:04
Ubuntu 14.04 upstart script for HHVM
# hhvm - HipHop VM
#
# The HipHopVM server provides a high performance PHP stack and web server.
# modified by pjv from original found here: http://stackoverflow.com/questions/19013516/upstart-script-for-hhvm-hiphop
description "HHVM server"
author "pjv https://gist.github.com/pjv/2e9ab32d8d9884bf79a4"
start on filesystem or runlevel [2345]
stop on runlevel [!2345]
@pjv
pjv / keybase.md
Created July 14, 2014 20:31
keybase.md

Keybase proof

I hereby claim:

  • I am pjv on github.
  • I am pjv (https://keybase.io/pjv) on keybase.
  • I have a public key whose fingerprint is 977A 23FD 69DF B657 1346 6113 FEAC 6517 DBAB CD16

To claim this, I am signing this object:

@pjv
pjv / mac.backup.plist
Created October 8, 2013 16:42
Back up a mac to an external USB-connected hard disk using Time Machine but keep the hard disk unmounted in between backups.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd>
<plist version="1.0">
<dict>
<key>Label</key>
<string>mac.backup</string>
<key>RunAtLoad</key>
<true/>
<key>StartInterval</key>
<integer>3600</integer>