Skip to content

Instantly share code, notes, and snippets.

Daniel Sposito dsposito

Block or report user

Report or block dsposito

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
ipmb /
Last active Jun 2, 2020
Django logging example
import logging.config
import os
from django.utils.log import DEFAULT_LOGGING
# Disable Django's logging setup
LOGLEVEL = os.environ.get('LOGLEVEL', 'info').upper()
anonymous / illuminate-support-loc.txt
Created Apr 21, 2016
illuminate/support LOC
View illuminate-support-loc.txt
phploc 3.0.0 by Sebastian Bergmann.
Directories 3
Files 51
Lines of Code (LOC) 5756
Comment Lines of Code (CLOC) 2422 (42.08%)
Non-Comment Lines of Code (NCLOC) 3334 (57.92%)
Logical Lines of Code (LLOC) 790 (13.72%)
miohtama /
Created Jul 30, 2015
Generate full 128-bit randomness UUID version 4 on Python, break spefification to stir extra 6 bits of randomness
def secure_uuid():
"""Create a non-conforming 128-bit random version 4 UUID.
Random UUID is a RFC 4122 compliant UUID version 4 128-bit number. By default 6 fixed bits, 4 bits for version and 2 bits reserved for other purposes, are fixed. This function behaves like Python's ` uuid4()`` but also randomizes the remaining six bits, generating up to 128 bit randomness.
This function also sources all bytes from `os.urandom()` to guarantee the randomness and security and does not rely operating system libraries.
Using ``secure_uuid()`` poses a risk that generated UUIDs are not accepted when communicating with third party system. However, they are observed to be good for URLs and to be stored in PostgreSQL.
More information
waylonflinn /
Last active Dec 4, 2016
Install Data Science and NLP libraries for python3 in a virtualenv (Numpy, Scipy, Matplotlib, Pandas, Gensim, OpenBLAS and PyTables)
#!/usr/bin/env bash
## create an ubuntu 14.04 hvm instance, then from your home directory:
# 1. download this script
# wget
# 2. make it executable
# chmod a+x
redox / base.html.haml
Last active May 16, 2020
Algolia extends HipChat to customer support
View base.html.haml
= link_to_function content_tag(:i, nil, class: 'glyphicon glyphicon-chevron-up').html_safe, ''
= link_to_function 'Chat with us', ''
.opened{style: 'display: none'}
= link_to_function content_tag(:i, nil, class: 'glyphicon glyphicon-plus-sign').html_safe, 'chat.maximize()', class: 'maximize', style: 'display: none'
lttlrck / gist:9628955
Created Mar 18, 2014
rename git branch locally and remotely
View gist:9628955
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
# coding=UTF-8
from __future__ import division
import re
# This is a naive text summarization algorithm
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):
nikic /
Last active May 24, 2020
Post explaining why objects often use less memory than arrays (in PHP)

Why objects (usually) use less memory than arrays in PHP

This is just a small post in response to [this tweet][tweet] by Julien Pauli (who by the way is the release manager for PHP 5.5). In the tweet he claims that objects use more memory than arrays in PHP. Even though it can be like that, it's not true in most cases. (Note: This only applies to PHP 5.4 or newer.)

The reason why it's easy to assume that objects are larger than arrays is because objects can be seen as an array of properties and a bit of additional information (like the class it belongs to). And as array + additional info > array it obviously follows that objects are larger. The thing is that in most cases PHP can optimize the array part of it away. So how does that work?

The key here is that objects usually have a predefined set of keys, whereas arrays don't:

grawity / GitHub protocol
Last active May 21, 2020
A comparison of protocols offered by GitHub (for #git on Freenode).
View GitHub protocol

Primary differences between SSH and HTTPS. This post is specifically about accessing Git repositories on GitHub.

Protocols to choose from when cloning:

plain Git, aka git://

  • Does not add security beyond what Git itself provides. The server is not verified.

    If you clone a repository over git://, you should check if the latest commit's hash is correct.

tkdave / gist:4150916
Created Nov 26, 2012
Installing OpenCV python libs on mac to work with virtualenv and brew
View gist:4150916
# Installing OpenCV python libs on mac to work with virtualenv
# OpenCV 2.4.3
# Python 2.7.3 installed with brew
# assuming you have virtualenv, pip, and python installed via brew
# assuming $WORKON_HOME is set to something like ~/.virtualenvs
# using homebrew - make sure we're current
brew update
You can’t perform that action at this time.