Skip to content

Instantly share code, notes, and snippets.

View raikel's full-sized avatar

Raikel Bordón López raikel

View GitHub Profile
@raikel
raikel / git.md
Last active August 26, 2025 17:43
# Rename a branch and delete remote old branch
git checkout <old_name>
git branch -m <new_name>
git push origin -u <new_name> # If the old branch is on remote
git push origin --delete <old_name> # If the old branch is on remote

# Revert to the state just before the last commit
git reset HEAD^
git reset 'HEAD@{1}' # revert last one

Connect with command line

sudo -i -u postgres # change user 
psql # connect to postgresql

Commnands

# List all users
@raikel
raikel / linux-cmds.md
Last active February 12, 2025 17:31
Useful Linux commands
# List proccess
ps aux

# journalctl logs
journalctl -u clinic_server.service --since "1 hour ago"
journalctl -u clinic_server.service --since "2 days ago"

# Find text in files in current dir recursively
grep -Ril "a_word" . --include \*.txt --exclude \*.ano --exclude-dir=site-packages
@raikel
raikel / hadoop.md
Last active May 2, 2021 15:23
Hadoop setup
sudo apt update
# Install JDK
sudo apt install python-software-properties
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt install openjdk-11-jdk
sudo apt-get update
java -version
@raikel
raikel / ssh.md
Last active April 11, 2021 21:48
SSH

Generate a new SSH key

ssh-keygen -t rsa -b 4096 -C "<mail_address>"

Add the key to the SSH agent:

ssh-agent bash # starts the SSH agent in backgroud
@raikel
raikel / docker.md
Last active May 12, 2022 14:50
Getting started with Docker

Install Docker

sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install docker-ce
@raikel
raikel / nginx-stream.md
Last active November 15, 2020 19:32
Stream RTMP and HLS video with Nginx
  1. Install nginx RTMP module

sudo apt install libnginx-mod-rtmp

  1. Add the following configuration to /etc/nginx/nginx.conf
rtmp {
        server {
                listen 1935;

Cerbot with Nginx

More info here. Ensure you have server blocks for example.com and www.example.com, and that the port 443 is allowed through the firewall.

sudo add-apt-repository ppa:certbot/certbot
sudo apt install python-certbot-nginx
sudo certbot --nginx -d example.com -d www.example.com
*filter

# Drop NULL packets
-A INPUT -p tcp --tcp-flags ALL NONE -j DROP

# Block syn flood attack
-A INPUT -p tcp ! --syn -m state --state NEW -j DROP

# Block XMAS packets

Plugins

How to add an Android library to a plugin

Put the library files in a directory <plugin_root>/android/<lib_name>. Next, edit the file <plugin_root>/android/build.gradle:

dependencies {