Skip to content

Instantly share code, notes, and snippets.

View tonetheman's full-sized avatar

Tony Colston tonetheman

View GitHub Profile
#include <iostream>
#include "raylib.h"
int main(void) {
std::cout << "howdy" << std::endl;
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
@tonetheman
tonetheman / lines.pde
Created May 14, 2022 18:42
interesting processing i saw on twitter lost the link though :(
int n=200,i,s,t;
float a[] = new float[n*4],d;
void setup() {
size(800,800);
colorMode(3);
blendMode(2);
for(i=0;i<n*4;i++) {
a[i] = 400-random(800);
@tonetheman
tonetheman / makefile
Created May 13, 2022 13:18
shows an overwrite in c (not enough space in the array greeting)
# needed to include the no-stack-protector to make gcc
# be fast and loose with the stack
junk : test.c
gcc -o junk -g -fno-stack-protector test.c
clean :
rm -f ./junk
@tonetheman
tonetheman / server.py
Created May 11, 2022 22:44
Python3 http.server that does send back the 2 needed headers for SharedArrayBuffer errors
"""
TONY notes
This is a DIRECT copy pasta of the server.py file in the official cpython github https://github.com/python/cpython/tree/main/Lib/http
I added the following two headers from SHEER FRUSTRATION to get past a random SharedArrayBuffer not defined error
line 749 or so
self.send_header("Cross-Origin-Opener-Policy", "same-origin")
self.send_header("Cross-Origin-Embedder-Policy", "require-corp")
@tonetheman
tonetheman / turtle_frac.py
Created November 20, 2021 16:45
mandelbrot with turtle and Python3
#!/usr/bin/python3
import turtle
import sys
MAX_ITER = 100
def mand(c):
z = 0
n = 0
while abs(z) <= 2 and n < MAX_ITER:
@tonetheman
tonetheman / recur.nim
Created October 11, 2021 14:52
crazy recursive define of is_even and is_odd in nim
# predicate zero or not
proc zero(n : int) : bool =
return n==0
# simple subtract 1
proc sub1(n : int) : int =
return n-1
# forward defs since this is recursive
@tonetheman
tonetheman / syscall_with_rust.rs
Last active August 23, 2021 13:38
rust syscall
#![feature(llvm_asm)]
fn main() {
let message = String::from("hello world tony!\n");
syscall(message);
}
#[cfg(target_os = "linux")]
#[inline(never)]
fn syscall(message: String) {
let msg_ptr = message.as_ptr();
program TestMe;
var
i : Longint;
x : Longint = 0;
y : Real = 0;
begin
for i:=0 to 116000 do
begin
x := i;
@tonetheman
tonetheman / install-love-crontini.sh
Created January 2, 2021 20:15
Install love2d in crostini on a chromebook
git clone git@github.com:love2d/love.git
cd love
git checkout 11.3
sudo apt-get install autoconf
sudo apt-get install libtool
platform/unix/automagic
sudo apt-get install libsdl2-dev
sudo apt-get install libluajit-5.1-dev
sudo apt-get install libopenal-dev
sudo apt-get install libfreetype6-dev
@tonetheman
tonetheman / test_objects_in_nim.nim
Last active December 14, 2020 04:28
Testing objects in nim lang. Trying to understand the overloads
# define an object type
type Foo = object
x : int
y : int
name : string
# define a proc that takes a Foo
# I named it self for no real reason
proc bob(self:Foo) =
echo "foo.bob",self