Skip to content

Instantly share code, notes, and snippets.

Duncan Sample dsample

Block or report user

Report or block dsample

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dsample
dsample / Dockerfile
Last active May 8, 2019
Sonar Scanner as a Docker image
View Dockerfile
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 28, 2019
Some files which I usually include within a repo's 'first commit'
View .editorconfig
# 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 Apr 4, 2019
Typey Type custom lessons
View README.md

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 Oct 16, 2018
How DNS works
View README.md

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

@dsample
dsample / README.md
Last active Apr 28, 2018
Standardised healthcheck API schema
View README.md

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 Mar 19, 2018
ASCII art diagrams
View README.md

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 Mar 8, 2018
Convert a directory of YAML to JSON
View yaml2json.js
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')
View framebuffer.py
import os
import pygame
import time
import random
class pyscope :
screen = None;
def __init__(self):
"Ininitializes a new pygame screen using the framebuffer"
@dsample
dsample / README.md
Created Nov 16, 2016
A JavaScript snippet to help 'leave' many repositories where you have been added as a contributor
View README.md

I got added as a contributor in ~400 repositories in my organisation by accident. This JavaScript helped me undo that problem. Just head over to https://github.com/settings/repositories, change the logic for which repositories you want to leave and then run the leaveOne as many times as necessary.

@dsample
dsample / README.md
Created Aug 11, 2016
Node-RED Flows
View README.md

These Node-RED snippets accompany a blog post I wrote about using Docker and Node-RED on a Raspberry Pi to integrate IoT devices.

You can’t perform that action at this time.