Skip to content

Instantly share code, notes, and snippets.

Gabriel Fernandes gabrielfern

Block or report user

Report or block gabrielfern

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gabrielfern
gabrielfern / Medições
Last active Jul 1, 2019
adsd medição usando ffmpeg
View Medições
[1 min]
[1080p30]
cpu 384% mem 606,628k time 72.34s
cpu 384% mem 606,724k time 72.74s
[1080p60]
cpu 388% mem 608,724k time 122.89s
cpu 388% mem 609,192k time 124.12s
[4k30]
cpu 387% mem 2,145,880k time 267.67s
cpu 386% mem 2,145,648k time 267.61s
@gabrielfern
gabrielfern / hello.asm
Created Nov 25, 2018
hello world em assembly, linux x86_64
View hello.asm
# assembly para "hello world" em linux x86_64
# assemblar e linkar
# as hello.asm -o hello.o && ld hello.o -o hello
# executar
# ./hello
.data # secao de dados do programa
msg: .ascii "Hello, World!\n" # mensagem a ser escrita na tela
@gabrielfern
gabrielfern / RLGDT_Walls.java
Created Nov 13, 2018
Robo que pega o Walls
View RLGDT_Walls.java
import java.awt.Color;
import robocode.AdvancedRobot;
import robocode.BulletHitEvent;
import robocode.HitRobotEvent;
import robocode.ScannedRobotEvent;
public class RLGDT_Walls extends AdvancedRobot {
final int NE = 0, SE = 1, SO = 2, NO = 3;
double eixoDeDescida;
@gabrielfern
gabrielfern / pi.c
Created Oct 29, 2018
Leibniz to find π
View pi.c
#include <stdio.h>
#include <stdlib.h>
double calc(unsigned long n) {
unsigned long i = 0;
double sum = 0;
while (i < n) {
sum += (i%2 == 0 ? 1.0 : -1.0) / (2*i+1);
i++;
@gabrielfern
gabrielfern / userChrome.css
Created Oct 11, 2018
Firefox csd fix (theme: Mint-Y-Darker)
View userChrome.css
.titlebar-placeholder[type="pre-tabs"] {
display:none !important;
}
#TabsToolbar {
background-color: #2f2f2f;
}
@gabrielfern
gabrielfern / hamming.c
Last active Oct 11, 2018
Detecção e correção de erro por hamming
View hamming.c
#include <assert.h>
/* retorna 0 caso não exista erro
retorna 1 caso exista erro */
int checa_erro(void *dados, unsigned long num_bits) {
unsigned char *array = dados;
unsigned i = 1, j = 0;
while (j < num_bits) {
@gabrielfern
gabrielfern / paridade.c
Last active Oct 1, 2018
Detecção de erro por paridade
View paridade.c
#include <assert.h>
// Implementado paridade par
/* retorna 0 caso não tenha erro de paridade
retorna 1 caso exista erro de paridade */
int checa_erro(void *dados, unsigned tamanho) {
unsigned long total = 0;
while (tamanho > 0) {
unsigned char byte = ((char *) dados)[tamanho-1];
@gabrielfern
gabrielfern / n-queens.py
Last active Sep 26, 2018
Find the number of solutions to a n queen problem
View n-queens.py
from sys import argv
from itertools import combinations
class Board:
def __init__(self, n):
self.board = [[0]*n for _ in range(n)]
def __repr__(self):
@gabrielfern
gabrielfern / git.md
Last active Sep 24, 2018
Pratica de Git no terminal
View git.md

Antes de comecar, vamos configurar o git

configurar seu nome

git config --global user.name "Seu Nome"

configurar seu email

git config --global user.email "exemplo@gmail.com"

escolha o editor de texto que sera usado pelo git

git config --global core.editor "gedit"

@gabrielfern
gabrielfern / configuracao.md
Last active Mar 5, 2018
Configuração do postgresql no ubuntu/linuxmint
View configuracao.md
  1. Instale o postgresql

sudo apt install postgresql

  1. Acesse a interface de comando psql

sudo -u postgres psql

  1. Mude a senha do user postgres para 'postgres'

alter user postgres password 'postgres';

  1. Crie o banco de dados estoquefacildb
You can’t perform that action at this time.