Skip to content

Instantly share code, notes, and snippets.

View natlownes's full-sized avatar

Nat Lownes natlownes

View GitHub Profile
@natlownes
natlownes / bencode.py
Created September 27, 2017 02:37 — forked from rmax/bencode.py
bittorrent format encoder/decoder that I found somewhere in the internet
# The contents of this file are subject to the Python Software Foundation
# License Version 2.3 (the License). You may not copy or use this file, in
# either source code or executable form, except in compliance with the License.
# You may obtain a copy of the License at http://www.python.org/license.
#
# Software distributed under the License is distributed on an AS IS basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
@natlownes
natlownes / flask_session_injector.php
Created September 1, 2017 02:17 — forked from tspycher/flask_session_injector.php
Flask Session generation in PHP
<?php
function base64url_encode($data) {
return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}
// payload
$data = array("username"=>"John");
$data_json = json_encode($data);
$dataz = gzcompress($data_json);
if(strlen($dataz) < (strlen($data_json) - 1))
@natlownes
natlownes / values_pointers.go
Created September 21, 2016 18:23 — forked from josephspurrier/values_pointers.go
Golang - Asterisk and Ampersand Cheatsheet
/*
********************************************************************************
Golang - Asterisk and Ampersand Cheatsheet
********************************************************************************
Also available at: https://play.golang.org/p/lNpnS9j1ma
Allowed:
--------
p := Person{"Steve", 28} stores the value

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
_ = require 'lodash'
mixinEvents = (obj) ->
obj_destroy = obj.destroy
_.extend obj,
_listeners: {}
_listeningTo: []