Skip to content

Instantly share code, notes, and snippets.

View prail's full-sized avatar
😎
bing chilling

Andrew Teesdale, Jr. prail

😎
bing chilling
View GitHub Profile
@prail
prail / banner_gen.py
Created April 9, 2023 22:19
Generates banner comments for CS227 programs
#!/usr/bin/python3
from sys import argv,exit
if len(argv) != 2: exit(1)
MAX_WIDTH = 72
print('/'+'*'*(MAX_WIDTH - 2)+'/\n/*{}*/'.format(argv[1].center(MAX_WIDTH-4))+'\n/'+'*'*(MAX_WIDTH - 2)+'/')
@prail
prail / center_banners.py
Last active April 9, 2023 22:17
Centers banner comments in CS227 programs
#!/usr/bin/python3
"""
This script finds all banner comments in a Howell (CS227) program and perfectly
centers them, so you won't get any points off on your programs for that.
Prints out the contents of the program just to be safe.
Andrew Teesdale, Jr. (f40c40.com)
"""
import sys
@prail
prail / pcc_stalker_dir.user.js
Created November 14, 2021 03:10
PCC Stalker Directory
// ==UserScript==
// @name Stalker Directory
// @version 1.0
// @description Adds images to the PCC student (stalker) directory.
// @author Andrew
// @match https://eaglesnest.pcci.edu/studentservices/studentdirectory/
// @icon https://www.google.com/s2/favicons?domain=pcci.edu
// @grant none
// ==/UserScript==
@prail
prail / SB.BNF
Last active March 11, 2018 02:58
BNF (sortof) grammar for SmileBASIC.
FULLEXPRESSION -> [ EXPRESSION ]
EXPRESSION -> "(" EXPRESSION ")" || VALUE [ OPERATOPERATOR EXPRESSION ] || UNARYOP SMALLEXPRESSION
SMALLEXPRESSION -> "(" EXPRESSION ")" || VALUE || UNARYOPERATOR [ SMALLEXPRESSION ]
CONSTANTEXPRESSION -> CONSTANT || "(" CONSTANTEXPRESSION ")" || CONSTANT [ CONSTANTOPERATOR CONSTANTEXPRESSION ] || CONSTANTUNARYOPERATOR SMALLCONSTANTEXPRESSION || STRING
SMALLCONSTANTEXPRESSION -> "(" CONSTANTEXPRESSION ")" || CONSTANT || CONSTANTUNARYOPERATOR [ SMALLCONSTANTEXPRESSION ]
CONSTANT -> NUMBER || "PI" "(" ")" || "#RED" etc.
UNARYOPERATOR -> "-" || "NOT" || "!"
OPERATOR -> "+" || "-" || etc.
@prail
prail / polyglot.bat
Created October 23, 2017 17:00
Bash and Batch polyglot. (Really nice for build scripts that need to support multiple platforms.)
echo off
echo ; set +v # > NUL
echo ; function GOTO { true; } # > NUL
GOTO WIN
# bash part, replace it to suit your needs
exit 0
:WIN
REM win part, replace it to suit your needs
@prail
prail / multiplayer.pseudocode
Created October 21, 2017 02:05
Just pseudocode for a simple multiplayer system.
if is host
while waiting for all clients.
send an accept packet to client.
send start packet to all clients.
while gameloop running
while not all data packets recieved
collect data packets from client.
send all packets to each client excluding sender.
update game state.
if is client
@prail
prail / README.md
Last active October 27, 2017 21:28
Gets a random picture from the nasa APOD.

APOD Desktop

To set this up you'll need to set your desktop background to slideshow mode. Create a directory in your pictures folder called APOD The script will put pictures in the directory. Set up a windows service to run the script once a day. profit! The script also creates a file on your desktop named description.txt it contains the pictures descript in a nice readable format if you're curious. Be careful when changing the APOD_DIRECTORY! This directory is removed and recreated very often so don't set it to something important like your Pictures directory.

@prail
prail / list.c
Created October 16, 2017 21:16
Just a linked list program I made for future reference.
#include <stdio.h>
#include <stdlib.h>
typedef struct node_t{
int x;
struct node_t *next;
} node_t;
node_t *list_create(int x,node_t *next) {
node_t *new_node = (node_t *)malloc(sizeof(node_t));
@prail
prail / minigrid.css
Created September 30, 2017 18:51
Miniature css grid framework.
/*
Minigrid.css
Andrew T. 2017
*/
.row {
clear: both;
}
.col {
float: left;
width: 60px;
@prail
prail / nitrobot.user.js
Last active March 22, 2022 00:04
Bot for nitrotype.com. Please see comments below for guide on how to use.
// ==UserScript==
// @name Nitrobot
// @namespace http://ateesdalejr.tk
// @version 1.0
// @description Try to take over nitrotype!
// @author Andrew T.
// @match https://www.nitrotype.com/*
// @grant none
// ==/UserScript==