Skip to content

Instantly share code, notes, and snippets.

View jpablobr's full-sized avatar

Pablo Barrantes jpablobr

View GitHub Profile
awk 'function wl() {\
rate=64000; \
return (rate/160)*(0.87055^(int(rand()*10)))}; \
BEGIN {\
srand(); \
wla=wl(); \
while(1) {\
wlb=wla; \
wla=wl(); \
if (wla==wlb) \
var dickbar = function() {
var opts = {
"symbol" : "✪",
"font-size": "64px",
"color": "#eee",
"time": 3000
};
if(window.dickbar && window.dickbarOptions) {
var d = window.dickbarOptions;
if(d["font-size"]) opts["font-size"] = d["font-size"];
@jpablobr
jpablobr / fdswap.sh
Created January 24, 2011 15:05
File Description Swapper
#!/bin/bash
#
#
# Usage: <old logfile> <new logfile> [ optional pids ]
# ./swap.sh /var/log/logfile /tmp/logfile [pids]
#
# Author: Robert McKay <[email protected]>
# Date: Tue Aug 14 13:36:35 BST 2007
# url: http://bit.ly/eEYfp5
#!/bin/bash
#
# Author: Josh Frye <joshfng>
# Licence: MIT
#
# Contributions from: Wayne E. Seguin <[email protected]>
#
# To run:
# sudo apt-get -y install curl && curl https://github.com/joshfng/railsready/raw/master/railsready.sh >> railsready.sh && chmod a+x railsready.sh && ./railsready.sh
# The script will ask if you want to build Ruby from source or install RVM
@jpablobr
jpablobr / test-services-via-curl.sh
Created January 7, 2011 13:01
test-services-via-curl
#!/usr/env bash
RESULT=`curl -ipost -s http://service.com/api/users -pname=Jhon+Doe -pid=12`
if [[ $RESULT =~ 'jhon-doe' ]]
echo "Test Create: Success. Got: $result"
else
echo "Test Create: Failure. Got: $result"
endif
@jpablobr
jpablobr / ruby-libnotify-config
Created January 2, 2011 12:57
ruby-libnotify config setup
# Config for installing
# https://github.com/vargolo/ruby-libnotify.git
prefix=/home/jpablobr/.rvm/rubies/ruby-1.9.2-p136@app
site-ruby=$prefix/lib/ruby/site_ruby/1.9.1
ruby-prog=$prefix/bin/ruby
ruby-path=$prefix/bin/ruby
make-prog=make
site-ruby-common=$prefix/lib/ruby/site_ruby
@jpablobr
jpablobr / js-class.js
Created November 20, 2010 21:40
JavaScript class
var MyClass = (function () {
// private static
var fooBar = 1;
// constructor
var cls = function () {
// private
var id = fooBar++;
var name = 'baz';
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
#!/bin/bash
scp ~/.ssh/id_rsa.pub $1:~
ssh $1 "mkdir -p ~/.ssh && touch ~/.ssh/authorized_keys && chmod 700 ~/.ssh && chmod -R 600 ~/.ssh/* && cat ~/id_rsa.pub >> ~/.ssh/authorized_keys && rm ~/id_rsa.pub"
#!/usr/bin/env ruby
# To install:
# about:config
# create a new boolean network.protocol-handler.external.txmt with value true
# create a new string network.protocol-handler.app.txmt with value path to the script
require 'rubygems'
require 'cgi'
require 'uri'