Skip to content

Instantly share code, notes, and snippets.

View juanrossi's full-sized avatar

Juan Rossi juanrossi

  • mercadolibre
  • Buenos Aires, Argentina
View GitHub Profile
@rkuzner
rkuzner / race_condition_1_test.go
Last active July 26, 2021 14:58
Workshop Resiliencia - Demo Concurrencia
package racecondition_test
import (
"fmt"
"sync"
"sync/atomic"
"testing"
"time"
)
import time
class Bucket(object):
def __init__(self, max_amount, refill_time, refill_amount):
self.max_amount = max_amount
self.refill_time = refill_time
self.refill_amount = refill_amount
self.reset()
def _refill_count(self):
@wolfeidau
wolfeidau / main.go
Last active May 31, 2022 16:30
Golang Backpressure Example
package main
// The aim of this example is to illustrate backpressure using golang channels and go routines.
//
// This is the basis for a simple data processing service which could either be reading from
// some internal queue or a socket of some sort.
import (
"fmt"
"math/rand"
@hollodotme
hollodotme / Install-nginx-with-http2-support.md
Created April 9, 2016 17:07
Install nginx with http2 support on ubuntu 14.04 LTS (Trusty)

How to install nginx (>= 1.9.5) with http2 support on Ubuntu 14.04 LTS (Trusty)

IMPORTANT: Backup your nginx site configs (usually under /etc/nginx/sites-available)!

Remove old nginx

Remove old nginx incl. nginx-common:

apt-get autoremove --purge nginx nginx-common
@apeckham
apeckham / helpscout-export.rb
Last active December 7, 2017 14:31 — forked from stympy/helpscout-export.rb
Script to export helpscout data as json
#!/usr/bin/env ruby
require 'helpscout'
require 'fileutils'
require 'json'
api_key = ARGV[0]
helpscout = HelpScout::Client.new(api_key)
module InstanceVariablesToJson
@tegansnyder
tegansnyder / hhvm_magento_setup.md
Last active July 14, 2023 22:30
HHVM Magento Server Setup

I've had the opertunity to try a variety of different server configurations but never really got around to trying HHVM with Magento until recently. I thought I would share a detailed walkthrough of configuring a single instance Magento server running Nginx + Fast CGI + HHVM / PHP-FPM + Redis + Percona. For the purpose of this blog post I'm assuming you are using Fedora, CentOS, or in my case RHEL 6.5.

Please note: I'm 100% open to suggestions. If you see something I did that needs to be done a different way, please let me know. I haven't included my Perconca my.conf file yet. I will shortly. Also I plan on trying this same test with HHVM 3.3 and PHP 7.

Install the EPEL, Webtatic, and REMI repos

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
@kachayev
kachayev / concurrency-in-go.md
Last active May 31, 2024 09:34
Channels Are Not Enough or Why Pipelining Is Not That Easy
@peregrinogris
peregrinogris / git-lint
Last active August 29, 2015 14:05
Run pylint and pep8 linters on all changed and added python files, or in the current branch (by passing 'fbranch')
#!/usr/bin/env bash
branch=`git branch | grep '*' | awk '{print $2}'`
get_files() {
if test "$1" = "fbranch"; then
echo `git diff develop..$branch --name-status | egrep '[AM]\t' | awk '{print $2}' | grep '.py'`
else
echo `git status --porcelain | egrep '[AM] ' | awk '{print $2}' | grep '.py'`
fi
@peregrinogris
peregrinogris / git-usebranch
Last active February 1, 2017 18:17
Use this to checkout a branch ending with a certain string
#!/usr/bin/env bash
branch=`git branch -a | egrep -io "([^/]+/)?[^/]+$1$" | sed 's/* //' | head -1`
git checkout $branch
@robhudson
robhudson / gist:3848832
Last active July 12, 2018 15:25
Quick way to set CORS headers on django-tastypie resources
class CORSResource(object):
"""
Adds CORS headers to resources that subclass this.
"""
def create_response(self, *args, **kwargs):
response = super(CORSResource, self).create_response(*args, **kwargs)
response['Access-Control-Allow-Origin'] = '*'
response['Access-Control-Allow-Headers'] = 'Content-Type'
return response