Skip to content

Instantly share code, notes, and snippets.

View jcchavezs's full-sized avatar

José Carlos Chávez jcchavezs

View GitHub Profile
@jcchavezs
jcchavezs / pom.xml
Created January 15, 2020 09:20
armenia-no-issue
<?xml version="1.0" encoding="UTF-8" ?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.jcchavezs.armeriademo</groupId>
<artifactId>armeria-demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<?xml version="1.0" encoding="UTF-8" ?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.github.jcchavezs.bravehybridpropagation</groupId>
<artifactId>brave-hybrid-propagation-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
@jcchavezs
jcchavezs / bench_test.go
Created November 5, 2019 19:02
HTTP client timeout vs request context deadline
package client
import (
"context"
"net/http"
"net/http/httptest"
"testing"
"time"
)
@jcchavezs
jcchavezs / retryablehttp.go
Last active October 21, 2019 13:21
zipkin-go-retryablehttp
package zipkinretryablehttp
import (
"net/http"
"github.com/hashicorp/go-retryablehttp"
zipkinhttp "github.com/openzipkin/zipkin-go/reporter/http"
)
var (
@jcchavezs
jcchavezs / bench_test.go
Last active March 3, 2019 21:58
Benchmark B3 Single header parsing
package b3
import (
"testing"
"github.com/openzipkin/zipkin-go"
)
func BenchmarkParseSingleHeader(b *testing.B) {
// run the Fib function b.N times
@jcchavezs
jcchavezs / homehandler.go
Last active April 6, 2018 12:18
Instrumenting a Go application with Zipkin
package main
import (
"bytes"
"net/http"
)
func HomeHandler(w http.ResponseWriter, r *http.Request) {
body := bytes.NewBufferString("the body")
res, err := Post(r.Context(), "http://url.com/things", "text/plain", body)
@jcchavezs
jcchavezs / tmux.conf
Created June 16, 2017 07:09 — forked from spicycode/tmux.conf
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@jcchavezs
jcchavezs / 2.php
Created January 27, 2016 15:50
Project Euler
$e = 1;
$g = 1;
$total = 0;
while ($e <= 4000000) {
if ($e % 2 == 0){
$total += $e;
//echo $e. PHP_EOL;
}
@jcchavezs
jcchavezs / UPGRADE.md
Last active January 8, 2016 09:30
Upgrade to PHP 5.6

Upgrade your Vagrant to PHP 5.6

Procedure

Run this inside Vagrant

sudo apt-get update && sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php5-5.6
sudo apt-get clean    // For solving the problem about 'Package phpapi-20121212 is not installed.
@jcchavezs
jcchavezs / BaseException.php
Last active October 28, 2015 17:28
Translatable exception
<?php
namespace MyBundle\MyEnvironment;
use \Exception;
abstract class BaseException extends Exception
{
abstract protected $alerts;