Skip to content

Instantly share code, notes, and snippets.

View eltonvs's full-sized avatar
🏠
Working from Home

Elton Viana eltonvs

🏠
Working from Home
View GitHub Profile

Design Patterns

Para estudar para a prova:

  • Singleton
  • Facade
  • Observer
  • Strategy
  • Template Method
  • Adapter
  • Composite
@eltonvs
eltonvs / obdtest.py
Last active May 5, 2017 13:14
Retrieve data from obd with python-OBD api
import argparse
import obd
# Configure cli parser
parser = argparse.ArgumentParser()
parser.add_argument('port', help='enter the OBD port to retrieve data')
parser.add_argument(
'-d',
'--debug',
@eltonvs
eltonvs / xampp_installer.sh
Created April 30, 2017 16:27
A script to an easy XAMPP installation
wget https://www.apachefriends.org/xampp-files/7.1.1/xampp-linux-x64-7.1.1-0-installer.run -O xampp-installer.run
chmod +x xampp-installer.run
sudo ./xampp-installer.run
rm xampp-installer.run
@eltonvs
eltonvs / round_robin.py
Last active December 6, 2022 19:37
Round Robin Tournament Table Generator
from random import random
from pprint import pprint
def round_robin_gen(teams, away_home=False):
if len(teams) % 2 != 0:
teams.append(None)
matches = []
for it in range(len(teams) - 1):
@eltonvs
eltonvs / daily_update.sh
Created January 12, 2017 01:08
Shell script to update all repositories (works on arch linux)
sudo pacman -Syyu
sudo pacman -Sc --noconfirm
sudo pacman -R $(pacman -Qdtq)
@eltonvs
eltonvs / get_proc_data.cpp
Last active November 21, 2016 01:35
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <map>
struct Proc {
int pid;
int ppid;
double memory;
@eltonvs
eltonvs / operator2.cpp
Created November 7, 2016 02:45
aaaaaaaaaaaaaaaaaaaaaaaaa
#include <iostream>
using namespace std;
class Base {
public:
Base() {}
virtual ~Base() {};
virtual ostream &print(ostream &o) const = 0;
@eltonvs
eltonvs / operator.cpp
Created November 7, 2016 02:27
aaaaaaaaaaaaaaaaaaaaa
#include <iostream>
using namespace std;
class Base {
public:
Base() {}
virtual ~Base() = 0;
ostream& print(ostream &o) const {
o << "id: " << id << "\n";
#include <thread>
#include <cstdio>
#include <chrono>
#include <vector>
#include <sched.h>
#include <unistd.h>
using namespace std;
#define NUMTHREADS 10
@eltonvs
eltonvs / jekyll_installer.sh
Created October 19, 2016 13:03
Install jekyll and ruby (with all required dependencies) on debian based systems
sudo apt-get -y update && sudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev && cd /tmp && wget http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p481.tar.gz && tar -xvzf ruby-2.0.0-p481.tar.gz && cd ruby-2.0.0-p481/ && ./configure --prefix=/usr/local && make && sudo make install && gem install jekyll bundle