Skip to content

Instantly share code, notes, and snippets.

Brice Fernandes bricef

Block or report user

Report or block bricef

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
bricef /
Created Jan 18, 2020
Call tracing decorator
class TraceCalls(object):
""" Use as a decorator on functions that should be traced. Several
functions can be decorated - they will all be indented according
to their call depth.
def __init__(self, stream=sys.stdout, indent_step=2, show_ret=False): = stream
self.indent_step = indent_step
self.show_ret = show_ret
bricef /
Created Jan 18, 2020
Given a value, create a temporary file and make this file available for the duration of the context.
class ValueContext(object):
A ValueContext is constructed from a value that can be writtent to a file
and then exposes the value as a temporary file in its context.
The temporary file path can be accessed using its `name` attribute.
For example:
bricef /
Last active Dec 13, 2019 — forked from angstwad/
Recursive dictionary merge in Python
# Recursive dictionary merge
# Copyright (C) 2019 Brice Fernandes <>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
View movie-titles.txt
1 - ???
2 - The Matrix
3 - Speed
4 - Leaving Las Vegas
5 - Lalaland
6 - 12 monkeys
7 - π
8 - Dr No
9 - Seven
10 - Home Alone
bricef / docker-compose output
Last active Feb 19, 2018
Error on following readme instructions
View docker-compose output
➤ docker-compose -f services/dev.yml up --build
Starting services_api_1 ... done
Starting services_web_1 ... done
Attaching to services_api_1, services_web_1
api_1 |
api_1 | > json-server@ prestart /home
api_1 | > npm install
api_1 |
web_1 |
web_1 | > react-slingshot@7.0.0 prestart /home
bricef /
Last active Feb 13, 2018
Abduction: Bat out of hell party - attitude graph
//➤ neato -Gsep="+200" -Goverlap=scalexy -Tpng -o party.png && open party.png
digraph party {
Ad [label="Adric"];
Az [label="Azrael"];
P [label="Peridot"];
Li [label="Liberace"];
Pe [label="Pete"];
K [label="Koros"];
Lu [label="Luth"];
F [label="Fletcher"];
View index.html
<body>bucket served file ok</body>
bricef / Hash.cs
Last active Oct 3, 2016
Salting and Hashing passwords correctly in .NET
View Hash.cs
* From
public class Hash
private const int SaltByteLength = 32;
private const int DerivedKeyLength = 32;
private const int IterationCount = 48000;
private const char separator = '|';
bricef /
Created Sep 8, 2016
Padding Oracle attack example in python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
import sys
from Crypto.Cipher import AES
BLOCK_SIZE = 16 # bytes
INIT_VEC = 'This is an IV456' # hardcoding this is a terrible idea
You can’t perform that action at this time.