Author: | Tiago Alves Macambira [tmacam burocarata org] |
---|---|
Licence: | Creative Commons By-SA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; joins two consecutives lines like vim's "J" | |
(defun join-lines () | |
(interactive) | |
(save-excursion | |
(end-of-line) | |
(insert-char ? 1) | |
(delete-char 1) | |
(while (looking-at "\\s +") | |
(delete-char 1)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef PRODUCER_CONSUMER_QUEUE_HPP_ | |
#define PRODUCER_CONSUMER_QUEUE_HPP_ | |
// Based on code from http://www.justsoftwaresolutions.co.uk/threading/implementing-a-thread-safe-queue-using-condition-variables.html | |
// Original version by Anthony Williams | |
// Modifications by Michael Anderson -- https://gist.github.com/482342 | |
#include <boost/thread.hpp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Verifies a password's strength by measuring its entropy. | |
Notice that this form of password strength testing does not distinguish easy to | |
guess passwords like "1111...." from supposedly good passwords like "%hF6Nz-0". | |
Some rule/points based passwords tests can and should be used together | |
with this to asset a password's strengh. | |
References: | |
- http://xkcd.com/936/ | |
- http://en.wikipedia.org/wiki/Password_strength |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python -u | |
# vim:ts=4:sts=4:sw=4:et:wrap:ai:fileencoding=utf-8: | |
"""Decorator to log a function's backtrace to a remote server. | |
Based on client/backtrace.py | |
from http://github.com/tmacam/DistributedCrawler. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python -u | |
# vim:ts=4:sts=4:sw=4:et:wrap:ai:fileencoding=utf-8: | |
from flask import Flask, request | |
app = Flask(__name__) | |
@app.route('/', methods=['POST', 'GET']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ "$color_prompt" = yes ]; then | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$(__git_ps1 "\n(%s)")\$ ' | |
else | |
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(__git_ps1 "\n(%s)")\$ ' | |
fi | |
unset color_prompt force_color_prompt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
press_enter() { | |
set +x | |
echo "PRESS [ENTER]"; | |
read ENTER; | |
set -x | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
BRANCH=${1:?"Usage: $0 [BRANCH]"} | |
if ! ( git branch | grep -q ${BRANCH} ); then | |
echo "ERROR: Uknown branch '${BRANCH}'" > /dev/stderr | |
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# vim:ts=4:sts=4:sw=4:et:wrap:ai:fileencoding=utf-8: | |
"""A collection of string normalization routines. | |
You are probably looking for normalize_string, that does an aggressive (but | |
arguably sound) string normalization process. | |
""" | |
OlderNewer