Skip to content

Instantly share code, notes, and snippets.

View fgbreel's full-sized avatar
🦆

Gabriel Francisco fgbreel

🦆
  • Berlin
View GitHub Profile

Keybase proof

I hereby claim:

  • I am fgbreel on github.
  • I am fgbreel (https://keybase.io/fgbreel) on keybase.
  • I have a public key whose fingerprint is 91F8 48A8 675F D254 5AFA 82F1 4DB1 3D91 2D3E 7517

To claim this, I am signing this object:

# config/routes.rb
resources :documents do
scope module: 'documents' do
resources :versions do
post :restore, on: :member
end
resource :lock
end
end
@fgbreel
fgbreel / mask.rb
Created March 24, 2016 21:07 — forked from pgr0ss/mask.rb
def mask n;n.slice(0,6)+"*"*(n.size-10)+n.slice(-4,4);end
@fgbreel
fgbreel / bg-loader.js
Created March 18, 2016 17:50
JS ajax background loader
var post = {
init: function() { $('.post').on('click', this.loadPost); },
updatePost: function(result, event) {
var $post = $(event.currentTarget);
$post.fadeIn({
duration: 400,
start: function(){
$post.find('.post-title').text(result.title);
$post.find('.post-content').text(result.content);
@fgbreel
fgbreel / whisper-calculator.py
Created February 11, 2016 13:19 — forked from jjmaestro/whisper-calculator.py
whisper-calculator.py: Calculates the size of the whisper storage for the given retention (in frequency:history format)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def archive_to_bytes(archive):
def to_seconds(s):
SECONDS_IN_A = {
's': 1,
'm': 1 * 60,
'h': 1 * 60 * 60,
@fgbreel
fgbreel / unicorn
Last active February 2, 2016 22:01
unicorn lsb init script for huginn
#! /bin/sh
### BEGIN INIT INFO
# Provides: unicorn
# Required-Start: $syslog $networking
# Required-Stop: $syslog $networking
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Unicorn APP Server
# Description: Debian init script for the Unicorn APP Server
# scheduler
@fgbreel
fgbreel / lb.conf
Created December 15, 2015 23:06
Ansible template for Apache2.4 with Load Balancing
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin [email protected]
DocumentRoot {{ document_root }}
LogLevel error
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
@fgbreel
fgbreel / postfix_grok_pattern
Created November 14, 2015 02:41 — forked from brablc/postfix_grok_pattern
Logstash example configuration for parsing Postfix mail log files
# Postfix stuff based on https://gist.github.com/jbrownsc/4694374:
QUEUEID (?:[A-F0-9]+|NOQUEUE)
EMAILADDRESSPART [a-zA-Z0-9_.+-=:]+
EMAILADDRESS %{EMAILADDRESSPART:local}@%{EMAILADDRESSPART:remote}
RELAY (?:%{HOSTNAME:relayhost}(?:\[%{IP:relayip}\](?::[0-9]+(.[0-9]+)?)?)?)
POSREAL [0-9]+(.[0-9]+)?
DELAYS (%{POSREAL}[/]*)+
DSN %{NONNEGINT}.%{NONNEGINT}.%{NONNEGINT}
STATUS sent|deferred|bounced|expired
#!/usr/bin/env ruby
require 'mailman'
class ErrorLoggingMiddleware
def call(mail)
begin
yield
rescue
puts "There was an error processing this message! #{mail.subject}"
raise

Keybase proof

I hereby claim:

  • I am fgbreel on github.
  • I am fgbreel (https://keybase.io/fgbreel) on keybase.
  • I have a public key whose fingerprint is 24AE E505 ED71 C671 3634 7DE7 F48D 97DE E707 556B

To claim this, I am signing this object: