Skip to content

Instantly share code, notes, and snippets.

View tonetheman's full-sized avatar

Tony Colston tonetheman

View GitHub Profile
@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
@tonetheman
tonetheman / find_radio.py
Created September 27, 2020 15:15
find a radio button to click on
URI = "https://www.16personalities.com/free-personality-test"
from selenium.webdriver import Chrome, ChromeOptions
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
@tonetheman
tonetheman / ReadMaps.py
Created June 30, 2020 13:18
add a size (in k) for maps file in /proc
import sys
pid = None
for i in range(len(sys.argv)):
if sys.argv[i] == "--pid" or sys.argv[i] == "-p":
pid = int(sys.argv[i+1])
inf = open("/proc/{0}/maps".format(pid),"r")
data=inf.readlines()
@tonetheman
tonetheman / main.lua
Created June 28, 2020 23:09
joystick love2d testing
function love.load()
--backgroundImage = love.graphics.newImage("bg2.png")
--mainFont = love.graphics.newFont("m7.ttf", 20)
--love.graphics.setFont(mainFont)
local font = love.graphics.newFont(24)
love.graphics.setFont(font)
screenWidth = love.graphics.getWidth()
screenHeight = love.graphics.getHeight()
internalWidth = 1600
internalHeight = 1200
@tonetheman
tonetheman / CheckSwap.py
Created June 10, 2020 14:25
Show swap for linux processes
import os,glob,string,time,sys
all_the_things = []
class P:
def __init__(self,pid,name,swap):
self.pid = pid
self.name = name
self.swap = swap
def __repr__(self):
return str(self.pid) + " " + str(self.name) + " " + str(self.swap)