Skip to content

Instantly share code, notes, and snippets.

View 0x9900's full-sized avatar
📻
Coding

Fred Cirera 0x9900

📻
Coding
View GitHub Profile
@0x9900
0x9900 / tmux.conf
Last active August 29, 2015 14:05
tmux.conf
# Reload key
bind-key R source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"
# make tmux display things in 256 colors
set -g default-terminal "screen-256color"
# utf8
set-window-option -g utf8 on
set -g status-utf8 on
@0x9900
0x9900 / setlog.py
Created August 21, 2014 04:46
Python: Simple logging setup.
def set_logging(level=logging.INFO):
level = logging.getLevelName(os.getenv('LOG_LEVEL', 'INFO').upper())
logger = logging.getLogger(__name__)
logger.setLevel(level)
handler = logging.StreamHandler()
handler.setLevel(level)
handler.setFormatter(logging.Formatter(
'%(asctime)s %(name)s: %(funcName)s %(levelname)s[%(lineno)d]: %(message)s'
))
@0x9900
0x9900 / spamtrap.sh
Last active August 29, 2015 14:13
Check spamdb whitelisted addresses agains RBLs.
#!/usr/local/bin/bash
#
# (c) Sometime in 2015 by Fred C. @0x9900
#
# Checks whitelisted IPs in spamdb and if they are known by any of the
# follwing DNSBL lists, tag them as trapped. This script only check
# the IP addresses whitelisted since the last run. Therefore the date
# of the last run is stored in a file called /tmp/spamtrap.status.
#
# - abuseat.org
@0x9900
0x9900 / silence_output.py
Created January 28, 2015 22:38
Silence stdout (python)
#
# Sometime, specifically in your tests, you want to silence the
# standard output or be able to read the standard output of a function
# to test what's printed. Here is some recipe to do that.
#
#
import cStringIO as StringIO
import sys
@0x9900
0x9900 / keybase.md
Created January 31, 2015 22:22
keybase.md

Keybase proof

I hereby claim:

  • I am 0x9900 on github.
  • I am 0x9900 (https://keybase.io/0x9900) on keybase.
  • I have a public key whose fingerprint is D7BB 551B BB16 BC3F A3F1 5591 0172 317A F80F 70A7

To claim this, I am signing this object:

@0x9900
0x9900 / wsconsctl.conf
Last active August 29, 2015 14:16
OpenBSD console config.
# $OpenBSD: wsconsctl.conf,v 1.2 2007/05/14 05:06:03 tedu Exp $
#
# wscons configurable parameters
#
keyboard.repeat.deln=25 # I like the repeat to ve a little more reactive.
keyboard.encoding=us.swapctrlcaps
#
# Sometime I have an USB keyboard plugged in
keyboard1.repeat.deln=25 # I like the repeat to ve a little more reactive.
keyboard1.encoding=us.swapctrlcaps
@0x9900
0x9900 / dnsbl.sh
Last active August 29, 2015 14:24
#!/bin/ksh
#
USAGE="Usage: dnsbl [-b] ipaddress"
set -A RBL_LST "zen.spamhaus.org" "bl.spamcop.net" \
"b.barracudacentral.org" "cbl.abuseat.org" \
"hostkarma.junkemailfilter.com"
if [[ $# < 1 || $# > 2 ]]; then
@0x9900
0x9900 / roll.css
Last active December 10, 2015 19:19
Rolling effect on links. <a class="roll-link" href="...
/* ROLL LINKS */
.roll-link {
display: inline-block;
overflow: hidden;
vertical-align: top;
-webkit-perspective: 600px;
-moz-perspective: 600px;
-ms-perspective: 600px;
@0x9900
0x9900 / vault-password.py
Created May 25, 2016 06:43
Use a file and a password to generate a cryptographic key for Ansible Vault. (the password can be saved in the Mac Keychain.
#!/usr/bin/env python2.7
#
# Author: Fred Cirera <github-fred@hidzz.com>
# Module: vault-password.py
#
""" This script requires the ``keyring`` python module
Add a [vault] section to your ansible.cfg file,
the options are
@0x9900
0x9900 / .bash_profile
Last active June 13, 2016 17:29
.bash_profile misc functions
#
# Nice prompt with nice colors for git
# Colors: master (red), dev (grey), other branches (green)
#
__set_prompt() {
local _RESET="\033[0m\017" # reset color
local _MASTER="\033[31m" # red
local _DEV="\033[90m" # grey
local _BRANCH="\033[32m" # green
local ref="$(git symbolic-ref --short HEAD 2>/dev/null)"