Skip to content

Instantly share code, notes, and snippets.

@mouseroot
mouseroot / pythonic.py
Created August 15, 2018 20:41
Pythonic examples vs. C like syntax
program_source = """
print "Test"
print "Hello world"
end
"""
def parse_source(source_data):
return list(filter(lambda line: line != "", source_data.splitlines()))
@mouseroot
mouseroot / hash_generator.py
Last active August 15, 2018 05:35
Python 3.7 Password/Hash Generator
import random
def generate_hash(size=10):
alpha = [p for p in "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ0123456789_"]
return "".join([random.choice(alpha) for _ in range(size)])
@mouseroot
mouseroot / async_echo_server.py
Created August 15, 2018 05:29
Python 3.7 Asyncio Echo Server
import asyncio
class EchoProtocol(asyncio.Protocol):
def __init__(self):
self.transport = None
def connection_made(self, transport):
peer_name = transport.get_extra_info("peername")
print(f"Connection from {peer_name[0]}")
@mouseroot
mouseroot / utils.js
Last active March 31, 2017 17:55
Javascript canvas game components
//Keymap
var keys = {
up: 38,
down: 40,
left: 37,
right: 39,
key_z: 90,
key_x: 88,
return: 13,
escape: 27,
@mouseroot
mouseroot / str_rot.c
Created March 10, 2017 01:36
Rotate a String in C
char *rotateString(char *str, int count) {
size_t len = strlen(str);
int counter;
for(counter=0;counter < len;counter++) {
int value = str[counter];
if((char)value != ' ') {
value = value + count;
str[counter] = value;
}
}
@mouseroot
mouseroot / snips.cs
Created November 7, 2014 19:32
C# Snippets
/*C# Snippets
---------------
Open process
--------------------------------
*/
using System.Diagnostics
@mouseroot
mouseroot / toriptables.sh
Created October 13, 2013 03:30
iptables
#!/bin/sh
#toriptables.sh
# I learned this from https://wiki.torproject.org/noreply/TheOnionRouter/TransparentProxy
#Reject all ICMP packets because they have no owner which creates a leak
iptables -A OUTPUT -p icmp -j REJECT
#All traffic for the user root will go through tor
iptables -t nat -A OUTPUT ! -o lo -p tcp -m owner --uid-owner root -m tcp -j REDIRECT --to-ports 9040
iptables -t nat -A OUTPUT ! -o lo -p udp -m owner --uid-owner root -m udp --dport 53 -j REDIRECT --to-ports 53
@mouseroot
mouseroot / toriptables.sh
Created January 20, 2014 17:18
TOR iptables
#!/bin/sh
#toriptables.sh
# I learned this from https://wiki.torproject.org/noreply/TheOnionRouter/TransparentProxy
#Reject all ICMP packets because they have no owner which creates a leak
iptables -A OUTPUT -p icmp -j REJECT
#All traffic for the user root will go through tor
iptables -t nat -A OUTPUT ! -o lo -p tcp -m owner --uid-owner root -m tcp -j REDIRECT --to-ports 9040
iptables -t nat -A OUTPUT ! -o lo -p udp -m owner --uid-owner root -m udp --dport 53 -j REDIRECT --to-ports 53
@mouseroot
mouseroot / motherless.lua
Created December 10, 2013 22:19
Motherless playlist script Install by: placing this file in C:\Program Files (x86)\VideoLAN\VLC\lua\playlist
--[[
Script: Handles motherless.com
By: Mouseroot
--]]
function probe()
return vlc.access == "http" and string.match(vlc.path,"motherless.com")
@mouseroot
mouseroot / snes_list
Last active December 27, 2015 21:29
SNES Gamelist
Chrono Trigger
Earthbound
Final Fantasy III
Kirbys Dream Land 3
Secret of Mana
Shadowrun
Super Mario RPG
Super Mario World
Zelda - A Link to the Past