Skip to content

Instantly share code, notes, and snippets.

View alhafoudh's full-sized avatar

Ahmed Al Hafoudh alhafoudh

View GitHub Profile
@alhafoudh
alhafoudh / stickies-to-notes.rb
Created July 11, 2012 10:11
OSX 10.8 Mountain Lion - Migrate your stickies from Stickies.app to Notes.app
# Author: Ahmed Al Hafoudh <[email protected]
#
# Usage: ruby stickies-to-notes.rb
#
# Prerequisites:
# gem install rb-appscript
#
require 'appscript'
require 'osax'
USE TestDB
-- SQL Join visualization
-- http://www.codeproject.com/KB/database/Visual_SQL_Joins/Visual_SQL_JOINS_orig.jpg
DROP TABLE [dbo].Authors
DROP TABLE [dbo].Books
CREATE TABLE [dbo].[Authors](
[id] [int] IDENTITY(1,1) NOT NULL,
@alhafoudh
alhafoudh / create_postgresql_vendor_binary.sh
Created July 2, 2013 06:22
Create postgresql-9.2.4 vendor binary for Heroku xxx buildpack
wget http://ftp.postgresql.org/pub/source/v9.2.4/postgresql-9.2.4.tar.bz2
tar xjf postgresql-9.2.4.tar.bz2
vulcan create
vulcan build -v -n postgresql-9.2.4 -s ./postgresql-9.2.4 -c "./configure --prefix /app/vendor/postgresql-9.2.4 --enable-thread-safety --without-docdir --with-openssl && make install"
LINUX=$(shell uname | grep Linux | wc -l | xargs echo)
DEPS=../deps
ifeq ($(LINUX),1)
ZMQ_FLAGS="--with-pgm=libpgm-5.2.122"
else
ZMQ_FLAGS="--with-pgm=libpgm-5.2.122"
endif
ifndef ZEROMQ_VERSION
diff --git a/src/pgm_socket.cpp b/src/pgm_socket.cpp
index 7925c6e..fc26161 100644
--- a/src/pgm_socket.cpp
+++ b/src/pgm_socket.cpp
@@ -325,7 +325,7 @@ int zmq::pgm_socket_t::init (bool udp_encapsulation_, const char *network_)
// Set IP level parameters.
{
// Multicast loopback disabled by default
- const int multicast_loop = 0;
+ const int multicast_loop = 1;
require 'sidetiq'
Sidekiq.configure_client do |config|
config.redis = { namespace: 'x', size: 1 }
end
# Sidekiq server is multi-threaded so our Redis connection pool size defaults to concurrency (-c)
Sidekiq.configure_server do |config|
config.redis = { namespace: 'x' }
end

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname

Keybase proof

I hereby claim:

  • I am alhafoudh on github.
  • I am alhafoudh (https://keybase.io/alhafoudh) on keybase.
  • I have a public key whose fingerprint is 0770 2ACB 3379 C475 6B3F CCD1 39AC A456 B7EC D57B

To claim this, I am signing this object:

@alhafoudh
alhafoudh / logstash_docker.conf
Created August 23, 2014 22:11
Logstash watch docker logs
input {
file {
codec => json
path => '/var/lib/docker/containers/*/*-json.log'
}
}
filter {
ruby {
code => "Thread.current[event['path']] ||= JSON.parse(Pathname(event['path']).dirname.join('config.json').read)"
}
exports.handler = function(event, context) {
for (var i in event.Records) {
var record = event.Records[i];
console.log("Processing record");
var data = new Buffer(record.kinesis.data, 'base64').toString();
console.log("Input data: " + data);
var http = require('http');