Skip to content

Instantly share code, notes, and snippets.

@smcl
smcl / .Xresources
Created August 12, 2019 18:29
.Xresources with xterm using solarized (from https://terminal.sexy) and nicely sized mononoki font
XTerm*faceName: mononoki
xterm*faceSize: 12
xterm*termName: xterm-color
xterm*eightBitInput: false
*.vt100.metaSendsEscape: true
! special
xterm*foreground: #586e75
@smcl
smcl / shoppinglist.txt
Created June 27, 2019 11:36
shopping stuff for chata
Snacks
- Pom beeears + chipsy
- something to have with coffe?
Lunch Saturday (carbonara)
- Slanina (a big chunky piece of it)
- Pasta (we have, I think)
Dinner Saturday (pork + pepper/cucumber salad)
- Veprova kotleta x (a few, a couple each?)
@smcl
smcl / rev.j
Last active March 27, 2018 10:49
Reversing a string or array in J
NB. first attempt, took me a whole hour
sub1 =: 1 & (-~)
subtractindices =: ((# sub1) @: #)
forwardindices =: i. @: #
revindices =: (subindices - forwardindices)
revarray =: (({~) revindices)
NB. alternative implementation, I realised you could give a -ve number to "i."
revindices2 =: (i. @: - @: #)
revarray2 =: ({~) revindices2
#!/usr/bin/python
import sys
upto = int(sys.argv[1])
stringsForModulus = {
3: "fizz",
5: "buzz",
7: "bazz"
@smcl
smcl / dobryden.ino
Created May 23, 2017 11:44
quick demo of iso 8859-2 chars on arduino/ssd1306 using adafruit graphics library
#include <stdint.h>
#include <gfxfont.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
char msg[32] = { // can't be bothered counting
0x44, 0x6f, 0x62, 0x72, 0xfd, 0x20, 0x64, 0x65, 0x6e, 0x2c, 0x20, 0x6a, 0x61, 0x6b, 0x20, 0x73, 0x65, 0x20, 0x6d, 0xe1, 0xb9, 0x3f,
NULL
// Slightly updated 5x7 font for ISO8859-2
#ifndef FONT5X7_H
#define FONT5X7_H
#ifdef __AVR__
#include <avr/io.h>
#include <avr/pgmspace.h>
#elif defined(ESP8266)
#include <pgmspace.h>
@smcl
smcl / euler.fsx
Created April 26, 2017 09:30
some useful Project Euler functions
let pair_multiply s1 s2 =
[ for x in s1 do
for y in s2 do
yield (x,y) ]
let enumerate (a:'a[]) =
Array.mapi (fun i x -> (i,x)) a
let pandigital (n:int) =
let a = string(n).ToCharArray()
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@smcl
smcl / prob31.fs
Last active April 14, 2017 18:02
(*
Problem 31 - Coin sums
----------------------
In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation:
1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p).
It is possible to make £2 in the following way:
1×£1 + 1×50p + 2×20p + 1×5p + 1×2p + 3×1p
How many different ways can £2 be made using any number of coins?
*)
@smcl
smcl / sysbench-thinkpad-x250.txt
Created March 7, 2017 22:00
single-core sysbench on the thinkpad x250
$ sysbench --num-threads=1 --test=cpu --cpu-max-prime=20000 --validate run
sysbench 0.4.12: multi-threaded system evaluation benchmark
Running the test with following options:
Number of threads: 1
Additional request validation enabled.
Doing CPU performance benchmark