Skip to content

Instantly share code, notes, and snippets.

View rolandshoemaker's full-sized avatar
🏴
┬─┬ノ(ಠ_ಠノ)

Roland Bracewell Shoemaker rolandshoemaker

🏴
┬─┬ノ(ಠ_ಠノ)
View GitHub Profile
@rolandshoemaker
rolandshoemaker / bitFlip.py
Created September 5, 2014 23:44
Python function to find every possible permutation of a input hexademical key where one bit of one byte in the key is flipped, extremely quick and dirty...
def bitFlip(key):
flippedKeys = []
for i in range(0, len(key), 2):
bits = bin(int(key[i:i+2], base=16))
for j, b in enumerate(bits[2:len(bits)]):
flip = list(copy.deepcopy(bits[2:len(bits)]))
flip[j] = (1)^int(b)
#if j < len(flip)-1:
# flip[j+1] = (1)^int(b)
bitStr = ""
@rolandshoemaker
rolandshoemaker / html.parser.unescape.py
Last active August 29, 2015 14:06
Python 3.4 html.parser.unescape() for pre-3.4 versions of Python!
"""
Python 3.4 HTML5 entity unescaping for all! Based on https://hg.python.org/cpython/file/500d3d6f22ff/Lib/html/__init__.py
"""
import sys
import re as _re
__all__ = ['unescape']
_html5 = {
@rolandshoemaker
rolandshoemaker / generate-dns-queries.py
Created November 22, 2014 22:49
python3 script to generate random dns query traffic for whatever reason.
#!/usr/bin/python3
import dns.resolver
import random, time
dns.resolver.nameservers = ['localhost']
letters= [chr(ord('a')+i) for i in range(26)]
types = ['NS', 'A', 'AAAA', 'MX']
qps = 1
while True:
@rolandshoemaker
rolandshoemaker / editor.rs
Created December 28, 2014 17:35
Drop to $VISUAL or $EDITOR to edit a String in rust (via temporary file)
extern crate libc;
use std::io::{File, Open, ReadWrite, TempDir, Command, SeekSet};
use std::io::process::{InheritFd};
use std::os;
pub use self::libc::{
STDIN_FILENO,
STDOUT_FILENO,
STDERR_FILENO
};
@rolandshoemaker
rolandshoemaker / vpn_check.py
Last active August 29, 2015 14:13
Am I connected to a vpn right now? (for conky)
#!/usr/bin/python3
# am i connected to a vpn? (using nmcli)
import subprocess
vpnd = bool()
for l in subprocess.Popen(["nmcli", "-t", "--fields", "name,vpn", "c", "status"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate()[0].decode("utf-8").split("\n"):
if len(l) > 0:
a, b = l.split(":")
if b == "yes":
print(''+a+'', end="", flush=True)
vpnd = True
@rolandshoemaker
rolandshoemaker / gha.js
Last active August 29, 2015 14:16
quick github activity
<script>
$.get("https://api.github.com/users/rolandshoemaker/events?per_page=5", function(data) {
var output = [];
for (var event in data) {
if (data[event].type == "PushEvent") {
var dt = new Date(Date.parse(data[event].created_at));
var ds = dt.getDate()+"/"+(dt.getMonth()+1)+"/"+dt.getFullYear()+" "+(dt.getUTCHours()+1)+":"+dt.getUTCMinutes()+" UTC";
output.push(["<a href=\"https://github.com/"+data[event].repo.name+"\">"+data[event].repo.name+"</a>", data[event].payload.commits[data[event].payload.size-1].message, ds]);
}
}
@rolandshoemaker
rolandshoemaker / ghost-magnificpopuper.js
Last active August 29, 2015 14:17
automatically create magnific popup galleries from <img>s in <article>s
// ghost auto magnific popup galleryizer
// roland bracewell shoemaker - 2015
$("article.post").each(function() {
// wrap all <img>s in <article class="post"> with <a>s pointing at the <img> src
var links = $($(this).find("img")).each(function() {
var new_link = $("<a>", {href: $(this).attr("src"), title: $(this).attr("alt")});
$(this).wrap(new_link);
});
// initialize magnificPopup() on all new links
@rolandshoemaker
rolandshoemaker / wec.md
Last active August 29, 2015 14:18
wile e coyote
                                                                
                                                                
                            wile e coyote                       
                            ■───────────■                       
                             load tester                        
                                                                
        monolithic client or                                    
      individual containers +                                   
         rabbitmq container                                     
@rolandshoemaker
rolandshoemaker / activity-monitor.go
Last active August 29, 2015 14:18
activity monitor performance logging
deliveryTimings := make(map[string]time.Time)
// Run forever.
for d := range deliveries {
if d.ReplyTo != "" {
deliveryTimings[fmt.Sprintf("%s:%s", d.CorrelationId, d.ReplyTo)] = time.Now()
} else {
rpcSent := deliveryTimings[fmt.Sprintf("%s:%s", d.CorrelationId, d.RoutingKey)]
if rpcSent != nil {
respTime := time.Since(rpcSent)
package main
import (
"crypto/ecdsa"
"crypto/rsa"
"crypto/x509"
"database/sql"
"encoding/json"
"fmt"
"runtime"