Skip to content

Instantly share code, notes, and snippets.

View tonetheman's full-sized avatar

Tony Colston tonetheman

View GitHub Profile
@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)
@tonetheman
tonetheman / wl.html
Created February 6, 2020 23:05
html to handle number controls
<!DOCTYPE html>
<html>
<head>
<meta name="viewport"
content="user-scalable=no, width=device-width" />
<style>
input {
border : 3px solid black;
padding : 2px;
@tonetheman
tonetheman / example_classic.lua
Created February 6, 2020 13:22
classic example for lua OO
--[[
example of using
https://github.com/rxi/classic
]]
local Object = require("classic")
local Actor = Object:extend() -- new class
@tonetheman
tonetheman / example_classic.lua
Created February 6, 2020 13:22
classic example for lua OO
--[[
example of using
https://github.com/rxi/classic
]]
local Object = require("classic")
local Actor = Object:extend() -- new class
import random
class Person:
def __init__(self,id):
self.amount = 100
self.id = id
def __repr__(self):
return str(self.id) + " :: " + str(self.amount)
# setup
@tonetheman
tonetheman / c.rkt
Created December 13, 2019 22:28
collatz in racket
#lang racket
(define (foo n)
(if (= (modulo n 2) 0)
(/ n 2)
(+ (* 3 n) 1)
))
(define (goo a)
@tonetheman
tonetheman / workingunittest.rkt
Created December 3, 2019 04:18
working unit test setup
#lang racket
(define a 10)
(module+ test
(require rackunit)
(check-equal? a 10 "making sure a is working")
)
@tonetheman
tonetheman / raytracing.rkt
Created October 27, 2019 13:44
first program in raytracing in a weekend in racket
#lang racket
(define nx 200)
(define ny 100)
(display (string-append "P3\n"
(number->string nx) " "
(number->string ny) "\n255\n"))
(for ([j (in-range (- ny 1) 0 -1)])
@tonetheman
tonetheman / readfile.nim
Created September 24, 2019 12:27
read a file with nim line by line
proc readwholefile() =
let data = readFile("data.txt")
echo(data)
proc justoneline() =
let f = open("data.txt")
defer: f.close()
let firstline = f.readLine()
echo(firstline)
@tonetheman
tonetheman / reallLong.py
Created August 25, 2019 04:22
Really long screenshot in Selenium... kind of full screen
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
mobile_emulation = {
"deviceMetrics": {
"width": 1440, "height": 3*1440,
"pixelRatio": 2.0 },