Skip to content

Instantly share code, notes, and snippets.

View luisprox's full-sized avatar

Luís Prox luisprox

View GitHub Profile
@luisprox
luisprox / LinuxIPTablesPortForwarding.md
Last active May 4, 2022 14:06
[Linux Port Forwarding] How to forward port request to another machine on the network #Linux #Debian #iptables
  1. Enable ip forward.
$ sudo echo 1 >/proc/sys/net/ipv4/ip_forward
  1. Add forwarding rule.
# this example forwards port 8080 to machine ip 122.164.34.240, port 80
@luisprox
luisprox / MonitorTCPLinux.md
Created December 15, 2021 14:19
[Monitor tcp traffic] How to monitor http requests using tcpflow #tcpflow #Linux

Installation

sudo apt install tcpflow

Monitor requests

Monitor get/post requests at port 80:

@luisprox
luisprox / pythonvenv.md
Last active November 10, 2023 12:17
[Python virtualenv quick start] Quick step by step guide to use python virtual environment #python #virtualenv

Python Virutal Environment Quick Guide

Default venv that comes with new versions of python3 is a subset of the more complete virtualenv. So it is recommended to use the more complete virtualenv.

In Linux

  1. Install virtual environment
$ sudo apt install python3-virtualenv
@luisprox
luisprox / SQLiteDatetime.md
Created April 30, 2021 12:28
[Using Datetime in SQLite] How to manage date and time in SQLite tables #SQLite #datetime

DATETIME in SQLite

SQLite does not have official datetime type. It is possible to store dates and times with 3 different approaches:

  1. INTEGER as Unix Time, the number of seconds since 1970-01-01 00:00:00 UTC.
  2. TEXT as ISO8601 strings (“YYYY-MM-DD HH:MM:SS.SSS”).
  3. REAL as Julian timestamp, the number of days since noon in Greenwich on November 24, 4714 BC.

Using INTEGER data type

@luisprox
luisprox / PythonCombineDataPandas.md
Last active April 21, 2021 01:40
[Combining dataframes with pandas] Summary of pandas merge, join and concat functions to combine data #python #pandas #dataanalysis

Merge

The same as SQL join operation.

How

Select the type of merge through how parameter.

inner

@luisprox
luisprox / LaTeXMarkdown.md
Last active April 7, 2021 02:54
[Add Latex Math Equation to markdown] How to add LaTeX math equations to markdown #markdown #LaTeX #gist

Markdown does not have a way to write math equations.

Recommended solution is to use a web link to a site service which provides math equation view.

Option 1: codecogs website includes an online equation editor which allows generating a link to the equation, like the example bellow.

img
\

@luisprox
luisprox / Linux_MngUsers.md
Last active April 26, 2022 11:42
[Linux Gerenciando usuários pelo teminal] Como criar e gerenciar usuários e grupos via Terminal #Linux #Debian #users

Ajuda dos comandos

Verificar o comando adduser para manipulação dos usuários, e groupadd para grupos

$ man adduser
$ man groupadd

Usuários