Skip to content

Instantly share code, notes, and snippets.

@ianklatzco
ianklatzco / discord-bot-post-message.sh
Created December 29, 2016 02:36
sends a message to a discord channel via a bot using command line HTTP POST- curl
#!/bin/bash
# update the TOKEN and the CHANNELID, rest is optional
# you may need to connect with a websocket the first time you run the bot
# use a library like discord.py to do so
curl -v \
-H "Authorization: Bot TOKEN" \
-H "User-Agent: myBotThing (http://some.url, v0.1)" \
-H "Content-Type: application/json" \
@ianklatzco
ianklatzco / discord-bot-post-message.py
Created December 29, 2016 02:29
sends messages to a discord channel using a bot via http POST
# post a message to discord api via a bot
# bot must be added to the server and have write access to the channel
# you may need to connect with a websocket the first time you run the bot
# use a library like discord.py to do so
import requests
import json
channelID = "your_id_goes_here" # enable dev mode on discord, right-click on the channel, copy ID
botToken = "your_token_here" # get from the bot page. must be a bot, not a discord app
@ianklatzco
ianklatzco / Zelda Chest Noise
Last active September 12, 2019 09:03
Plays the chest noise from Legend of Zelda to a speaker or piezoelectric. Should be used with arduino; also works with a 1MHz attiny if you use the second script.
/* This code is derived from:
* http://www.arduino.cc/en/Tutorial/Melody
* This plays the chest noise from the Legend of Zelda on a piezo buzzer connected to pin 9 and ground. It has been tuned to a buzzer I had on hand, but you may want to adjust the values, testing against a tuner.
*/
int speakerPin = 0;
const int switchPin = 1;
char notes[] = "gabygabyxzCDxzCDabywabywzCDEzCDEbywFCDEqywFGDEqi azbC"; // a space represents a rest
int length = sizeof(notes); // the number of notes
@ianklatzco
ianklatzco / catfact.py
Last active September 5, 2019 12:30
send cat facts to your friends logged into a ews/server. netid = username if you're not from uiuc
# if netid is logged in, send a random cat fact to all of its terminals.
# usage: crontab -e. paste in:
# 0 * * * * python ~/catfact.py
# logs in ~/victims.txt
# why did i spend so much time on this.
# this got me banned from the school servers for two days
messagechance = 5 # 1 is 1%, 99 is 99%. keep in mind this will only run if they're logged in.
postscript = '\n this has been an automated cat fact. contact me to unsubscribe. or to subscribe others.\n'
listofnetids = ['netids','go','here']
@ianklatzco
ianklatzco / ghidra-disassembly.c
Created April 22, 2019 09:28
crappy dbi for asisctf
undefined8 check_secret_id(char *user_input)
{
int iVar1;
int iVar2;
int user_input_(int);
long lVar3;
size_t sVar4;
size_t sVar5;
@ianklatzco
ianklatzco / readme.md
Last active January 2, 2019 05:58
Python testcode for ECE411

These scripts automatically compile RISC-V code, simulate it with the command line version of ModelSim, and report the time it took to run the code in nanoseconds.

It is particularly useful for the final part of the course, where you will be tweaking your CPU for performance, but you might get some use out of modifying the scripts a bit for the earlier MPs as well.

Assumptions:

  • Your code lives in ~/ece411/reponame.
  • rv_load_memory.sh is in reponame/testcode.
@ianklatzco
ianklatzco / install-tg.sh
Created May 8, 2017 03:18
install tg/telegram-cli on linux
#!/bin/bash
git clone --recursive https://github.com/vysheng/tg.git && \
cd tg && \
sudo apt-get update -y && sudo apt-get install libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev libevent-dev libjansson-dev libpython-dev make && \
./configure && \
make && \
cd ./bin && \
./telegram-cli
@ianklatzco
ianklatzco / do-codes.txt
Created November 16, 2017 17:29
digital ocean coupon codes except minus a referral link like that other guy has posted
LOWENDBOX DROPLET10 ALLSSD10 DODEPLOY SHIPITFAST10 OMGSSD10 FRANKFURT
@ianklatzco
ianklatzco / potd.sh
Created October 21, 2016 18:36
automatically scp/run potd checkout script to ews
#!/bin/bash
# ian klatzco 6 september 2016, some modifcation thru the semester
# WARNING
# make sure you don't have more than the most recent checkout-potd-q*.py file in the directory you set up this script to run in, or else you're gonna have a bad time (multiple downloads of files you've already download, and i am not sure what's gonna happen to your old code)
# WILL WIPE ALL OLD POTD DOWNLOAD SCRIPTS
# ASSUMES
# daily potd download script is dl'd to ~/Downloads
@ianklatzco
ianklatzco / hexGenerator.sh
Last active June 16, 2016 21:14
test if lab2 for ECE220 works. download em into the directory containing your lab2.obj, chmod +x both of them, run "hexGenerator.sh > hex" and "test.sh > test" and then "diff test hex". if you get no output, you're golden.
#!/bin/bash
max=65535
for((i=0;i<=max;i++))
do
printf "%.4X\n" $i
done