This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
sub nif_check { | |
my ($nif) = @_; | |
my $check = 0; | |
foreach my $i (reverse 0..7) { | |
$check += substr($nif, $i, 1) * (9-$i); | |
} | |
$check %= 11; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// flashspi | |
// | |
// Small program to use with Arduino to connect to an SPI | |
// flash chip using the SPIMemory library. This program | |
// provides an interface over the serial connection at 115200 | |
// baud that supports the following commands: | |
// | |
// id - prints the JEDEC, manufacturer and unique ID | |
// cap - prints the flash chip's capacity in bytes | |
// dump - dumps the entire chip in hex (xxd format) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74c74 | |
< #define LED_HB 9 | |
--- | |
> // #define LED_HB 9 | |
96c96 | |
< #define LED_HB 7 | |
--- | |
> // #define LED_HB 7 | |
231,232c231,241 | |
< pinMode(LED_HB, OUTPUT); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
code = { | |
'01': 'A', | |
'1000': 'B', | |
'1010': 'C', | |
'100': 'D', | |
'0': 'E', | |
'0010': 'F', | |
'110': 'G', | |
'0000': 'H', | |
'00': 'I', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IDENTIFICATION DIVISION. | |
PROGRAM-ID. ADD. | |
ENVIRONMENT DIVISION. | |
DATA DIVISION. | |
WORKING-STORAGE SECTION. | |
77 IDX PICTURE 9999. | |
77 SUMX PICTURE 999999. | |
77 X PICTURE X. | |
PROCEDURE DIVISION. | |
BEGIN. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- totoro.lua | |
-- | |
-- Small program to get the weather forecast for a location and turn | |
-- on two LEDs that will illuminate Totoro's eyes if it is going to | |
-- rain, hail or snow today | |
-- | |
-- Copyright (c) 2017-2020 John Graham-Cumming | |
local config = require("totoro-config") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ten5 = 100000 | |
ten8 = 100000000 | |
ten9 = 1000000000 | |
ten10 = 10000000000 | |
def krng(x): | |
iterations = x/ten9 + 1 | |
while iterations > 0: | |
step = (x/ten8) % 10 + 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Makes a collage image from a directory full of images | |
# | |
# Assumes all the images are the same size and square | |
from os import listdir | |
from PIL import Image | |
import random | |
import math | |
images = listdir('.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Draw all clock faces where the hands are symmetrically placed either side of the | |
// vertical 12<->6 line | |
void setup() { | |
size(720, 480); | |
// r is each clock's radius | |
// f is a fudge factor used to make space between the clocks | |
int r = 50; | |
int f = 10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addEventListener('fetch', event => { | |
event.respondWith(handleRequest(event.request)) | |
}) | |
async function handleRequest(request) { | |
const response = await fetch("https://csprng.xyz/v1/api?length=10") | |
if (response.status != 200) { | |
return response | |
} |
NewerOlder