Skip to content

Instantly share code, notes, and snippets.

View AndyNovo's full-sized avatar

Andy Novocin AndyNovo

View GitHub Profile
#data derived from http://www.data-compression.com/english.html
freqs = {'a': 0.080642499002080981, 'c': 0.026892340312538593, 'b': 0.015373768624831691, 'e': 0.12886234260657689, 'd': 0.043286671390026357, 'g': 0.019625534749730816, 'f': 0.024484713711692099, 'i': 0.06905550211598431, 'h': 0.060987267963718068, 'k': 0.0062521823678781188, 'j': 0.0011176940633901926, 'm': 0.025009719347800208, 'l': 0.041016761327711163, 'o': 0.073783151266212627, 'n': 0.069849754102356679, 'q': 0.0010648594165322703, 'p': 0.017031440203182008, 's': 0.063817324270355996, 'r': 0.06156572691936394, 'u': 0.027856851020401599, 't': 0.090246649949305979, 'w': 0.021192261444145363, 'v': 0.010257964235274787, 'y': 0.01806326249861108, 'x': 0.0016941732664605912, 'z': 0.0009695838238376564}
sum_f_squared = 0.0
sum_f = 0.0
for key in freqs:
sum_f += freqs[key]
sum_f_squared += freqs[key]**2
print sum_f
@AndyNovo
AndyNovo / auth.sql
Created March 8, 2016 15:24
SQL Injection attack vulnerable login
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE users (username text, pwd text);
INSERT INTO "users" VALUES('admin','5743abddddfa08c1e3a99fdebc2e8f3f1108fa12dcd2a8f58a42f141418c22ec');
INSERT INTO "users" VALUES('student','5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8');
COMMIT;
@AndyNovo
AndyNovo / minestax.mcd
Last active November 7, 2022 05:12
MineStax mc86 interpreter in one mcd book.
/give @p minecraft:writable_book{pages:["/say Welcome to Minestax","/scoreboard objectives add udctf dummy","/scoreboard players set 1 udctf 1","/scoreboard players set 0 udctf 0","/execute at @e[type=minecraft:armor_stand,nbt={\"Tags\":[\"idx\"]}] run fill ~ ~ ~-200 ~ ~64 ~200 air replace","/kill @e[type=minecraft:armor_stand,nbt={\"Tags\":[\"idx\"]}]","/summon minecraft:armor_stand ~10 ~ ~ {CustomNameVisible:1b,CustomName:\"\\\"idx\\\"\",Tags:[\"idx\"],HandItems:[{id:white_concrete_powder,Count:1b},{id:black_concrete_powder,Count:1b}]}","/execute at @e[type=minecraft:armor_stand,nbt={\"Tags\":[\"idx\"]}] run setblock ~ ~-1 ~ minecraft:white_concrete_powder replace", "/data modify block ~-4 ~ ~ Items set value [{Slot:0b,id:writable_book,Count:1b,tag:{pages:[\"data modify block ~-4 ~ ~ Items[0].tag.pages set from block ~-4 ~ ~ Items[3].tag.pages\", \"say run\"]}},{Slot:1b,id:writable_book,Count:1b,tag:{pages:['l','i','i','d','s','d','s','d','s','s','l','l','i','i','i','s','c','l','i','s','c','l','i','i','s','
#put a black and white PNG in the same directory (replace helloworld.png) and copy the output into a command block
template = """/give @p minecraft:writable_book{pages:["/say Welcome to Minestax","/scoreboard objectives add udctf dummy","/scoreboard players set 1 udctf 1","/scoreboard players set 0 udctf 0","/execute at @e[type=minecraft:armor_stand,nbt={\"Tags\":[\"idx\"]}] run fill ~ ~ ~-200 ~ ~64 ~200 air replace","/kill @e[type=minecraft:armor_stand,nbt={\"Tags\":[\"idx\"]}]","/summon minecraft:armor_stand ~10 ~ ~ {CustomNameVisible:1b,CustomName:\"\\\"idx\\\"\",Tags:[\"idx\"],HandItems:[{id:white_concrete_powder,Count:1b},{id:black_concrete_powder,Count:1b}]}","/execute at @e[type=minecraft:armor_stand,nbt={\"Tags\":[\"idx\"]}] run setblock ~ ~-1 ~ minecraft:white_concrete_powder replace", "/data modify block ~-4 ~ ~ Items set value [{Slot:0b,id:writable_book,Count:1b,tag:{pages:[\"data modify block ~-4 ~ ~ Items[0].tag.pages set from block ~-4 ~ ~ Items[3].tag.pages\", \"say run\"]}},{Slot:1b,id:writab
import urllib2, ssl
response = urllib2.urlopen("https://vip.udel.edu/crypto/mobydick.txt", context=ssl._create_unverified_context())
mobytext = response.read()
onlyletters = filter(lambda x: x.isalpha(), mobytext)
loweronly = onlyletters.lower()
frequency = {}
for ascii in range(ord('a'), ord('a')+26):
import random
import urllib2
f=file('quotes.txt','r')
quotes = [l.strip() for l in f]
f.close()
quotes = [w + chr(random.randint(ord('A'),ord('Z'))) if len(w) % 2 == 1 else w for w in quotes]
res = urllib2.urlopen('https://raw.githubusercontent.com/first20hours/google-10000-english/master/google-10000-english-usa.txt')
words = res.read().split()
@AndyNovo
AndyNovo / convo.cpp
Last active April 4, 2021 00:50
A simple function example
#include<iostream>
using namespace std;
string prompt_user(string input_prompt){
string reply;
cout << input_prompt << endl;
cin >> reply; //only use one of these two lines.
//getline(cin, reply);
return reply;
};
import hashlib, cProfile
f=file('dictionary.txt','r')
words = [word.strip() for word in f]
f.close()
secretHash=hashlib.sha512("banana").hexdigest()
def checkDictionary(secret):
return [word for word in words if hashlib.sha512(word).hexdigest() == secret]
@AndyNovo
AndyNovo / canvas-paintball-gun.markdown
Created September 16, 2020 12:22
Canvas Paintball Gun