Skip to content

Instantly share code, notes, and snippets.

Pablo Cantero phstc

Block or report user

Report or block phstc

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View osx-for-hackers.sh
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
View wombat_mutex.rb
module Wombat
# @example Lock while executing `do_something` or expire in 10 seconds
# Wombat::Mutex.exclusive 'my_key', 10 do
# do_something
# end
#
class Mutex
class << self
# @param key [String] the lock key
# @param ttl [Fixnum] time to live in seconds
View wombat_mutex_example.rb
# Lock while executing `do_something` or expire in 10 seconds
Wombat::Mutex.exclusive 'my_key', 10 do
do_something
end
View email_schema.json
{
"title": "Email Schema",
"type": "object",
"required": [
"to",
"sender_email",
"template"
],
"properties": {
"sender_email": {
@phstc
phstc / sexy_sqs_monitor.rb
Last active Aug 29, 2015
Sexy SQS queues monitoring script
View sexy_sqs_monitor.rb
#!/usr/bin/env ruby
require 'aws'
sqs = AWS::SQS.new(
access_key_id: ENV['ACCESS_KEY_ID'],
secret_access_key: ENV['SECRET_ACCESS_KEY']
)
threshold = 1000
@phstc
phstc / commit-msg-ruby.rb
Last active Aug 29, 2015
Prepend branch name in the commit messages
View commit-msg-ruby.rb
#!/usr/bin/env ruby
msg_file = ARGV[0]
commit_msg = File.read(msg_file).to_s.strip
def empty_commit?(commit_msg)
return true if commit_msg.empty?
commit_msg.split("\n").each do |line|
# Lines starting with '#' will be ignored
View gist:10585949
# _/Users/pablo/go/src/github.com/phstc/putsreq/v8.go/src/github.com/idada/v8.go
../../v8_wrap.cc:291:40: error: too many arguments to function call, expected 0, have 1
../../v8_wrap.cc:55:27: note: expanded from macro 'PREV_CONTEXT_SLOT'
/usr/local/include/v8.h:6418:1: note: 'GetData' declared here
../../v8_wrap.cc:295:38: error: too many arguments to function call, expected single argument 'data', have 2 arguments
/usr/local/include/v8.h:6412:1: note: 'SetData' declared here
../../v8_wrap.cc:307:38: error: too many arguments to function call, expected single argument 'data', have 2 arguments
/usr/local/include/v8.h:6412:1: note: 'SetData' declared here
../../v8_wrap.cc:311:32: error: too many arguments to function call, expected 0, have 1
../../v8_wrap.cc:55:27: note: expanded from macro 'PREV_CONTEXT_SLOT'
@phstc
phstc / influxdb.sh
Last active Jan 2, 2016
influxdb 0.4.0.rc5.src
View influxdb.sh
######### install influxdb 0.4.0.rc5.src
$ brew uninstall influxdb
$ rm /usr/local/etc/influxdb.conf
$ rm -rf /usr/local/var/influxdb
$ brew update
$ brew install influxdb --devel
View augury.yml
project_name: augury
project_root: /Users/pablo/workspace/augury
windows:
- servers:
layout: even-vertical
panes:
- foreman start
- cd /Users/pablo/workspace/augury_admin && rails s -p 4000
- cd /Users/pablo/workspace/spree-2-0-stable/sandbox && rails s
- cd /Users/pablo/workspace/persistence_endpoint shotgun config.ru -p 9292
View Procfile_augury
# foreman start -f Procfile_augury
mongo: mongod
augury: sh -c 'cd /Users/pablo/workspace/augury && foreman start'
augury_admin: sh -c 'cd /Users/pablo/workspace/augury_admin && rails s -p 4000'
sandbox: sh -c 'cd /Users/pablo/workspace/spree-2-0-stable/sandbox && rails s'
spree_endpoint: sh -c 'cd /Users/pablo/workspace/spree_endpoint rails s -p 5000'
persistence_endpoint: sh -c 'cd /Users/pablo/workspace/persistence_endpoint shotgun config.ru -p 9292'
You can’t perform that action at this time.