Skip to content

Instantly share code, notes, and snippets.

View ianfinch's full-sized avatar

Ian Finch ianfinch

View GitHub Profile
@ianfinch
ianfinch / keypirinha-theme.txt
Created December 16, 2019 19:46
My theme for Keypirinha
[theme/ian]
opacity_back = 95
satellite_show = always
satellite_pos = topleft
satellite_size = small
control_margin = 4
textbox_padding = 3
listitem_padding = 1
layout = list_icon,list_dialnum,list_selmark,list_actions
color_background = #FFBF00
@ianfinch
ianfinch / replace_pi_user.txt
Last active December 17, 2019 12:27
Setup new user to replace pi user
user="whoever"
adduser $user
for group in $(groups pi | cut -d':' -f2 ) ; do
if [[ "$group" != "pi" ]] ; then
adduser $user $group
fi
done
@ianfinch
ianfinch / docker-on-pi
Created January 12, 2020 20:18
Set up docker on Raspberry Pi
# Based on https://dev.to/rohansawant/installing-docker-and-docker-compose-on-the-raspberry-pi-in-5-simple-steps-3mgl
curl -sSL https://get.docker.com | sh
sudo usermod -aG docker $USER
# Reboot
docker run hello-world
sudo apt-get install libffi-dev libssl-dev
@ianfinch
ianfinch / rpi-add-usb
Created February 19, 2020 17:41
Add a USB drive to a Raspberry Pi (Raspbian)
Find USB device ...
$ ls -l /dev/disk/by-uuid/
total 0
lrwxrwxrwx 1 root root 10 Feb 9 01:26 093F-C00F -> ../../sda1
lrwxrwxrwx 1 root root 15 Feb 9 01:26 2ab3f8e1-7dc6-43f5-b0db-dd8364731d4e -> ../../mmcblk0p2
lrwxrwxrwx 1 root root 15 Feb 9 01:26 5203-D7B4 -> ../../mmcblk0p1
The one we are looking for is "/sda"
@ianfinch
ianfinch / rpi-hfs
Last active May 29, 2020 09:54
How to mount HFS+ drives (Mac) on Raspberry Pi
Install dependencies ...
sudo apt-get install hfsplus hfsutils hfsprogs gdisk
To mount, add "-t hfsplus" to the mount command
@ianfinch
ianfinch / git
Last active June 26, 2020 00:04
Reminder of git commands
See all remotes ....................... git remote -v
Fetch a specific remote ............... git fetch <remote name>
Compare remote with local files ....... git diff --name-only remotes/<remote name>/master
Compare remote with main repo ......... git diff --name-only master remotes/<remote name>/master
Squash commits ........................ git rebase -i <after this commit>
Squash commits into initial commit .... git rebase -i --root
Force submit after squashes ........... git push origin +master
Replace "pick" with "reword" to change the commit message
Replace "pick" with "squash" to combine a commit with the last "pick" commit
@ianfinch
ianfinch / docker
Last active July 8, 2020 09:52
Quick reminders for docker commands
Export image as tar file .............. docker save -o <tar file> <docker image>
Import image from tar file ............ docker load --input <tar file>
@ianfinch
ianfinch / webserver
Created March 16, 2021 13:52
Quick script to start a web server when I create a server
#!/bin/sh
yum update -y
yum install httpd -y
service httpd start
chkconfig httpd on
echo "<html><head><title>Ian's Web Server</title></head><body><h1>Ian's Web Server</h1></body></html>" > /var/www/html/index.html
@ianfinch
ianfinch / craneoperator
Created June 22, 2022 17:59
How to run Crane Operator
docker run -d \
-p 8080:80 \
-e REGISTRY_HOST=$REGISTRY_HOST_IP \
-e REGISTRY_PORT=$REGISTRY_PORT \
-e REGISTRY_PROTOCOL=http \
-e SSL_VERIFY=false \
-e REGISTRY_ALLOW_DELETE=true \
parabuzzle/craneoperator:latest
@ianfinch
ianfinch / js-pass-by-value.txt
Last active July 8, 2022 07:31
Example of Javascript pass by value side effects
// Function to change the passed in variable
testFn0 = obj => { obj = {}; }
// Function to change level one variable
testFn1 = obj => { obj.b = 999; }
// Function to change level two variable
testFn2 = obj => { obj.b.b = 999; }
// Directly changing the passed in variable should not affect it