Skip to content

Instantly share code, notes, and snippets.

@etelford
etelford / .php-cs-fixer.php
Created July 19, 2022 19:43 — forked from laravel-shift/.php-cs-fixer.php
PHP CS Fixer - Laravel Coding Style Ruleset
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',

Raspberry Pi, Static HTTPS site with Docker and Nginx

This tutorial is dated Oct 2021, if it's much further on than that this information might be out of date.

This is a guide on setting up a static HTTPS website on your raspberry pi using docker and nginx. The aim is to have this running on the raspberry pi and to be able to access it from a host computer on the same local network. You should already be able to ssh into your pi from your host computer and have raspberry pi OS set up.

Find your raspberry pi

@etelford
etelford / VortexRace3ForMac.md
Created May 12, 2021 23:25 — forked from arogulin/VortexRace3ForMac.md
How to setup Vortex Race 3 keyboard for Mac and move Fn key to Home

How to setup Vortex Race 3 for Mac with latest (on 2020-01-05) firmare V1.02.05.

For better understanding we will use the following naming convention:

  [ L1 ][ L2 ][ L3 ][ Space ][ R1 ][ R2 ][ R3 ]
  1. Reset everything by pressing L3+R1 for 5 seconds. Left LED will blink white color while you're holding the keys. Release them after it stopeed blinking.
  2. Get into one of the programmable layers (R2+RShift) – I like red, the super bright laser LED is the least super annoying in red.
  3. Put the keyboard in Windows Mode (Pn+W), it's the least problematic one.
@etelford
etelford / gist:d76353f2920c541081f5e165ce4f54fd
Last active October 10, 2020 14:19
Convert wav to mp3 and add IDv3 tags
# https://trac.ffmpeg.org/wiki/Encode/MP3
ffmpeg -i Input.wav -codec:a libmp3lame -b:a 256k Output.mp3
ffmpeg -i Input.wav -vn -ar 44100 -ac 2 -b:a 192k Output.mp3
# Lookup genre @ https://en.wikipedia.org/wiki/List_of_ID3v1_Genres
id3tag --artist="Artist Name" --album="Album name" --song="Song Name" --year=2020 --track=1 --total=1 --genre=17 File.mp3
@etelford
etelford / alignments.coffee
Created October 5, 2020 13:51 — forked from devongovett/alignments.coffee
PDFKit Examples part 2
lorem = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed pulvinar diam eu ' +
'dolor bibendum et varius diam laoreet. Morbi eget rutrum enim. Sed enim ipsum, ' +
'posuere nec hendrerit non, commodo quis tortor. Fusce id nisl augue. Fusce at ' +
'lectus ut libero vehicula imperdiet.'
doc.text 'This text is left aligned. ' + lorem, 100, 100,
width: 410
align: 'left'
doc.moveDown()
@etelford
etelford / export-cognito-users.sh
Created April 3, 2020 15:02 — forked from chrisdiana/export-cognito-users.sh
Export AWS Cognito User Pool
# Export as Text Table
aws --region XXXXXXXXX cognito-idp list-users --user-pool-id XXXXXXXXXXXXX --output table > ~/users.txt
# Export as JSON
aws --region XXXXXXXXX cognito-idp list-users --user-pool-id XXXXXXXXXXXXX --output json > ~/users.json
# Export User Pool with more than 60 users (pagination)
aws --region XXXXXXXXX cognito-idp list-users --user-pool-id XXXXXXXXXXXXX --pagination-token INCREDIBLYLONGSTRINGHERE --output json > ~/users-2.json
@etelford
etelford / ios_record_audio_to_file.swift
Created May 31, 2019 13:06
iOS: Recording audio from the mic & saving it to a file
// Recording audio to a file:
var engine = AVAudioEngine()
var distortion = AVAudioUnitDistortion()
var reverb = AVAudioUnitReverb()
var audioBuffer = AVAudioPCMBuffer()
var outputFile = AVAudioFile()
var delay = AVAudioUnitDelay()
func initializeAudioEngine() {
engine.stop()
@etelford
etelford / debug.blade.php
Created April 5, 2018 12:53
CSS viewport debug for Tailwind CSS
@if(env('CSS_DEBUG'))
<div class="fixed pin-b pin-l text-white opacity-50">
<span class="absolute pin-b pin-l bg-red p-4 sm:hidden md:hidden lg:hidden xl:hidden">Mobile</span>
<span class="absolute pin-b pin-l bg-orange p-4 hidden sm:block md:hidden lg:hidden xl:hidden">Small</span>
<span class="absolute pin-b pin-l bg-green p-4 hidden sm:hidden md:block lg:hidden xl:hidden">Medium</span>
<span class="absolute pin-b pin-l bg-blue p-4 hidden sm:hidden md:hidden lg:block xl:hidden">Large</span>
<span class="absolute pin-b pin-l bg-purple p-4 hidden sm:hidden md:hidden lg:hidden xl:block"><nobr>X-Large</nobr></span>
</div>
@endif
<!-- make 31 option tags with value and the text the two-digit number in the sequence -->
option[value="$$"]${$$}*31
<!-- or specify the start value -->
option[value="$$$$@2017"]${$$$$@2017}*83
@etelford
etelford / debug.html
Created September 30, 2016 18:38
Bootstrap Responsive Debugging
<div id="u-debug-size">
<div id="u-debug-size__inner"></div>
</div>