Skip to content

Instantly share code, notes, and snippets.

View alexdunae's full-sized avatar

Alex Dunae alexdunae

View GitHub Profile
31658bad48a1e6882c4b6a7e6b8d82be@example.com
95e9ea69b69fe64bbf4b9d3f12bd976e@example.com
6a16beb4c341de45352dc28edf3c65f2@example.com
2802d5ebd8ee9398741b9be44f58111c@example.com
eec4a102023e0b994a96f51c82dbefb8@example.com
3741b79946265b4efca7a516f71f5c7b@example.com
3ef9ee323e51c2265e74a30d73b16b3a@example.com
922ac33cb02f0836fa8a90ca7a0c7d0b@example.com
83e93ecc72be424078564c77b4c1555e@example.com
3c785b34c06d62b312e6a08739cd6f5d@example.com
b46202ef5b16076fddcb3ea6dec33e7a@example.com
6b539f68dd51778626e63b640427f5cd@example.com
07afa1777af8f602b6385659135cc455@example.com
dd59527c1cd2b540ff561d5669095f49@example.com
c47dd25ece6210c7c36c676d1e6a05a6@example.com
151109cec2a0c11cfe24d250ea8543ff@example.com
7322500a1849101a51424c47e642fa00@example.com
0f05a54ff760734a365633b30518c351@example.com
2f11fbef0db322edaad9427e6a27c0cc@example.com
f5e0a13eb0562d01511160875227ca80@example.com
@alexdunae
alexdunae / day01.cr
Last active December 2, 2021 19:51
Advent of Code 2021 Ruby vs Crystal
file = "input.txt"
increases = 0
last_window = nil
a = nil
b = nil
c = nil
File.each_line(file) do |measurement|
@alexdunae
alexdunae / README.md
Last active September 21, 2021 01:58

BC COVID-19 Vaccine Passport

BC's COVID-19 vaccine passport is encoded as a JSON web token following the SMART Health Card open spec.

I made a little write up about how to decode the data.

Vax codes

You can inspect the http://snomed.info/sct coding key to see which type of vaccines were recorded:

import React, { useState, useEffect } from 'react';
import PropTypes from 'prop-types';
const EventSalesReport = props => {
const [open, setOpen] = useState(false);
const [count, setCount] = useState(0);
console.log(`render: open is ${open}`);
const handleDocumentClick = function(event) {
@alexdunae
alexdunae / ReactNativeJson.java
Last active May 13, 2018 18:04 — forked from viperwarp/ReactNativeJson.java
React-Native Module, ReadableMap/Array to Java JSON objects
public static WritableMap convertJsonToMap(JSONObject jsonObject) throws JSONException {
WritableMap map = new WritableNativeMap();
Iterator<String> iterator = jsonObject.keys();
while (iterator.hasNext()) {
String key = iterator.next();
Object value = jsonObject.get(key);
if (value instanceof JSONObject) {
map.putMap(key, convertJsonToMap((JSONObject) value));
} else if (value instanceof JSONArray) {
<?php
add_action( 'rest_api_init', function () {
register_rest_route( 'salmon/v1', '/salmonnames', array(
'methods' => 'GET',
'callback' => 'get_salmon_names',
) );
} );
# Redis configuration file example
# Note on units: when memory size is needed, it is possible to specifiy
# it in the usual form of 1k 5GB 4M and so forth:
#
# 1k => 1000 bytes
# 1kb => 1024 bytes
# 1m => 1000000 bytes
# 1mb => 1024*1024 bytes
# 1g => 1000000000 bytes
# from https://github.com/drKreso/guerrilla_patch
class Allocate
attr_accessor :amount
attr_accessor :ratios
def self.evenly(amount, number_of_slices)
Allocate.new.tap do |a|
a.amount = amount
a.ratios = (1..number_of_slices).map { 1.to_d/number_of_slices }
end.divided