Skip to content

Instantly share code, notes, and snippets.

View pragdave's full-sized avatar
🖍️
Alternating between Haskell and PDP-11 assembler

Dave Thomas pragdave

🖍️
Alternating between Haskell and PDP-11 assembler
View GitHub Profile
@pragdave
pragdave / clip.swift
Created September 2, 2018 02:33
Remove background color from code copied from Visual Studio Code
// If you paste code from Visual Studio Code into another app on
// OS X, it will apply the current theme's background.
//
// This trivial program takes no parameters. It simply reads
// HTML from the clipboard, and removes the background-color
// attribute. Because I'm pasting into Keynote, it also
// bumps the font size.
//
// in VSC:
// select some code and copy (Cmd C)
@pragdave
pragdave / settings.json
Created June 24, 2018 21:05
Lighten underscore syntax highlighting in vcs materialtheme
"editor.tokenColorCustomizations": {
"[Material Theme Darker High Contrast]": {
"textMateRules": [
{
"scope": [
"comment.unused.elixir",
],
"settings": {
"foreground": "#b5c3a3",
}

Elixir Assignment #3

Over the next few weeks we'll be implementing the game of mastermind.

A quick recap. The game is played with a bag containing lots of colored pegs. Typically there are 6 distinct colors, and there will be multiple pegs of each.

One player sets a challenge by picking four pegs and placing them in sequence somewhere the other player can't see. The other player takes

@pragdave
pragdave / codeword.ex
Created February 21, 2018 20:22
LSE18 Codework downloader
defmodule DownloadCodeword do
import String, only: [from_char_list!: 1]
def start(_,_) do
{ :ok, self }
end
def main([yyyy, mm, dd]) do
@pragdave
pragdave / diet_runner.ex
Created February 21, 2018 19:57
Code Extract: diet :"r" command
defp command("r", args, state) do
args = if String.starts_with?(args, ":") && String.contains?(args, " ") do
String.replace(args, " ", ", ", global: false)
else
args
end
args = if String.contains?(args, ",") && !String.starts_with?(args, "{") do
"{ #{args} }"
else
;; Mode line setup
(setq-default
mode-line-format
'(; Position, including warning for 80 columns
(:propertize "%4l" face mode-line-position-face)
":"
(:eval (propertize "%c" 'face
(if (>= (current-column) 80)
'mode-line-80col-face
'mode-line-position-face)))
generate_match_vars([{Key, Value, Expr} | T], ClauseVars, Left, Right) ->
case maps:find(Key, ClauseVars) of
{ok, Value} ->
generate_match_vars(T, ClauseVars, Left, Right);
{ok, Clause} ->
generate_match_vars(T, ClauseVars,
[{var, 0, element(1, Value)} | Left],
[{var, 0, element(1, Clause)} | Right]);
error ->
generate_match_vars(T, ClauseVars,
#START:solver1
defmodule FibSolver do
def fib(scheduler) do
send scheduler, { :ready, self }
receive do
{ :fib, n, client } ->
send client, { :answer, n, fib_calc(n), self }
fib(scheduler)
{ :shutdown } ->
# -*- coding: utf-8 -*- #
module Rouge
module Lexers
class EmbeddedJSX < RegexLexer
tag :xml_inside_jsx
def self.analyze_text(text)
0
end
provision_list:
############################################
"staging-apps+search":
############################################
env: staging
count: 1
roles:
master: yes # has all the background services (cron)