Skip to content

Instantly share code, notes, and snippets.

View freddyb's full-sized avatar

Frederik B freddyb

View GitHub Profile
@freddyb
freddyb / squeezebox-radio-ssh.md
Last active August 22, 2023 07:37
SqueezeBox Radio Default SSH Passwort
@freddyb
freddyb / check.js
Created May 10, 2012 21:19
check code integrity of JS files for ZeroBin (uncompressed version)
// checking integrity of JS files by freddyb
// using SHA256 by Chris Veness, licensed under LGPL
// but, to be honest, do whatever the heck you want
// it's not black magic, you know ;)
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* SHA-256 implementation in JavaScript | (c) Chris Veness 2002-2010 | www.movable-type.co.uk */
/* - see http://csrc.nist.gov/groups/ST/toolkit/secure_hashing.html */
/* http://csrc.nist.gov/groups/ST/toolkit/examples.html */
@freddyb
freddyb / pickle_compiler.py
Created August 15, 2012 14:36
compile arbitrary python source code into pickle format. will execute on unpickling
## Frederik Braun, Jun 2011
## Contact: <fb(AT)frederik-braun.com>
## Licence: WTFPL
## Python 2.7x
try:
import cPickle as pickle
except ImportError:
import pickle
@freddyb
freddyb / new-tab.html
Created April 28, 2020 13:52
new tab. shows time.
data:text/html,<style>body,html{height:100%;display:grid;background-color:%2338383d}p{margin:auto;color:white;font-size:48pt;font-family:sans}</style><body><p id=p><script>n=()=>{p.innerText=(new Date()).toLocaleTimeString()};n();setInterval(n,60000);</script>

Enhanced TLS Security for non-HTTP protocols

Goal

The goal is to transplant the concepts of HTTP Strict Transport Security (HSTS)[^1] and Public Key Pinning Extension for HTTP[^2] to other protocols that support TLS. We aim to do those for popular internet protocols like SMTP, POP, FTP, XMPP and IRC.

Strategy

  1. Identify status codes that are currently undefined and can be safely ignored by clients that do not support them
  2. In this status code, the server SHOULD send a list of tokens to describe it's Enhanced TLS Security settings. 2.1 foo
@freddyb
freddyb / rssgrep.py
Created November 4, 2011 21:42
grep for keywords in rss files
import feedparser
import datetime
def main(urls, keywords):
keywords = map(lambda x: x.lower(), keywords)
for url in urls:
print "Starting to parse", url
feed = feedparser.parse(url)
for item in feed['items']:
title_text = item['title_detail']['value']
@freddyb
freddyb / keybase.md
Created September 25, 2017 21:07
I am freddyb on keybase, twitter, github (and more)

Keybase proof

I hereby claim:

  • I am freddyb on github.
  • I am freddyb (https://keybase.io/freddyb) on keybase.
  • I have a public key whose fingerprint is 1331 4246 981D 2C81 F3B2 EEDD 8874 58AD 404E 0968

To claim this, I am signing this object:

@freddyb
freddyb / cidrator.py
Created October 6, 2012 20:58
python iterator that returns IP addresses (as strings) for given ip/cidr string
class cidrator():
def __init__(self, mask ="192.168.1.1/16", skip255=True, skip0=True):
self.skip255 = skip255
self.skip0 = skip0
addr, rng = mask.split("/")
addr_int = sum((256**(3-i) * int(b)) for i,b in enumerate(addr.split (".")))
self.start = addr_int & int("0b"+("1"*int(rng)) + "0"*(32-int(rng)),2)
self.stop = addr_int | int("0b"+("0"*int(rng)) + "1"*(32-int(rng)),2)
self.current = self.start
@freddyb
freddyb / gist:7581901
Created November 21, 2013 13:53
join2Async, could be easily expanded to N-size. looked useful but then didn't solve the problem. dumping here so I may use it when in need. hopefully this makes it easier to find: join queue parallel asynchronous synchronous add flush empty enqueue dequeue
/* this queue-style thing accepts a callback
and calls it when it has two results attached
usage:
j2a = new join2Async(console.log);
setTimeout( 'j2a.addResult("foo")', Math.ceil(Math.random()*10));
setTimeout( 'j2a.addResult("var")', Math.ceil(Math.random()*10));
// enjoy the race and see who's first \o/
*/
function join2Async(cb) {
// join 2 async call and return once *both* are done.