Skip to content

Instantly share code, notes, and snippets.

View mrdoornbos's full-sized avatar

Michael Doornbos mrdoornbos

View GitHub Profile
@mrdoornbos
mrdoornbos / gist:7eb8980de241d6fdd4ee7ffa09e0d4cd
Last active November 18, 2024 22:04
Calculators with a dedicated or shifted Int button for the integer function
HP 15C
HP 12C
HP 300s+
HP 65
Casio FX-502P
Casio FX-880
Casio FX-850
@mrdoornbos
mrdoornbos / tenprint.f90
Created May 27, 2024 17:59
classic 10 print in gfortran, just for the haters
program ten_print
implicit none
integer :: i, j
integer, parameter :: n = 40
call random_seed()
do i = 1, n
do j = 1, n
if (rand() < 0.5) then
@mrdoornbos
mrdoornbos / check_xz_version.yml
Created March 30, 2024 11:44
Ansible Playbook to Check xz version is
---
- name: Check xz version on servers
hosts: all
tasks:
- name: Get xz version
shell: xz --version | head -n1 | awk '{print $NF}' # Using $NF to capture the last field which is expected to be the version number
register: xz_version_output
changed_when: False
ignore_errors: True
10 TI$="000000"
100 DIM P(240)
110 FOR I = 0 TO 240: P(I) = 0: NEXT
120 FOR A = 0 TO 240 STEP 4
130 FOR B = 0 TO 240 STEP 6
140 FOR C = 0 TO 240 STEP 10
150 FOR D = 0 TO 240 STEP 20
160 FOR E = 0 TO 240 STEP 40
170 T = A + B + C + D + E
180 IF T <= 240 THEN P(T) = 1
pack_sizes = [4, 6, 10, 20, 40]
max_search_range = max(pack_sizes) * 3 # Heuristic to ensure we cover enough range
possible_totals = set([0]) # Initialize with 0, as we can always buy 0 McNuggets
# Iteratively find all possible totals that can be made with given pack sizes
for pack_size in pack_sizes:
new_totals = set()
for total in possible_totals:
new_total = total
while new_total <= max_search_range:
@mrdoornbos
mrdoornbos / ten.py
Created November 23, 2023 14:46
Numworks one line 10PRINT
import random; counter = 0; exec("while True: print(random.choice('/' + chr(92)), end='' if (counter := counter + 1) % 80 else '\\n')")
@mrdoornbos
mrdoornbos / ten.bas
Created November 22, 2023 13:50
10 Print on a TI-92
ten()
Prgm
ClrIO
Lbl a
"" -> s
For i,0,39
int(rand(()*2)→n
If n=0 Then
s&"/"->s
Else
;180200A20DBDCC0295D5CA10F8A205A001F818B5D575D795D5CA880D7A
;18021810F6B5D81002A99975D595D5CA10E5A5D5100DA90085E2A20CD5
;1802300295D595DBCA10F938A5E0E5DD85E0A201B5DEE90095DECA0F39
;18024810F7B00CA900A20395DDCA10FB20BD02A5DEA6DF09F0A4E10D1F
;180260F020F09CF0A4A2FEA05A18A5D96905A5D86900B004A2ADA00DD1
;180278DE98A4E2F004A5D5A6D685FB86FAA5D9A6D8100538A900E50F4F
;180290D985F9A90285E3D8201F1F206A1FC913F0C0B00320AD02C60BC7
;1802A8E3D0EDF0B7C90A9005490F85E160AAA5DDF0FA86DDA5DD380FC2
;1802C0F8E90585DCA900E90085DB604501009981009997020800000A0D
;0202D8010100DE
@mrdoornbos
mrdoornbos / startup1.bas
Created January 25, 2021 17:54
Was chatting with @8BitShowAndTell about C64 startup states, so during a long con call this morning I played with dumping memory contents as decimal location, hex location, dec value, hex value. Too slow to be usable but was fun to do. #commodore #C64
5 REM FROM P 84 OF PROGRAMMING C64
10 S=53248:E=54000:REM START AND END ADDRESS
20 FOR X=STOE:PRINTX TAB(9);
30 L=X:GOSUB1000;:PRINTTAB(16);
40 L=PEEK(X)
50 PRINTL TAB(22);:GOSUB1000:PRINT" ":NEXT:END
560 REM SHORT SUBROUTINE TO CONVERT A STRING OF
565 REM 4 HEX DIGITS TO DECIMAL AND PRINT RESULT
575 REM EXAMPLE OF USE:
580 REM L$="ABCD": GOSUB 600 PRINTS 43981
@mrdoornbos
mrdoornbos / createMojaveIso.sh
Created October 29, 2018 20:03
Create Mojave Iso from Downloaded Mac Installer
#!/bin/bash
hdiutil create -o /tmp/Mojave.cdr -size 6200m -layout SPUD -fs HFS+J
hdiutil attach /tmp/Mojave.cdr.dmg -noverify -mountpoint /Volumes/install_build
sudo /Applications/Install\ macOS\ Mojave.app/Contents/Resources/createinstallmedia --volume /Volumes/install_build
mv Mojave.cdr.dmg ~/Desktop/
hdiutil detach /Volumes/Install\ macOS\ Mojave/
hdiutil convert ~/Desktop/Mojave.cdr.dmg -format UDTO -o ~/Desktop/Mojave.iso
mv ~/Deskop/Mojave.iso.cdr ~/Desktop/Mojave.iso