Skip to content

Instantly share code, notes, and snippets.

View khodges42's full-sized avatar
💭
on that anime profile picture on github type energy

K. Hodges khodges42

💭
on that anime profile picture on github type energy
  • LA
View GitHub Profile
@khodges42
khodges42 / tt_events.py
Created October 24, 2021 06:43
tabletop.events python middleware demo
import requests
class Event:
def __init__(self, convention_id, session_id, name, max_tickets, duration, age_range, preferreddaypart_id, alternatedaypart_id, priority, type_id):
self.url = 'https://tabletop.events/api/event'
self.convention_id = convention_id
self.session_id = session_id
self.name = name
self.max_tickets = max_tickets
self.priority = priority
@khodges42
khodges42 / shapes.pde
Created October 21, 2020 20:04
science project
void setup() { // The setup function runs once when you start the program.. so we put all of the stuff we only want to run once
size(1000,1000); // the screen size. Change these around!
background(0,20,0); // the background color, 0-255 red, green, blue
textSize(20); // size of text. 20 seems like a good size
fill(255, 102, 153); // the color of the shape (red, green, blue)
}
// Setting some variables. We set them outside of functions so they can be shared by the whole program (global)
int SHAPE_SIDES = 3; // Number of sides to the shape. 3 is a triangle, 4 is a square, 100000 is a smooth circle
int SHAPE_SIZE = 500; // Size of the shape. 500 fills the screen!
@khodges42
khodges42 / target_dag_transpiler.py
Created January 23, 2020 03:17
Builds a c program to identitfy a target based on a dag
import random
import string
has_nginx = {
"indicators": {
"file_exists":
{"/lib/systemd/system/nginx.service": {
"score": 1,
"terminate_on_failure": True
}}
@khodges42
khodges42 / hue_disco.py
Created September 4, 2019 06:09
hue_disco.py
import time, random
from qhue import Bridge
b = Bridge("192.168.1.107", "longusernamestring")
lights = b.lights
light1bright = 0
light2bright = 254
# i swear i know how to write python but i am lazy and this was for a meme
@khodges42
khodges42 / headphoneswitcher.py
Created April 15, 2019 03:07
hacky way to switch headphone to speakers in windows. Requires nircmd.exe in the same dir.
import os
try:
os.stat("./.switch")
switcher = 1
os.remove("./.switch")
except:
file = open("./.switch", "w")
switcher = 0
@khodges42
khodges42 / deb9-openbox-64bit-POST-INSTALL-SCRIPT.sh
Last active June 23, 2020 10:00 — forked from oksage/deb9-openbox-64bit-POST-INSTALL-SCRIPT.sh
This is a script for 'apt installing' openbox (etc) after installing debian 9 (stretch) netinstall (unselected the desktop environment during install)
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "Permission denied"
exit 1
fi
if [ -z "$SUDO_USERS" ]
then
echo "\$SUDO_USERS is empty. Using $(ls /home)"
SUDO_USERS=$(ls /home)
@khodges42
khodges42 / conway.go
Last active August 3, 2018 17:47
game of life in go
package main
import (
"fmt"
"math/rand"
"time"
)
const (
width = 20
@khodges42
khodges42 / curses_wm
Last active July 18, 2018 19:16
Curses Window Manager Example
import sys,os
import curses
import time
import random
from asciitree import LeftAligned
from collections import OrderedDict as OD
from scapy import data
import random
import string
@khodges42
khodges42 / curses_screens.py
Last active July 18, 2018 13:58
dope curses thing
import sys,os
import curses
import time
import random
from asciitree import LeftAligned
from collections import OrderedDict as OD
from scapy import data
import random
import string
@khodges42
khodges42 / jupyter2python
Created July 11, 2018 23:49
Convert Jupyter Notebook to Python file inside the notebook itself
%%javascript
IPython.notebook.kernel.execute("!jupyter nbconvert --to script " + IPython.notebook.notebook_name);
// This saves the current notebook as a python file with the same name.