Skip to content

Instantly share code, notes, and snippets.

@gabrielfern
gabrielfern / git.md
Last active September 24, 2018 18:19
Pratica de Git no terminal

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 March 5, 2018 00:04
Configuração do postgresql no ubuntu/linuxmint
  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
#include "stdlib.h"
// declaracoes das funcoes para por no ".h"
double mediana(int, double *);
double *moda(int, double *);
// ate aqui
// definicoes das funcoes
i = 1
while i <= 5:
print(i, input())
i += 1
i = 1
while i <= 5:
print(i, 'out')
i += 1
@gabrielfern
gabrielfern / relogio.py
Created August 16, 2017 02:16 — forked from ramalho/relogio.py
Um relógio bem simples feito em Python com Tkinter. Vídeo de demonstração: http://www.youtube.com/watch?v=xCiPshN9nOs
#!/usr/bin/env python3
import tkinter
from time import strftime
def tic():
rel['text'] = strftime('%H:%M:%S')
def tac():
tic()
rel.after(1000, tac)
@gabrielfern
gabrielfern / git-tag-delete-local-and-remote.sh
Created July 27, 2017 00:15 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@gabrielfern
gabrielfern / remove.io
Last active June 22, 2017 03:33
remove - recursive linked list
@Override
public void remove(T element) {
if (element != null) {
if(!isEmpty()) {
if(this.getData().equals(element)) {
this.setData(this.getNext().getData());
if(!this.getNext().isEmpty()) {
this.setNext(this.getNext().getNext());
}
}
@gabrielfern
gabrielfern / toArray.com
Created June 22, 2017 03:23
my toArray
@SuppressWarnings("unchecked")
@Override
public T[] toArray() {
T[] result = null;
if (!this.isEmpty()) {
result = (T[]) new Object[1];
result[0] = this.data;
result = this.juntaArrays(result, this.next.toArray());
}
if (result == null) {
@gabrielfern
gabrielfern / gist:61633effa9889b5478ea2d92aa8a0d37
Created May 30, 2017 02:59 — forked from m00nlight/gist:a076d3995406ca92acd6
Python merge sort in place, so space complexity is O(1)
import random
def merge_sort(xs):
"""Inplace merge sort of array without recursive. The basic idea
is to avoid the recursive call while using iterative solution.
The algorithm first merge chunk of length of 2, then merge chunks
of length 4, then 8, 16, .... , until 2^k where 2^k is large than
the length of the array
"""