Skip to content

Instantly share code, notes, and snippets.

View dsample's full-sized avatar

Duncan Sample dsample

View GitHub Profile
@dsample
dsample / download_class_dojo_archive.py
Created July 18, 2021 08:59 — forked from dedy-purwanto/download_class_dojo_archive.py
Download all photos and videos from your Class Dojo account
"""
Download all ClassDojo photos and videos in your timeline.
by kecebongsoft
How it works:
1. Fetch list of items in the timeline, if there are multiple pages, it will fetch for all pages.
2. Collect list of URLs for the attachment for each item
3. Download the files into local temporary directory, and also save the timeline activity as a json file.
@dsample
dsample / download-classdojo-media.js
Created July 18, 2021 08:59 — forked from travishorn/download-classdojo-media.md
Saving the images and videos from your ClassDojo storyline
/* run this in the console on the ClassDojo page */
function download(url) {
fetch(url).then(function (t) {
return t.blob().then((b) => {
var a = document.createElement("a");
a.href = URL.createObjectURL(b);
var n = url.lastIndexOf("/");
var filename = url.substring(n + 1);
a.setAttribute("download", filename);
@dsample
dsample / 1-yubikey-oath-code.sh
Last active December 6, 2022 09:45
Mac OSX - Automator - Applescript to type in frontmost application
# Make sure the Yubikey CLI (ykman) is installed
# Replace 'FOO' below with a unique string within the name of one of your keys.
# You can get a list using `ykman oath list`
/usr/local/bin/ykman oath accounts code -s "FOO"
@dsample
dsample / Dockerfile
Last active May 8, 2019 15:41
Sonar Scanner as a Docker image
FROM openjdk:latest
RUN curl -sL https://rpm.nodesource.com/setup_12.x | bash - \
&& yum install -y curl unzip \
&& mkdir /sonar \
&& curl -sSL -o /scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.3.0.1492.zip \
&& unzip -qd /sonar/ /scanner.zip \
&& mv /sonar/*/* /sonar/ \
&& rm /scanner.zip \
&& yum erase -y unzip \
@dsample
dsample / .editorconfig
Last active May 9, 2021 20:29
Some files which I usually include within a repo's 'first commit'
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
indent_style = space
indent_size = 2
@dsample
dsample / README.md
Last active April 4, 2019 10:51
Typey Type custom lessons

Typey Type custom lessons

Typey Type is a practise site for stenotype typists. If you don't know what stenotype, or Plover is, it's the method used for closed/open captioning (subtitles) and realtime courtroom transcriptions. Where you may be used to a 'qwerty' layout keyboard with anywhere from 60-110 keys, a stenotype machine has 25-36 keys, and they're played in chords, like a musical keyboard, with each depression of a chord of keys signifying a word (or partial word).

To put some of this together, I've used Plover dictionary lookup tool.

From what I've seen, most people take months or years to learn stenotype. I'm (initially) trying to pick it up in a month, with only a short amount of practise at the beginning of each day. Because of this, I'm going to be trying to think about how to speed up the learning process, and a lot of the beginning lessons here are going to be

@dsample
dsample / README.md
Last active October 16, 2018 09:16
How DNS works

Some example flows for a Medium post about how DNS works.

@dsample
dsample / README.md
Last active April 28, 2018 13:32
Standardised healthcheck API schema

Standardised healthcheck API

This is a draft proposal for OpenAPI, or an extension thereof, which details an approach for microservices to communicate health in a detailed manour.

The depth parameter is intended so that the complete architecture underpinning a service can be discovered.

The bearer header allows services to control access to detailed health information. This also means that integration across boundaries can be controlled using different authoritive identity providers.

@dsample
dsample / README.md
Last active April 19, 2024 23:16
ASCII art diagrams

ASCI art characters for creating diagrams

Characters:

Single line

  • ASCII code 191 = ┐ ( Box drawing character single line upper right corner )
  • ASCII code 192 = └ ( Box drawing character single line lower left corner )
  • ASCII code 193 = ┴ ( Box drawing character single line horizontal and up )
  • ASCII code 194 = ┬ ( Box drawing character single line horizontal down )
@dsample
dsample / yaml2json.js
Created March 8, 2018 17:17
Convert a directory of YAML to JSON
const yaml = require('yamljs')
const fs = require('fs')
const directory = process.argv[2] || '.'
fs.readdirSync(directory)
.filter(f => f.endsWith('.yaml'))
.map(f => f.substring(0,f.indexOf('.yaml')))
.forEach((name) => {
const fromYaml = yaml.load(name + '.yaml')