Skip to content

Instantly share code, notes, and snippets.

View rattrap's full-sized avatar
🎯
Focusing

Leo rattrap

🎯
Focusing
  • @taraxa.io
  • Bucharest
View GitHub Profile
@rattrap
rattrap / main.go
Created May 13, 2018 00:21
HTTP benchmark tool in golang
package main
import (
"fmt"
"net/http"
"os"
"strconv"
"time"
)
require "bunny"
# Start a communication session with RabbitMQ
conn = Bunny.new("amqp://username:password@rabbit-server:5672/%2F")
conn.start
# open a channel
ch = conn.create_channel
# declare a queue
require "bunny"
# Start a communication session with RabbitMQ
conn = Bunny.new("amqp://username:password@rabbit-server:5672/%2F")
conn.start
# open a channel
ch = conn.create_channel
# declare a queue

Keybase proof

I hereby claim:

  • I am rattrap on github.
  • I am rattrap (https://keybase.io/rattrap) on keybase.
  • I have a public key whose fingerprint is 9002 F7C2 3DA8 D3BF 2F27 3539 1BA5 9F99 6E15 79FA

To claim this, I am signing this object:

@rattrap
rattrap / error_handling.php
Last active August 29, 2015 14:20
Mail PHP error messages
<?php
//
// Custom error handler
//
function new_error_handler($number, $message, $file, $line, $vars) {
$message = "
@rattrap
rattrap / Data.php
Created April 10, 2015 11:11
Magento ifconfig block and dynamic assets
<?php
/**
* @category Package
* @package Namespace_Package
* @license http://opensource.org/licenses/MIT
* @author Leonard Mocanu <leonard.mocanu@ymail.com>
*/
class Namespace_Package_Helper_Data extends Mage_Core_Helper_Abstract {
@rattrap
rattrap / time-ago.php
Created December 4, 2014 21:51
Time ago in PHP
<?php
function time_ago($time) {
$time = time() - $time;
if($time < 5) {
return 'Just now';
@rattrap
rattrap / git-rewrite-history.sh
Created December 4, 2014 21:29
Rewrite git history
#!/bin/sh
git filter-branch -f --env-filter '
an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"
if [ "$GIT_COMMITTER_EMAIL" = "old@email.com" ]
@rattrap
rattrap / Request.php
Last active August 2, 2021 14:27
POST with cURL but failback to fopen
<?php
class Request {
/**
* do_post
* POST request
*
* @access public
* @param string $url - url