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
@guilhermebr
guilhermebr / tmux-cheatsheet.markdown
Created October 19, 2018 17:35 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
name: tsuru-gce
components:
tsuru:
version: latest
driver:
name: google
private-ip-interface: ens4
options:
google-project: tsuru-test
google-tags: tsuru

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: http://rpmfusion.org/

package main
import (
"os"
"runtime"
"syscall"
"time"
"github.com/Sirupsen/logrus"
"github.com/opencontainers/runc/libcontainer"
package main
import (
"os"
"runtime"
"syscall"
"time"
"github.com/Sirupsen/logrus"
"github.com/opencontainers/runc/libcontainer"
package main
import (
"os"
"runtime"
"syscall"
"time"
"github.com/Sirupsen/logrus"
"github.com/opencontainers/runc/libcontainer"
// 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
@guilhermebr
guilhermebr / PySorteio.py
Created August 27, 2013 01:25
Codigo para sorteio de entradas no evento http://www.joincommunity.com.br
'''
Codigo para sorteio de entradas no evento http://www.joincommunity.com.br
@guilhermebr - Guilherme Rezende <guilhermebr@gmail.com>
'''
import urllib
import json
from random import shuffle, choice
#token temporario(1h) obtido em https://developers.facebook.com/tools/explorer
# 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

Find the Min

After sending smileys, John decided to play with arrays. Did you know that hackers enjoy playing with arrays? John has a zero-based index array, m, which contains n non-negative integers. However, only the first k values of the array are known to him, and he wants to figure out the rest.

John knows the following: for each index i, where k <= i < n, m[i] is the minimum non-negative integer which is not contained in the previous k values of m.

For example, if k = 3, n = 4 and the known values of m are [2, 3, 0], he can figure out that m[3] = 1.

John is very busy making the world more open and connected, as such, he doesn't have time to figure out the rest of the array. It is your task to help him.