Skip to content

Instantly share code, notes, and snippets.

View Johann150's full-sized avatar
🔏
all my commits should be signed

Johann150

🔏
all my commits should be signed
View GitHub Profile
@Johann150
Johann150 / example.py
Created March 31, 2024 12:03
python dataclasses ORM
import sqlite3
from typing import Optional
from pprint import pprint
import orm
orm.db = sqlite3.connect(":memory:")
orm.db.row_factory=sqlite3.Row
orm.db.executescript("""
CREATE TABLE foo (id INTEGER PRIMARY KEY, name TEXT NOT NULL) STRICT;
<html>
<head>
<style>
body{
background:#333;
}
.toggle{
display:none;
}
#fold{
@Johann150
Johann150 / BTree.c
Last active February 24, 2020 21:28
https://esolangs.org/wiki/BTree implementation in C89 aka C90 aka ANSI C
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#include<math.h>
#include<string.h>
#include<stdint.h>
void skip_whitespace(FILE* f){
char c;
while(!feof(f)&&isspace(c=getc(f)));
/*
https://esolangs.org/wiki/Procedural_Footnote_Language
conforming to version 1.0.2 of the specification
other avaiable specification versions:
version 1.1 @ https://github.com/vasilescur/pfl/wiki/Procedural-Footnote-Language-Specification
The C++ compiler has to be set to at least version C++ 11.
*/
#include<iostream>
#include<fstream>
#include<string>
#include<stack>
#include<map>
void usage(const char* name){
std::cerr<<name<<" <input> [<file>]\n\nIf the <file> argument is not supplied, the program will be read from stdin."<<std::endl;
}
#include<iostream>
#include<fstream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
int main(int argc,char** argv){
std::streambuf *cinbuf=std::cin.rdbuf(); // save cin buffer in case it is redirected
@Johann150
Johann150 / bsod.html
Created June 25, 2019 09:27
Windows 10 BSoD, altered a little
<html>
<body>
<style>
body{
background-color:#0079d8;
font-family:"Segoe UI";
color:white;
cursor:none;
}
#a{
@Johann150
Johann150 / bf.c
Last active August 17, 2019 00:10
stream brainfuck interpreter (Also supports Alphuck,Ecstatic
/*
A stream brainfuck interpreter, the input will be read only once.
Also supports Alphuc (https://esolangs.org/wiki/Alphuck),
FuckbeEs (https://esolangs.org/wiki/FuckbeEs),
ReverseFuck (https://esolangs.org/wiki/ReverseFuck),
and the whole TrivialBrainfuckSubstitution (https://esolangs.org/wiki/TrivialBrainfuckSubstitution) language family.
*/
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<div style="float:left;">
<textarea id="in" cols="80" rows="30"></textarea><br>
<button onclick="go()">go!</button>
<a href="https://esolangs.org/wiki/Emmental" target="_blank">?</a>
<html>
<head>
<style>
#out{
display:flex;
flex-flow: row no-wrap;
justify-content:center;
margin-bottom: 40px;
}
#out>samp{