Skip to content

Instantly share code, notes, and snippets.

View JoelLisenby's full-sized avatar
🐳
sploosh

Joel Lisenby JoelLisenby

🐳
sploosh
View GitHub Profile
@JoelLisenby
JoelLisenby / linode_32G_setup.md
Last active February 20, 2024 17:48
linode_32G_setup

A Linode 32GB VPS configuration

Utilizing memcached (with php8.2-memcached) over localhost. We found a 5X improvement in speed from (15s to 3s) when viewing the events default view while logged in after enabling memcached in this way for The Events Ticktes/Calendar plugin when paired with WooCommerce.

Drop in object-cache.php to /wp-content/object-cache.php from: https://github.com/Automattic/wp-memcached

  • This script uses php8.2-memcache, not php8.2-memcached, but having both installed does not harm anything. They can both be installed safely.

/etc/mysql/mariadb.conf.d/50-server.cnf

@JoelLisenby
JoelLisenby / jbl_find_replace.php
Last active April 20, 2022 04:34
Find and Replace Title and Content for Specific Post Type in WordPress with WP_Query
<?php
/* Backup site first before using. This adds a menu to wp-admin so you can run the script.
*** Visiting this menu will automatically run the script!! ***
*/
add_menu_page(
'jbl Find Replace',
'jbl Find Replace',
'manage_options',
'jbl-find-replace',
'jbl_find_replace'
@chabala
chabala / using-google-takeout.md
Last active May 11, 2024 08:37
Merge and extract tgz files from Google Takeout

Recently found some clowny gist was the top result for 'google takeout multiple tgz', where it was using two bash scripts to extract all the tgz files and then merge them together. Don't do that. Use brace expansion, cat the TGZs, and extract:

$ cat takeout-20201023T123551Z-{001..011}.tgz | tar xzivf -

You don't even need to use brace expansion. Globbing will order the files numerically:

$ cat takeout-20201023T123551Z-*.tgz | tar xzivf -
@jessarcher
jessarcher / dslr-webcam.md
Last active March 10, 2024 17:25
Using my Canon 70D DSLR camera as a web cam on Linux

You'll need:

  1. Video 4 Linux loopback device kernel module (v4l2loopback) - Source: https://github.com/umlaeute/v4l2loopback (You might find builds in your distro's repos - I'm using Fedora so had to build it myself using https://github.com/danielkza/v4l2loopback-fedora/)
  2. gPhoto2 - this is what allows you to access your cameras live feed over USB - this was available in Fedora's repos.
  3. GStreamer or ffmpeg - this is what lets you stream the output from gPhoto2 into the loopback device.

It's been a little while since I set it all up so I can't remember all of the installation details, which will probably be different for your distro anyway unless you're using Fedora. Apologies if I have forgotten something as wel.

Running the stream

@JoelLisenby
JoelLisenby / ffmpeg.sh
Last active September 6, 2019 16:52
ffmpeg video encoding for web (chrome, firefox, safari, etc)
# h265
ffmpeg -i input.mp4 -c:v libx265 -vf scale=1280:720 -pix_fmt yuv420p output.mp4
# h265 with colorspace specified
ffmpeg -i input.mp4 -c:v libx265 -vf scale=1280:720 -pix_fmt yuv420p -color_primaries bt709 -color_trc bt709 -colorspace bt709 output.mp4
# h265 with colorspace specified and no audio
ffmpeg -i input.mp4 -c:v libx265 -vf scale=1280:720 -pix_fmt yuv420p -color_primaries bt709 -color_trc bt709 -colorspace bt709 -an output.mp4
# webm
@JoelLisenby
JoelLisenby / new_site.sh
Created January 10, 2019 22:08
Bash script to set up a new project folder for wpengine when using vscode with the sftp extension
#!/bin/bash
echo -e "Domain: \c "
read domain
echo -e "Slug: \c "
read slug
echo -e "Password: \c "
read password
dir="$domain/ftp/public/.vscode"

Hard Reset

  1. Unplug the desk for 20 seconds. Plug it back in. Wait a full 20 seconds.
  2. Press the up and down buttons until the desk lowers all the way and beeps or 20 seconds pass.
  3. Release both buttons.
  4. Press the down buttons until the desk beeps one more time or 20 seconds pass.
@JoelLisenby
JoelLisenby / gdpr.md
Last active May 4, 2018 21:50
GDPR Summary

General Data Protection Regulation [GDPR] Summary

Must have and store the lawful basis of processing for each contact.

  • Consent (opt-in)
    • Must be told (notified) of what they are opting into.
    • Needs to affirmatively opt-in with an unchecked box. (only opts in for what they were notified they are opting into, not everything you want to send.)
    • Consent must be granular, covering the various ways you use the users data (e.g. email, calls).
    • Must log auditable evidence of what the user consented to: the notice and when they consented.
  • Performance of a contract (customer you need to send bills to)
  • Legitimate interest (customer you want to send products related to what they have)
@JoelLisenby
JoelLisenby / optimize.sh
Last active April 5, 2018 16:22
Optimize all jpg and png images in current directory and sub-directories recursively with imagemagick mogrify to google pagespeed spec.
#!/bin/sh
find . -name '*.jpg' -execdir mogrify -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG -colorspace RGB -format jpg {} \;
find . -name '*.png' -execdir mogrify -strip {} \;
@benjamincharity
benjamincharity / autonomous.txt
Last active May 9, 2024 05:00
Instructions on how to reset the autonomous desk. This fixes a problem where the desk will not lower (also reportedly fixes incorrectly reported heights).
> Thank you for reaching out to Autonomous! I am sorry to hear that you are having some trouble with your SmartDesk
> but I will be glad to assist. It sounds like your system needs a "hard reset" can I please have you follow these
> steps thoroughly.
Reset Steps:
1. Unplug the desk for 20 seconds. Plug it back in. Wait a full 20 seconds.
2. Press the up and down buttons until the desk lowers all the way and beeps or 20 seconds pass.
3. Release both buttons.
4. Press the down buttons until the desk beeps one more time or 20 seconds pass.