Skip to content

Instantly share code, notes, and snippets.

View filiperfernandes's full-sized avatar

Filipe Ramalho Fernandes filiperfernandes

View GitHub Profile
@filiperfernandes
filiperfernandes / MacOSTools.sh
Last active November 1, 2017 05:09
#MacOS Usefull Tools for developers
#MacOS Usefull Tools for developers
xcode-select --install
#HomeBrew - Best package manager for macOS aka linux apt-get
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install wget
brew install git
brew install postgresql
@filiperfernandes
filiperfernandes / dhcpcd.conf
Last active March 13, 2018 17:37
Raspberry networking conf
#/etc/dhcpcd.conf
# Example static IP configuration:
interface eth0
static ip_address=192.168.1.2/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
static routers=192.168.1.1
static domain_name_servers=8.8.8.8 8.8.4.4 fd51:42f8:caae:d92e::1
CREATE USER locmess WITH PASSWORD 'password';
CREATE DATABASE locmess_db;
\connect locmess_db;
CREATE SCHEMA AUTHORIZATION locmess;
GRANT ALL PRIVILEGES ON DATABASE locmess_db TO locmess;
#Install docker script
curl -sSL https://get.docker.com |sh
#Get docker up and running
- Start docker:
```
$ sudo systemctl start docker
```
@filiperfernandes
filiperfernandes / rsa_encryption.java
Created May 16, 2018 21:07
how to encrypt & decrypt with RSA in Java
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.PublicKey;
import javax.crypto.Cipher;
public class Sample {
@filiperfernandes
filiperfernandes / Setup mDNS to raspberry pi
Last active May 31, 2018 14:33
Setup mDNS to raspberry pi
#Install packages:
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install avahi-daemon
#Assuming your hostname is "raspberrypi" it is now available at: raspberrypi.local
#If you want to change hostname:
@filiperfernandes
filiperfernandes / ns-inet.sh
Created September 26, 2018 10:39 — forked from dpino/ns-inet.sh
Setup a network namespace with Internet access
#!/usr/bin/env bash
set -x
NS="ns1"
VETH="veth1"
VPEER="vpeer1"
VETH_ADDR="10.200.1.1"
VPEER_ADDR="10.200.1.2"
@filiperfernandes
filiperfernandes / gist:540665ccbb0cafde25a938579be08d2e
Created September 26, 2018 11:08
Linux network namespaces sheet
# List all namespace, except for the default/global one.
ip netns
# Same as above, list all namespaces.
ip netns list
# Execute command inside a specific namespace
ip netns exec <namespace_name> <command>
# Sets specified interface in the specified namespace
@filiperfernandes
filiperfernandes / namespaces.sh
Last active December 29, 2023 07:03
Script to create two namespaces and connection between them
#Install Openvswitch on ubuntu
sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils
sudo apt-get install openvswitch-switch
#Create Namespace
sudo ip netns add mario
sudo ip netns add luigi
#Create virtual switch
sudo ovs-vsctl add-br my-switch
@filiperfernandes
filiperfernandes / acestream.sh
Created November 4, 2018 18:52
Acestream for MacOS and linux
#!/bin/sh
#Usage:
# To start: acestream start [acestream_id_only]
# To stop: acestream stop
#Dependencies:
# docker pull ikatson/aceproxy
# #docker run -t -p 8000:8000 --name aceproxy ikatson/aceproxy
# vlc