Skip to content

Instantly share code, notes, and snippets.

View jsmits's full-sized avatar

Sander Smits jsmits

  • DeepHealth
  • The Netherlands
View GitHub Profile
@jsmits
jsmits / first_working_email_backend.py
Created April 28, 2024 12:44 — forked from tgehrs/first_working_email_backend.py
Django FirstWorkingEmailBackend uses ESP status APIs to find an "up" ESP for sending
# *Untested* implementation of a Django email backend that checks
# several ESP status APIs to see which are working, and uses the first
# available one to send.
#
# This caches the ESP API status check results for one hour (by default).
# You can subscribe to webhook notifications on the ESP status pages
# to force status re-checks after ESPs update their status pages.
#
# See https://github.com/anymail/django-anymail/issues/31 for discussion.
#
@jsmits
jsmits / words.md
Created April 14, 2024 08:42 — forked from fogleman/words.md
Mnemonic Encoding Word List

Mnemonic Encoding Word List

http://web.archive.org/web/20090918202746/http://tothink.com/mnemonic/wordlist.html

  • The wordlist contains 1626 words.
  • All words are between 4 and 7 letters long.
  • No word in the list is a prefix of another word (e.g. visit, visitor).
  • Five letter prefixes of words are sufficient to be unique.
  • The words should be usable by people all over the world. The list is far from perfect in that respect. It is heavily biased towards western culture and English in particular. The international vocabulary is simply not big enough. One can argue that even words like "hotel" or "radio" are not truly international. You will find many English words in the list but I have tried to limit them to words that are part of a beginner's vocabulary or words that have close relatives in other european languages. In some cases a word has a different meaning in another language or is pronounced very differently but for the purpose of the encoding it is still ok - I assume that when the encoding is
@jsmits
jsmits / finetune_llama_v2.py
Created July 21, 2023 14:51 — forked from younesbelkada/finetune_llama_v2.py
Fine tune Llama v2 models on Guanaco Dataset
# coding=utf-8
# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@jsmits
jsmits / convert-arraybuffer.js
Created November 8, 2021 08:18 — forked from nuclearglow/convert-arraybuffer.js
ArrayBuffer <-> JSON <-> ArrayBuffer
// array buffer to JSON
const dataString JSON.stringify(Array.from(new Uint8Array(arrayBuffer)));
// send around
// JSON to ArrayBuffer
new Uint8Array(JSON.parse(dataString)).buffer
@jsmits
jsmits / client.js
Created November 3, 2021 22:15 — forked from hagino3000/client.js
WebSocket with binary data
var socket = null;
function bootstrap() {
// 適当な図形を描画
var c = document.getElementById('mycanvas');
var ctx = c.getContext('2d');
ctx.globalalpha = 0.3;
for(var i=0; i<1000; i++) {
ctx.beginPath();
@jsmits
jsmits / .eslintrc.js
Created June 18, 2020 19:37 — forked from adrianhall/.eslintrc.js
A sample .eslintrc file
var OFF = 0, WARN = 1, ERROR = 2;
module.exports = exports = {
"env": {
"es6": true
},
"ecmaFeatures": {
// env=es6 doesn't include modules, which we are using
"modules": true
"""
DICOM-QR utilities.
Depends on pynetdicom3: https://github.com/scaramallion/pynetdicom3
"""
import json
from typing import Dict, Optional
import click
import structlog
"""Controller code design in Python as guideline for implementing this in Fortran."""
# update: 2017-04-05: PID and switch controllers differ enough from the simple and delta controllers
# that a new code structure plan is justified. In my (Sander's) opinion it's better and more
# future-proof to give each controller its own class and implementation. That way, it's easier
# to add new controller implementations.
# action types
# ============
#
@jsmits
jsmits / nginx
Last active August 29, 2015 14:13 — forked from vdel26/nginx
#!/bin/sh
#
# chkconfig: 2345 55 25
# Description: Nginx init.d script, put in /etc/init.d, chmod +x /etc/init.d/nginx
# For Debian, run: update-rc.d -f nginx defaults
# For CentOS, run: chkconfig --add nginx
#
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
@jsmits
jsmits / reverse_strings.go
Created December 7, 2014 12:25
Reverse strings using a task processor
// Code from my dotGo.eu 2014 presentation
//
// Copyright (c) 2014 John Graham-Cumming
//
// Implement a factory and a task. Call run() on your factory.
package main
import (
"bufio"