Skip to content

Instantly share code, notes, and snippets.

@Frank-Buss
Frank-Buss / riscv.md
Created July 30, 2023 02:58
run RISC-V assembler on x86_64 Debian Linux

Run RISC-V assembler programs on Debian Linux

This tutorial shows how to compile and run RISC-V assembler code on Debian Linux systems, which are not running on a RISC-V system (e.g. x86_64).

Install the toolchain and emulator

sudo apt-get install qemu qemu-system-misc qemu-user gcc-riscv64-unknown-elf

Create a hello world program

Save this as hello.s:

@Frank-Buss
Frank-Buss / move.py
Created January 11, 2023 21:48
PyGame sprite movement
# ChatGPT result of this question:
# write a Python script, where the user can move a sprite with cursor keys, using PyGame
import pygame
# Initialize PyGame
pygame.init()
# Set up the screen (width, height, caption)
size = (700, 500)
@Frank-Buss
Frank-Buss / test.cljs
Last active December 4, 2022 02:04
first Clojure code, day 3 of advent of code 2022
(ns test
(:require [clojure.string :refer [split-lines]])
(:require [clojure.set :refer [intersection]]))
(def rucksacks "vJrwpWtwJgWrhcsFMMfFFhFp
jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL
PmmdzqPrVvPwwTWBwg
wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn
ttgJtRGJQctTZtZT
CrZsJsPPZsGzwwsLwLmpwMDw")
@Frank-Buss
Frank-Buss / diagram-test.md
Created November 9, 2022 06:11
testing some mermaid diagrams

Sequence Diagram test

sequenceDiagram
participant Alice
participant Bob
Alice->>John: Hello John, how are you?
loop Healthcheck
    John->>John: Fight against hypochondria
end
Note right of John: Rational thoughts prevail!
@Frank-Buss
Frank-Buss / test.c
Created August 19, 2022 17:14
printing call stack on assert and segfaults
#include <assert.h>
#include <signal.h>
#include <stdio.h>
#include <execinfo.h>
/*
compile this program like this:
gcc -Wall -O0 -g -fsanitize=address -fno-omit-frame-pointer -finstrument-functions test.c -o test
@Frank-Buss
Frank-Buss / sell.py
Created May 7, 2022 07:14
listing NFTs on OpenSea for sale with Selenium and a Python script
# library installation:
# pip3 install -U selenium
# pip3 install webdriver-manager
#
# usage:
# first start Chrome in debug mode:
# google-chrome --remote-debugging-port=1234
# then:
# - sign in to MetaMask and select right network and account
# - connect to OpenSea
@Frank-Buss
Frank-Buss / star.cpp
Created April 19, 2022 23:49
star scroller effect program for Watcom C and DOS, which I wrote in 1995
#include <conio.h>
#include <time.h>
#include <stdlib.h>
extern void waitvsync();
extern unsigned short setvideomode();
extern void restorevideomode(unsigned short old);
extern void setcolor(unsigned short farbe);
extern void setpixel(unsigned short x,unsigned short y);
@Frank-Buss
Frank-Buss / coinquote.sh
Created February 6, 2022 01:36
get the quote for a crypto currency from coinmarketcap in USD
#!/bin/bash
# first create an API key at coinmarketcap.com. It is free for personal use. Set it in a variable:
export API_KEY="11111111-1111-1111-1111-111111111111"
# now you can call the API with curl, and extract the result with jq
# for example to get the quote for a crypto currency in USD:
coinquote() {
curl -s -H "X-CMC_PRO_API_KEY:$API_KEY" -H "Accept:application/json" \
-d "symbol=$1&convert=USD" \
@Frank-Buss
Frank-Buss / output.txt
Last active January 15, 2022 10:05
handshake test
starting server
receive address: rs1qahw577c0p6t95vsuz9ets6zdu3tewl2uu7mgh0
mining coins
name: metaroot
blocks until auction starts: 6
blocks until auction reveal: 4
blocks until auction close: 9
record on the blockchain:
{
"records": [
@Frank-Buss
Frank-Buss / infix.lisp
Created May 20, 2021 12:37
infix to prefix function and reader macro in Common Lisp
;;;; infix to prefix function and reader macro
;; BSD 2-Clause License
;;
;; Copyright (c) 2021, Frank Buss
;; All rights reserved.
;;
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions are met:
;;