Skip to content

Instantly share code, notes, and snippets.

View hungryblank's full-sized avatar

Paolo Negri hungryblank

  • Contentful
  • Berlin, Germany
View GitHub Profile
@hungryblank
hungryblank / Invalidation.js
Last active August 29, 2015 14:25
Invalidate CloudFront cache for static websites hosted on S3
'use strict';
var crypto = require('crypto');
var path = require('path');
var Promise = require('bluebird');
var Invalidation = function (config, s3EventRecord) {
this.record = s3EventRecord;
this.config = config;
class Base62
CHARS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
SIZE = CHARS.size
def self.short(number)
return 0 if number == 0
chars = ''
while number != 0 do
number, mod = number.divmod(SIZE)
Router ADSL Thomson TG585 v7
Router ADSL fornito con la connessione Tiscali OfficeOne.
Portscan e telnet remoto
Per impostazione predefinita ha la porta telnet aperta sulla wan. La connessione come admin viene rifiutata dalla wan, ma nei log ho trovato questo strano messaggio:
Info 00:16:54 LOGOUT User logged out on TELNET (85.190.0.3)
Avvertenza 00:16:42 IDS scan parser : tcp syn scan: 85.190.0.3 scanned at least 20 ports at 94.33.x.x. (1 of 1) : 85.190.0.3 94.33.x.x 0060 TCP 51175→1027 [S…..] seq 2901216082 win 5840
Client.prototype.rawLog = function(severity, message, callback) {
var buffer = new Buffer(message(severity, this.facility, message));
this.socket.send(buffer, 0, buffer.length, this.port, this.host, callback);
};
Client.prototype.emerg = function(message, callback) {
this.rawLog(facilities.LOG_EMERG, message, callback);
};
Client.prototype.alert = function(message, callback) {
@hungryblank
hungryblank / clean_rrdb.rb
Created May 10, 2012 17:05
cleanup spikes from rrdtool xml dumps
require 'rubygems'
require 'nokogiri'
class RRow
attr_reader :exponent, :coefficient, :xml, :value
def initialize(xml)
@xml = xml
@value_xml = xml.children.first
@hungryblank
hungryblank / gist:1292529
Created October 17, 2011 12:43
couchdb stacktrace, timeout right after compaction
[Fri, 14 Oct 2011 01:46:37 GMT] [error] [<0.4090.13>] Uncaught error in HTTP request: {exit,
{{timeout,
{gen_server,call,
[<0.21934.9>,
{open_ref_count,
<0.4090.13>}]}},
{gen_server,call,
[couch_server,
{open,<<"backup">>,
[{user_ctx,
@hungryblank
hungryblank / hmac256.erl
Created June 14, 2011 06:59
hmac 256 implementation
%%%-------------------------------------------------------------------
%%% File : hmac256.erl
%%% Author : Sriram Krishnan<mail@sriramkrishnan.com>
%%% Description : HMAC-SHA256 implementation. Implementation based on Wikipedia's
%% pseudocode description of HMAC. Relies on Steve Vinoski's SHA256 implementation
%%% from http://steve.vinoski.net/code/sha2.erl
%%%
%%% Created : 30 Dec 2008
%%%-------------------------------------------------------------------
%% @private
handle_call(Request, From, State) ->
NewState = mylib:myfun(State),
{reply, ok, NewState};
@hungryblank
hungryblank / config.ru
Created April 18, 2011 22:33
Comparison between sync/async solutions for simple web api
# to be used with the sync version
require './request_handler_sync'
run Sinatra::Application
@hungryblank
hungryblank / gist:725098
Created December 2, 2010 10:25
sha_mac erlang call
1> crypto:sha_mac("my_key","GET\n\n\nThu, 02 Dec 2010 10:05:01 GMT\n/").
** exception error: bad argument
in function port_control/3
called as port_control(crypto_drv02,11,
[<<0,0,0,6>>,
"my_key","GET\n\n\nThu, 02 Dec 2010 10:05:01 GMT\n/"])
in call from crypto:control/2