Skip to content

Instantly share code, notes, and snippets.

View guilhermebr's full-sized avatar
🇧🇷
Working from home

Guilherme Rezende guilhermebr

🇧🇷
Working from home
View GitHub Profile
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 16, 2024 16:59
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@border
border / mgoExample.go
Created August 27, 2012 15:33
mgo example
package main
import (
"fmt"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"time"
)
type Person struct {
# coding: utf-8
u"""
Redimensionamento proporcional de imagem, com base na altura, feito com um simples cálculo de proporção.
Ex:
+------+ 10 15 (altura desejada para a nova imagem)
| | -- x --
| 10x5 | 5 x (largura proporcional a nova altura)
| |
+------+ (10 x x) = (5 x 15)
10x = 75
@plentz
plentz / nginx.conf
Last active July 15, 2024 17:46
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@richp10
richp10 / gist:1c367d3c67aec762788e
Created May 10, 2014 10:19
Secure iptables configuration for coreos ??
// This systemd runs iptables-restore on boot:
[Unit]
Description=Packet Filtering Framework
DefaultDependencies=no
After=systemd-sysctl.service
Before=sysinit.target
[Service]
Type=oneshot
ExecStart=/usr/sbin/iptables-restore /opt/docker/scripts/iptables/iptables.rules
@cezarsa
cezarsa / curl
Last active June 14, 2019 20:52
tsuru curl plugin
#!/bin/bash
TARGET=$(echo ${TSURU_TARGET} | sed "s|/$||g")
curl -sS -H"Authorization: bearer ${TSURU_TOKEN}" ${TARGET}$@

The current kernel/drivers of Fedora 24 do not support the Wifi chip used on my Mac Book Pro. Proprietary Broadcom drivers are packaged and available in the rpmfusion repo.

Verify that your card is a Broadcom using: lspci -vnn -d 14e4:

Sample output:

02:00.0 Network controller [0280]: Broadcom Corporation BCM4360 802.11ac Wireless Network Adapter [14e4:43a0] (rev 03)

Install

Install the rpmfusion repo, note only "nonfree" is required, as the Broadcom Driver is proprietry: http://rpmfusion.org/

@gboudreau
gboudreau / AuthyToOtherAuthenticator.md
Last active July 17, 2024 07:47 — forked from Ingramz/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

Desafio Técnico-Elixir

Precisamos de pessoas com energia, integridade e inteligência, que aprendam rápido e que gostem de conhecer e aplicar novas tecnologias.

O tempo sugerido para conclusão do desafio é de 15 dias. Queremos que você se dedique e demonstre a qualidade de seu código.

Bom desafio!

O Desafio

O Sistema Financeiro precisa representar valores monetários. A ideia básica é ter uma estrutura de dados que permita realizar operações financeiras com dinheiro dentro de uma mesma moeda. Isso é pelo motivo de pontos flutuantes terem problemas de aritmética, logo encodificamos valores decimais/fracionais/reais como uma estrutura de dados com campos em inteiros, além de mapeamos operações aritméticas sobre tal estrutura. No fim, a implementação acaba sendo uma Estrutura de Dados Abstrata.