Skip to content

Instantly share code, notes, and snippets.

View lacymorrow's full-sized avatar
🕶️
Grok'ing

Lacy Morrow lacymorrow

🕶️
Grok'ing
View GitHub Profile
@lacymorrow
lacymorrow / img_backup_restore.txt
Last active August 25, 2018 01:01
Clone SD image backup
> via https://raspberrypi.stackexchange.com/questions/311/how-do-i-backup-my-raspberry-pi
With gzip, to save a substantial amount of space:
sudo dd if=/dev/rdiskx bs=1m | gzip > /Users/tmorrow/Documents/rpi0-arch.gz
And, to copy the image back onto the SD:
gzip -dc /path/to/backup.gz | sudo dd of=/dev/rdiskx bs=1m
@lacymorrow
lacymorrow / WordPress.md
Last active August 31, 2018 20:36
Moving WordPress appearance to root directory from subdirectory

https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

Moving process (p.s. If you've already installed WP in subdirectory, some steps might be already done automatically).

Create the new location for the core WordPress files to be stored (we will use /wordpress in our examples). (On linux, use mkdir wordpress from your www directory. You'll probably want to use chown apache:apache on the wordpress directory you created.) Go to the General Screen. In WordPress address (URL): set the address of your main WordPress core files. Example: http://example.com/wordpress In Site address (URL): set root directory's URL. Example: http://example.com

@lacymorrow
lacymorrow / parse-url-params.js
Last active September 4, 2018 02:42
JS - Parse URL `GET` parameters from and HTTP request
/* function parseURLParams
* Accepts a http parameter string or grabs the one from the current URL
* Returns a dictionary
* Ex: '?api_key=XYZ&version=2' => { api_key: 'XYZ', version: 2}
*
* query: string | undefined
*/
function parseURLParams (query) {
if(!query)
@lacymorrow
lacymorrow / magicmirror-install.md
Last active September 4, 2018 05:24
Complete MagicMirror2 Installation
@lacymorrow
lacymorrow / vnc.sh
Last active September 5, 2018 08:43
VNC connection for MagicMirror2 Raspberry Pi -> MacOS
# SSH from the Mac to the Pi with
# -Y: X-11 (trusted) forwarding
# -L VNC forwarding
ssh -Y -L 5901:localhost:5901 pi@10.0.0.20
# (in SSH session)
# Create VNC password
x11vnc -storepasswd
@lacymorrow
lacymorrow / .xinitrc
Created September 6, 2018 10:18 — forked from ncornette/.xinitrc
.xinitrc for kiosk mode
#!/bin/sh
# invoke global X session script
#. /etc/X11/Xsession
# HOW-TO :
# 1. Disable any Display Manager (lightdm/gdm/gdm3) from executing on startup
# 2. Allow user to start X :
# a. Edit /etc/X11/Xwrapper.config
# b. Set value : "allowed_users=anybody"
# 3. insert "su kiosk -c xinit &" into /etc/rc.local
@lacymorrow
lacymorrow / js-sum.js
Created September 24, 2018 10:15
Simple function to sum an array
const numbers = [10, 20, 30, 40] // sums to 100
// function for adding two numbers. Easy!
const add = (a, b) =>
a + b
// use reduce to sum our array
const sum = numbers.reduce(add)
@lacymorrow
lacymorrow / flash_fix.sh
Last active January 6, 2019 23:44
FIX ALMOST ANY FLASH OR SD CARD!
#vGet drive name
diskutil list
# then try
diskutil unmountDisk force /dev/DRIVENAME
# Then format