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 / git-top-level.sh
Last active December 29, 2015 10:49
Substitute to top level directory for the current git repository. Useful when you have aliases and scripts which need to work across all repositories and refer to some file relative to that repository
$(git rev-parse --show-toplevel)
@dshipp
dshipp / download-exec.sh
Created November 12, 2013 15:01
Download a script and execute it without writing it to disk or setting permissions
curl -s server.com/file | sh
@dshipp
dshipp / simplehttp.sh
Created October 29, 2013 13:18
Simple web server in python. Exposes the current directory on the port number provided.
python -m SimpleHTTPServer 8000
@dshipp
dshipp / DirectoriesContainingFiletype.sh
Last active December 25, 2015 01:59
Output all directories that contain a particular file type anywhere within the directory structure. Useful for checking where there are directories that represent python projects for example.
#!/bin/bash
# In this example checking for directories containing Python files
find -iname '*.py' -printf '%h/\n'
@dshipp
dshipp / MatchAndReplaceLine.sh
Created October 9, 2013 11:02
Use sed to match a regular expression and replace the full line with just the match.
#!/bin/bash
# Use \( and \) to create a match group in the find part, use \1 in the replace part to reference the match group.
echo "./ThingToMatch/other/stuff/" | sed -n 's/\.\/\([a-zA-Z0-9]*\)\/.*/\1/p'
# This will output: ThingToMatch
# Works with multiline input, applying the replacement to each line.
#!/bin/bash
# Colours
ESC_SEQ="\x1b["
COL_RESET=$ESC_SEQ"39;49;00m"
COL_RED=$ESC_SEQ"31;01m"
COL_GREEN=$ESC_SEQ"32;01m"
COL_YELLOW=$ESC_SEQ"33;01m"
COL_BLUE=$ESC_SEQ"34;01m"
COL_MAGENTA=$ESC_SEQ"35;01m"