Skip to content

Instantly share code, notes, and snippets.

@dshipp
dshipp / example_sysex
Created May 6, 2020 09:50
Reface CP local control Sysex
const byte localControlOn[]={0xF0,0x43,0x10,0x7F,0x1C,0x04,0x00,0x00,0x06,0x00,0xF7};
const byte localControlOff[]={0xF0,0x43,0x10,0x7F,0x1C,0x04,0x00,0x00,0x06,0x01,0xF7};
RK002_sendSystemExclusive(11, localControlOn);
RK002_sendSystemExclusive(11, localControlOff);
@dshipp
dshipp / postcode_task.md
Last active December 13, 2016 12:25 — forked from edhiley/postcode_task.md
Please read the instructions fully and ensure you meet all the constraints/instructions listed at the end. You should complete this task as if you were carrying it out in a work environment, i.e. you may perform web searches to help with your solution. However plagiarism is absolutely unacceptable.

Technical Task

Part 1 - Postcode validation

Write code that will validate UK postcodes.

You are given a regular expression that validates postcodes (shown in verbose form below):

    (GIR\s0AA) |

(

@dshipp
dshipp / split_zip.sh
Created April 22, 2016 14:30
Split and compress
split --bytes=1024M --filter='gzip > $FILE.gz' /path/to/input /path/to/output
@dshipp
dshipp / sshuttle.sh
Last active April 12, 2016 14:42
Tunnel all traffic over SSH
sudo pip install sshuttle
sshuttle -r user@host 0/0
@dshipp
dshipp / reboot-required.sh
Created November 3, 2014 17:16
Find out whether a reboot is required (e.g. after an unattended upgrade)
ls /var/run/reboot-required
@dshipp
dshipp / Open-port.sh
Created October 31, 2014 17:44
Lokkit adds an iptables rule to open the specified port
lokkit -p 8090:tcp
@dshipp
dshipp / ssh_authorise.sh
Created October 21, 2014 16:43
Generates an RSA keypair and installs it in a remote machine's authorized_keys, so you can ssh to that machine without a password prompt
# Generate a new ID without passphrase if one doesn't exist
if [ ! -e ~/.ssh/id_rsa.pub ] ; then
yes | ssh-keygen -f ~/.ssh/id_rsa -N ''
ssh-add
fi
# Copy the id to the target machine (this will prompt you for a password)
ssh-copy-id username@target.host
@dshipp
dshipp / GetIPAddress.sh
Created October 21, 2014 15:25
Retrieve IP address for hostname. This will also take into account any entries in /etc/hosts
gethostip -d [hostname]
@dshipp
dshipp / SSH run command in screen.sh
Created October 15, 2014 12:50
Create screen session around an SSH executed command
ssh -t username@server screen "command"
@dshipp
dshipp / PublicKeyAuth.sh
Created June 16, 2014 13:22
Enable public key authentication
(local machine) $ scp ~/.ssh/id_rsa.pub remoteuser@remotemachine:~
(remote machine) $ cat ~/id_rsa.pub >> ~/.ssh/authorized_keys