Skip to content

Instantly share code, notes, and snippets.

View flaviostutz's full-sized avatar

Flavio Stutz flaviostutz

View GitHub Profile
@jboner
jboner / latency.txt
Last active May 5, 2024 03:12
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@andelf
andelf / sendMail.go
Last active September 20, 2023 15:13
golang send mail net/smtp SMTP
package main
import (
"log"
"net/mail"
"encoding/base64"
"net/smtp"
"fmt"
"strings"
@bradrydzewski
bradrydzewski / generate_docker_cert.sh
Last active March 12, 2024 17:00
Generate trusted CA certificates for running Docker with HTTPS
#!/bin/bash
#
# Generates client and server certificates used to enable HTTPS
# remote authentication to a Docker daemon.
#
# See http://docs.docker.com/articles/https/
#
# To start the Docker Daemon:
#
# sudo docker -d \
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@adam-p
adam-p / Local PR test and merge.md
Last active February 5, 2024 19:39
Testing a pull request, then merging locally; and avoiding TOCTOU

It's not immediately obvious how to pull down the code for a PR and test it locally. But it's pretty easy. (This assumes you have a remote for the main repo named upstream.)

Getting the PR code

  1. Make note of the PR number. For example, Rod's latest is PR #37: Psiphon-Labs/psiphon-tunnel-core#37

  2. Fetch the PR's pseudo-branch (or bookmark or rev pointer whatever the word is), and give it a local branch name. Here we'll name it pr37:

$ git fetch upstream pull/37/head:pr37
//Cria o índice especificando quais os analyzer ele tem
//Além disso especifica que o campo "titulo" do tipo "seu_tipo" utiliza o analyzer recem criado
curl -XPUT "http://localhost:9200/my_index" -d'
{
"settings": {
"analysis": {
"analyzer": {
"analyzer_customizado": {
"tokenizer": "standard",
@philipz
philipz / ceph.md
Created August 27, 2015 08:45
Docker Volume Driver Plugin for Ceph RBD
@eyecatchup
eyecatchup / git-commit-log-stats.md
Last active April 25, 2024 13:54
Some commands to get git commit log statistics for a repository on the command line.

git commit stats

Commands to get commit statistics for a Git repository from the command line -
using git log, git shortlog and friends.




@isseu
isseu / SqueezeNet TFLearn.py
Created June 16, 2016 09:57
Only the construction part, squeezenet with tflearn
self.network = input_data(shape = [None, SIZE_FACE, SIZE_FACE, 1])
self.network = conv_2d(self.network, 96, 3, strides = 3, activation = 'relu')
self.network = max_pool_2d(self.network, 3, strides = 2)
# Fire 1
fire2_squeeze = conv_2d(self.network, 16, 1, activation = 'relu')
fire2_expand1 = conv_2d(fire2_squeeze, 64, 1, activation = 'relu')
fire2_expand2 = conv_2d(fire2_squeeze, 64, 3, activation = 'relu')
self.network = merge([fire2_expand1, fire2_expand2], mode = 'concat', axis = 1)