Skip to content

Instantly share code, notes, and snippets.

View ilpaijin's full-sized avatar

Paolo ilpaijin

View GitHub Profile
#!/bin/bash
title=$(tput setaf 7)
flag=$(tput setaf 3)
info=$(tput setaf 7)
text=$(tput setaf 8)
outcome=$(tput setaf 2)
partial=$(tput setaf 3)
error=$(tput setaf 1)
bold=$(tput bold)
@ilpaijin
ilpaijin / bitcoin-pay.rb
Created February 13, 2016 14:16 — forked from Sjors/bitcoin-pay.rb
This script demonstrates how a bitcoin transaction is created and signed. Just pass in your own address and private key and it will prepare a transaction for you. You can then copy & paste that transaction into a webservice like Blockchain to send it. I wrote this mostly to understand better how it works. I sometimes had to "cheat" and look at t…
#!/usr/bin/env ruby
require 'open-uri'
require 'JSON'
require 'digest/sha2'
require 'pry'
require 'bigdecimal'
require 'bitcoin' # Because I need to cheat every now and then
# Usage:
# gem install pry json ffi ruby-bitcoin
@ilpaijin
ilpaijin / slack_error.js
Created December 10, 2015 22:45
slack_error
on Chrome Version 47.0.2526.73 (64-bit)
domain: https://instak.slack.com
error console:
Unhandled rejection URIError: URI malformed
at encodeURIComponent (native)
at https://slack.global.ssl.fastly.net/b7f7/js/rollup-secondary_a_required.js:2:2044
at Array.map (native)
at _makeRequest (https://slack.global.ssl.fastly.net/b7f7/js/rollup-secondary_a_required.js:2:1995)
at _kickOffACall (https://slack.global.ssl.fastly.net/b7f7/js/rollup-secondary_a_required.js:1:31289)
at Object.TS.registerModule.callImmediately (https://slack.global.ssl.fastly.net/b7f7/js/rollup-secondary_a_required.js:1:25665)
@ilpaijin
ilpaijin / cmd.sh
Last active October 1, 2015 14:30 — forked from kelvinn/cmd.sh
Example of using Apache Bench (ab) to POST JSON to an API
# post_loc.txt contains the json you want to post
# -p means to POST it
# -H adds an Auth header (could be Basic or Token)
# -T sets the Content-Type
# -c is concurrent clients
# -n is the number of requests to run in the test
# -l key to accept dynamic response
ab -l -p post_loc.txt -T application/json -H 'Authorization: Token abcd1234' -c 10 -n 2000 http://example.com/api/v1/locations/
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below
# NEW WAY / EASY WAY
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.1.1.deb
sudo dpkg -i elasticsearch-1.1.1.deb
<?xml version="1.0" encoding="UTF-8" ?>
<Data>
<Series>
<id>83462</id>
<Actors>|Nathan Fillion|Stana Katic|Molly C. Quinn|Jon Huertas|Seamus Dever|Tamala Jones|Susan Sullivan|Ruben Santiago-Hudson|Monet Mazur|</Actors>
<Airs_DayOfWeek>Monday</Airs_DayOfWeek>
<Airs_Time>10:00 PM</Airs_Time>
<ContentRating>TV-PG</ContentRating>
<FirstAired>2009-03-09</FirstAired>
<Genre>|Drama|</Genre>
@ilpaijin
ilpaijin / assorrt.js
Created October 17, 2013 09:54
sort js
var str = 'ciao,zio,america,baby';
var arr = [1976,3,0,7,11];
function assorrt(d)
{
d = typeof d == 'string' ? d.split(',') : d;
for(i=0; i < d.length; i++)
{
@ilpaijin
ilpaijin / rAF.js
Created March 27, 2013 23:52 — forked from paulirish/rAF.js
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller
// fixes from Paul Irish and Tino Zijdel
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
@ilpaijin
ilpaijin / ir.css
Created September 28, 2012 09:52
new CSS image replacement
.ir1 {
font: 0/0 a;
text-shadow: none;
color: transparent;
}
.ir2 {
background-image: url(hello-world.png);
text-indent: 100%;
overflow: hidden;