Skip to content

Instantly share code, notes, and snippets.

Working from home

Toby Osbourn tosbourn

Working from home
View GitHub Profile
View gist:e901dc96c9e8b225fd5dfdd84837bfd5
openssl ecparam -name prime256v1 -genkey -noout -out nfcKey.pem
openssl ec -in nfcKey.pem -pubout -out nfcPubkey.pem -conv_form compressed
cat nfcPubkey.pem
Top and tail the resulting key and join any broken lines
tosbourn /
Created Jan 30, 2018
Some docker commands I always forget
docker-compose up #runs docker compose (looks at docker-compose.yml)
docker ps # lists all containers
docker exec -it `docker container id` bash
View dynamic_filters.ex
def filter(params) do
|> order_by(^filter_order_by(params["order_by"]))
|> where(^filter_where(params))
|> where(^filter_published_at(params["published_at"]))
def filter_order_by("published_at_desc"), do: [desc: :published_at]
def filter_order_by("published_at"), do: [asc: :published_at]
def filter_order_by(_), do: []
View MySQL
  • Always uppercase actions
  • Always backtick tables
  • Always use != for "not equals to"
  • Always give an alias to a table
SELECT FROM `aTable` a WHERE != 5
tosbourn / facebook_warning.html
Created Feb 4, 2017
How to recreate Facebook's console warning
View facebook_warning.html
<!DOCTYPE html>
<meta charset="utf-8">
<script type="text/javascript">
const warningTitleCSS = 'color:red; font-size:60px; font-weight: bold; -webkit-text-stroke: 1px black;';
const warningDescCSS = 'font-size: 18px;';
View Get PS to make text in a layer work
set names to read "/Users/IE14/Dropbox (InnovationEnterprise)/Email Marketing/Pesonalised Emails/NamesTest.txt" as «class utf8»
tell application "Adobe Photoshop CC 2015.5"
tell current document
# Access NAME layer
set current layer to layer "Name"
tell current layer to if not visible then set visible to true
# LOOP through names
repeat with name in (paragraphs of names as list)
# Add name to name layer
View gist:a5f42242a1f9205426bae607fd5bcfce
Tito.on('registration:started', function(data){
for(var i=0; i<data.line_items.length; i++) {
var line_item = data.line_items[i];
ga('ec:addProduct', {
'id': line_item.release_slug,
'name': line_item.title,
'price': line_item.price,
'quantity': line_item.quantity
ga('ec:setAction', 'add');
View gist:6a3203fa366be207984b
pi@raspberrypi:~ $ sudo rpi-update
*** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
*** Performing self-update
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 10666 100 10666 0 0 77592 0 --:--:-- --:--:-- --:--:-- 77854
*** Relaunching after update
*** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
*** We're running for the first time
*** Backing up files (this will take a few minutes)
View union-array-ampersand-vs-set.rb
require "set"
require 'benchmark/ips'
X = [5, 5, 1, 1]
Y = [1, 2, 5]
def fast
View imagecaption
<img src="" alt="Small picture of a kitten" />
Small picture of a kitten, graciously shared by <a href=""></a>