Skip to content

Instantly share code, notes, and snippets.

@chomy
chomy / universal-color.tex
Created August 3, 2023 07:49
Universal color definition for LaTeX
% Define color for universal design
% https://jfly.uni-koeln.de/colorset/
\definecolor{red}{cmyk}{0, .75, .90, 0}
\definecolor{yellow}{cmyk}{0, 0, 1, 0}
\definecolor{green}{cmyk}{.75, 0, .65, 0}
\definecolor{blue}{cmyk}{1, .45, 0, 0}
\definecolor{skyblue}{cmyk}{.55, 0, 0, 0}
\definecolor{pink}{cmyk}{0, .55, .35, 0}
\definecolor{orange}{cmyk}{0, .45, 1, 0}
\definecolor{purple}{cmyk}{.30, .95, 0, 0}
@chomy
chomy / jmv2json.py
Last active October 10, 2020 09:37
JMV3.0 parser
#!/usr/bin/python3
from datetime import datetime
from datetime import timedelta
import json
import sys
class JVMParser:
def parse_header(self, line, result):
row = tuple(filter(lambda a: a != '', line[0].split(' ')))
result['issued time'] = datetime.strptime(row[5] + 'GMT', '%y%m%d%H%M%S%Z').isoformat()
@chomy
chomy / gist:4c43b46f30760277554f95c091fd74e7
Created October 7, 2019 08:56
Partition table of USB memory
Disk /dev/sdb: 57.8 GiB, 62075699200 bytes, 121241600 sectors
Disk model: MF-FCU3
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000
Device Boot Start End Sectors Size Id Type
/dev/sdb1 32 121241599 121241568 57.8G c W95 FAT32 (LBA)
@chomy
chomy / blink.c
Created January 18, 2018 08:38
LED blink for Nucleo STM32F103
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chomy
chomy / colormap.py
Last active July 25, 2017 02:56
generate jet colormap
#!/usr/bin/python3
from matplotlib import cm
N = 3000
cm.jet.N = N
for i in range(N):
color = map(lambda x:int(x*255), cm.jet(i))
print('%d %d %d %d 1'%(i,color[0],color[1],color[2]))
@chomy
chomy / suffix.lisp
Created July 24, 2017 10:16
PFDS: Exercise 2.1
(defun suffix (l)
(labels ((iterator (lst result)
(if (null lst)
result
(iterator (cdr lst) (append result (list lst))))))
(iterator l '())))