Skip to content

Instantly share code, notes, and snippets.

View whomwah's full-sized avatar

Duncan Robertson whomwah

View GitHub Profile
@whomwah
whomwah / Gemfile
Last active April 11, 2019 08:20
[Raspberry Pi] A simple bot in Ruby that uses RPi::GPIO to check a pin on a Raspberry PI with a moisture sensor on it to see if it needs watering. #pi
source 'https://rubygems.org'
gem 'rpi_gpio', '~> 0.3.3'
gem 'slack-ruby-client', '~> 0.10.0'
@whomwah
whomwah / README.md
Created April 11, 2019 08:26
[Swift] #swift

To observer any notification

center.addObserver(forName: nil, object: nil, queue: nil) { (note) in
  print("note: \(note)")
}
@whomwah
whomwah / README.md
Last active April 11, 2019 08:27
[unix] #unix #ssh

Manually setting the date and time

$ sudo date MMDDhhmmYYYY

MM - Two digit month number
DD - Two digit date
hh - Two digit 24 hour system hour
mm - Two digit minute
YYYY - Four digit year code
@whomwah
whomwah / docker.md
Last active June 19, 2019 09:43
[Docker] useful commands #docker

Execute an interactive bash shell on the container

docker exec -it app-accounting bash

Remove unused volumes

$ docker volume rm (docker volume ls -q -f dangling=true)

Remove all images

@whomwah
whomwah / README.md
Created October 7, 2019 08:23
[Semantic Commit Messages] #git
@whomwah
whomwah / README.md
Created January 29, 2020 09:57
[TMUX] #tmux

Start new session with name

tmux new -s mysession

Attach to existing session

tmux a -t mysession

Attach to last session

tmux a

List sessions

@whomwah
whomwah / README.md
Last active February 7, 2020 16:14
[JS Testing] #js

Helpful JS testing tips

JEST Mocking

Spotify.validateTrack.mockImplementation(trackMock)
Decorator.parse.mockResolvedValue('unifiedMessage')
User.findOneAndUpdate.mockRejectedValue(new Error('bang'))
@whomwah
whomwah / readme.md
Created June 23, 2021 09:07
Utils #utils

example of chopping massive.csv into smaller mini.csv files of 1000 lines

$ brew install coreutils
$ gsplit -dl 10000 --additional-suffix=.csv massive.csv mini
$
$ ls -A1
mini00.csv
mini01.csv
mini02.csv