Skip to content

Instantly share code, notes, and snippets.

View ereyes01's full-sized avatar

Eddy Reyes ereyes01

View GitHub Profile
@ereyes01
ereyes01 / README.md
Last active February 14, 2020 17:40
Concurrent MD5 Hash (From Austin Linux Meetup 2/13/2020)

The compiler error we hit as we were running out of time was due to the invisible underscores! Somehow, I had typed:

for_h := range ...

but we couldn't see the underscore due to the problem with my editor and the font size change!

There was one more problem I fixed in the reducer, besides the compiler error. A common pitfall in Go is when you write a loop with an inner function / go routine that uses the containing loop's iterator... you need to pass the value as an argument of the inner function, or otherwise all the go routines will share the same variable containing the last value of the loop!

The benchmarks on my computer: No concurrency: 18s

Keybase proof

I hereby claim:

  • I am ereyes01 on github.
  • I am ereyes01 (https://keybase.io/ereyes01) on keybase.
  • I have a public key ASDqGM9ISaV9BDhkleBFLEXWknvct27Cj2a5EmOyyiRHJQo

To claim this, I am signing this object:

@ereyes01
ereyes01 / es6.go
Last active December 26, 2017 21:21
Testing ES6 and Otto
package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
"strings"

Keybase proof

I hereby claim:

  • I am ereyes01 on github.
  • I am ereyes01 (https://keybase.io/ereyes01) on keybase.
  • I have a public key ASDdoGe-N-TUyHMeOQJrecWZGLkdx0lLecOcUeyFaFj4NQo

To claim this, I am signing this object:

@ereyes01
ereyes01 / firebase_benchmark.py
Last active February 24, 2016 21:34
A script that helps you benchmark your firebase performance
#!/usr/bin/env python
import json
import sys
import subprocess
count = int(sys.argv[1])
url = sys.argv[2]
curl = "curl -so /dev/null -w '" + '{"http_code": %{http_code}, "time_total": %{time_total}, "time_namelookup": %{time_namelookup}, "time_connect": %{time_connect}, "time_appconnect": %{time_appconnect}, "time_pretransfer": %{time_pretransfer}, "time_redirect": %{time_redirect}, "time_starttransfer": %{time_starttransfer}, "size_download": %{size_download}, "size_upload": %{size_upload}, "size_header": %{size_header}, "size_request": %{size_request}, "speed_download": %{speed_download}, "speed_upload": %{speed_upload} }' + "' "
@ereyes01
ereyes01 / demo-bot.go
Created October 30, 2015 03:56
Custom Slack Bot in Go
package main
import (
"log"
"os"
"os/signal"
"strconv"
"github.com/FogCreek/victor"
"github.com/FogCreek/victor/pkg/chat/slackRealtime"
@ereyes01
ereyes01 / tasqr-example
Last active August 29, 2015 14:07
Tasqr CLI usage
$ cd /opt/myproject
$ tasqr git clone http://github.com/me/mywebsite.git
Saving "git clone..."
$ tasqr cp services/emailer.conf /etc/init/
Saving "sudo services/..."
$ tasqr initctl start emailer
Saving "initctl start..."
@ereyes01
ereyes01 / make_server.py
Last active August 29, 2015 14:04
Containable - More Detailed Python Mockup
"""
A simple script that deploys the website deployment module to an EC2 server.
"""
import containable
import my_website
website_blueprint = my_website.MyWebsite(nginx_config_path="/work/my-nginx.conf",
git_url="http://github.com/me/website.git")
@ereyes01
ereyes01 / containable-curl.example
Last active August 29, 2015 14:04
Containable REST API Sample Usage
$ cat box-start.json
{
"name" : "my-server",
"state" : "running"
}
$ curl -v -H "Content-Type: application/json" -X PUT \
--data "@box-start.json" -H "X-Containable-API-Key" \
https://containable-server.com/boxes/my-server
$ cat add-admin.json
{
@ereyes01
ereyes01 / containable-python.py
Last active August 29, 2015 14:04
Containable Python Binding
box.start()
box.add_user(username="admin", home_dir="/home/admin",
shell="/bin/bash")
box.install_packages(['python-dev',
'python-pip',
'redis-server',
'openssh-server',
'libffi-dev'])