Skip to content

Instantly share code, notes, and snippets.

@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;
}
}
//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 August 29, 2015 14:19
Delay.js - Simple wrapper around setTimout to cleanup the handle refs
(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 August 29, 2015 14:17
Coffeescript grunt file + index test page
var sourceFiles = [
];
module.exports = function(grunt) {
grunt.initConfig({
coffee: {
compileJoined: {
options: { join: true},
files: {"build/build.js" : sourceFiles}
@mouseroot
mouseroot / phaser_notes.txt
Last active August 29, 2015 14:15
Phaser.js Notes
Phaser.js Notes
By: Mouseroot
Phaser init
-----------
var game = new Phaser.Game(width, height, Render_mode, canvas_id, gamestate_object, transparent_canvas, anti-alias, physics);
render_modes
Phaser.CANVAS - Force canvas
Phaser.WEBGL - Force webgl
@mouseroot
mouseroot / Gates.py
Created November 7, 2014 19:35
Gates Class With Examples (HalfAdder/FullAdder)
class LogicGates:
@staticmethod
def AND(A,B):
if A == 1 and B == 1:
return 1
else:
return 0
@staticmethod
@mouseroot
mouseroot / snips.cs
Created November 7, 2014 19:32
C# Snippets
/*C# Snippets
---------------
Open process
--------------------------------
*/
using System.Diagnostics
https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py
@mouseroot
mouseroot / parsePost.cs
Created April 24, 2014 00:01
C# POSTDATA Parser
Dictionary<string, string> postParams = new Dictionary<string, string>();
postParams.Clear();
string[] rawParams = rawData.Split('&');
foreach (string param in rawParams)
{
string[] kvPair = param.Split('=');
string key = kvPair[0];
string value = HttpUtility.UrlDecode(kvPair[1]);
postParams.Add(key, value);
}
@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