Skip to content

Instantly share code, notes, and snippets.

View bbrodriges's full-sized avatar

bbrodriges bbrodriges

View GitHub Profile
@arsham
arsham / go_cpu_memory_profiling_benchmarks.sh
Last active May 25, 2024 11:15
Go cpu and memory profiling benchmarks. #golang #benchmark
go test -run=. -bench=. -benchtime=5s -count 5 -benchmem -cpuprofile=cpu.out -memprofile=mem.out -trace=trace.out ./package | tee bench.txt
go tool pprof -http :8080 cpu.out
go tool pprof -http :8081 mem.out
go tool trace trace.out
go tool pprof $FILENAME.test cpu.out
# (pprof) list <func name>
# go get -u golang.org/x/perf/cmd/benchstat
benchstat bench.txt
@walm
walm / main.go
Last active May 15, 2024 06:01
Simple Golang DNS Server
package main
import (
"fmt"
"log"
"strconv"
"github.com/miekg/dns"
)

Update: download the new Pokemon Go app - it fixes all of this. Download it, and reauth, and you should be set. The grant scopes and prompt are correct and visible now too! Now if only I could actually find a pikachu...

Pokemon tokens are requested with these understandable scopes:

@DGivney
DGivney / httpd.asm
Last active January 4, 2024 13:58 — forked from xenomuta/httpd.asm
section .text
global _start
_start:
xor eax, eax ; init eax 0
xor ebx, ebx ; init ebx 0
xor esi, esi ; init esi 0
jmp _socket ; jmp to _socket
_socket_call:
@bbrodriges
bbrodriges / dbmeta.py
Created November 7, 2012 14:32
MySQL tables metadata
# Example (using Tornado database module)
# After init (e.g. db = Database()) you will get all meta info about tables stored in db.meta attribute
from tornado import database
class Database:
def __init__(self):
self.database = database.Connection('localhost', 'mydb', 'root', '12345')
@volodymyrsmirnov
volodymyrsmirnov / getpidmemory.c
Created October 25, 2012 18:20
Get PID resident memory size for MacOS, FreeBSD and Linux
#ifdef __APPLE__
#include <libproc.h>
#endif
#include <sys/resource.h>
#include <sys/param.h>
#include <sys/user.h>
#include <sys/sysctl.h>
#include <unistd.h>
#include <stdio.h>
@didip
didip / tornado-nginx-example.conf
Created January 30, 2011 05:19
Nginx config example for Tornado
worker_processes 2;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
}