Skip to content

Instantly share code, notes, and snippets.

@davidmroth
davidmroth / ffmpeg-rpi-hardware-accelerated.sh
Last active August 13, 2018 04:06
Compile FFMPEG for Raspberry Pi (Hardware Accelerated)
#!/bin/bash
if test -e ~/FFMpeg/.compiled; then
exit 2;
fi
# Check if root
if test $EUID -ne 0; then
echo "This script must be run as root"
exit 1
@davidmroth
davidmroth / create_swap.sh
Last active September 6, 2018 03:24
Create Swap on Raspberry Pi (Nodejs)
#!/bin/bash
# Check if root
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
# Check if dphys-swapfile installed. If not, install it
if ! dpkg --get-selections | grep -q "^dphys-swapfile\(:.*\)\?[[:space:]]*install$" >/dev/null; then
@davidmroth
davidmroth / tweak.sh
Last active September 9, 2018 00:39
RetroPie Tweaks - Ubuntu (Raspberry Pi 3)
#!/bin/bash
#config.txt
enable_uart=1
kernel=uboot.bin
device_tree_address=0x02008000
dtparam=i2c_arm=on
dtparam=spi=on
#overclock to 1.4 GHz
@davidmroth
davidmroth / process
Created September 11, 2018 02:29
Upload ROMS quickly
#!/bin/bash
# Usage:
# cat Street\ Fighter\ 3.zip | ssh -p222 rom_uploader@192.168.86.34 process nes street_figter.zip
ROM_SAVE_FOLDER=/home/retropie/RetroPie/roms
ROM_TYPE=$1
ROM_NAME=$2
@davidmroth
davidmroth / retropie_ubuntu_minimal.sh
Last active September 12, 2018 06:18
RetroPie Ubuntu minimal (Remove unused packages and startup scripts)
#!/bin/bash
#Roms
#https://archive.org/details/MAME0.37b5_MAME2000_Reference_Set_Update_2_ROMs_Samples
echo 'datasource_list: [ None ]' | sudo -s tee /etc/cloud/cloud.cfg.d/90_dpkg.cfg
apt remove --purge cloud-init lxd snapd open-iscsi accountsservice lxcfs -y
apt install alsa-base alsa-utils pulseaudio
#LABEL=cloudimg-rootfs / ext4 defaults,data=writeback,noatime,nodiratime 0 0
#!/bin/sh
# Copyright 2018 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Perform first-time container setup if necessary, and start the container
# if it isn't already running.
. /usr/share/misc/shflags
DEFINE_boolean dummy "${FLAGS_FALSE}" \
"Dummy run. Exit successfully immediately."
DEFINE_string container_name "" \
@davidmroth
davidmroth / Lightsail_lost_private_key_fix.sh
Created September 27, 2018 03:47
Use this script to regain access to a Lightsail server that has a lost private key
#!/bin/bash
# Lost your Lightsail private key (*.pem) file? Locked out of your server? Never fear, this script will fix that!!
# Step 1: Log into your Lighsail account
# Step 2: Create another in Lightsail
# Step 3: Generate a new public key from the private key you just downloaded `ssh-keygen -y -f .keys/newprivatekey.pem`
# Step 4: Copy the public key to the PRV_KEY bash variable below
# Step 5: Create a snapshot of your current server
@davidmroth
davidmroth / check_git.sh
Last active September 28, 2018 00:20
Check for local git changes
#!/bin/bash
SCAN_FOLDERS="theme $(find plugins/ -maxdepth 1 -type d)"
for folder in $SCAN_FOLDERS; do
if test -e $folder/.git; then
echo "Checking $folder for changes..."
@davidmroth
davidmroth / git_changes.sh
Created October 31, 2018 10:10
Check folders for changes
#!/bin/bash
ROOT_FOLDERS="WordpressSiteSync theme $(find plugins/ -maxdepth 1 -type d)"
for folder in $ROOT_FOLDERS; do
if test -e $folder/.git; then
echo "Checking $folder for changes..."
@davidmroth
davidmroth / functions.php
Created February 16, 2019 13:05 — forked from unfulvio/functions.php
WordPress HTML Minification Class to compress HTML (removal of whitespaces, line breaks, new lines, comments). Preserves script comments (if removed might break some javascripts like Google Analytics or Adsense) and IE specific tags.
/* Minifies HTML and removes comments (except IE tags and comments within script tags)
*
* To disable compression of code portions, use '<!--wp-html-compression no compression-->' tag
*
* @see http://forrst.com/posts/Wordpress_Minify_output_HTML-29q
* @see http://www.intert3chmedia.net/2011/12/minify-html-javascript-css-without.html
*/
class WP_HTML_Compression
{
// Settings