Skip to content

Instantly share code, notes, and snippets.

Mouseroot mouseroot

Block or report user

Report or block mouseroot

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mouseroot
mouseroot / downloader.py
Created Aug 21, 2018
Python downloader w/ Requests
View downloader.py
import requests
import sys
def download_file(url, filename):
with open(filename, "wb") as file:
print(f"Downloading {filename}")
response = requests.get(url, stream=True)
length = response.headers.get("Content-Length")
@mouseroot
mouseroot / echo_path.py
Created Aug 15, 2018
Python 3+ one-liner to print the environment variables
View echo_path.py
python -c "import os;print(os.getenv('path').replace(';','\n'))"
C:\Windows\system32
C:\Windows
C:\Windows\System32\Wbem
C:\Windows\System32\WindowsPowerShell\v1.0\
C:\Program Files\nodejs\
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
C:\Users\Jon\AppData\Local\Programs\Python\Python37-32\Scripts
C:\Users\Jon\AppData\Roaming\npm
C:\Python27\
@mouseroot
mouseroot / pythonic.py
Created Aug 15, 2018
Pythonic examples vs. C like syntax
View pythonic.py
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 Aug 15, 2018
Python 3.7 Password/Hash Generator
View hash_generator.py
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 Aug 15, 2018
Python 3.7 Asyncio Echo Server
View async_echo_server.py
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 Mar 31, 2017
Javascript canvas game components
View utils.js
//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 Mar 10, 2017
Rotate a String in C
View str_rot.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;
}
}
View slotvm_v23.js
//Very simple jump on 9 to next op
/*
var program = ["0","0","0","1337","9","4"];
var pc = 0;
for(var i=0;i < program.length;i++) {
switch(program[i])
{
case "0":
//Skip
@mouseroot
mouseroot / Delay-compiled.js
Last active Aug 29, 2015
Delay.js - Simple wrapper around setTimout to cleanup the handle refs
View Delay-compiled.js
(function() {
var Delay;
Delay = function(callback, time, args) {
var _timer;
_timer = setTimeout(function() {
if (!args) {
callback();
} else {
callback(args);
@mouseroot
mouseroot / Gruntfile.js
Last active Aug 29, 2015
Coffeescript grunt file + index test page
View Gruntfile.js
var sourceFiles = [
];
module.exports = function(grunt) {
grunt.initConfig({
coffee: {
compileJoined: {
options: { join: true},
files: {"build/build.js" : sourceFiles}
You can’t perform that action at this time.