Skip to content

Instantly share code, notes, and snippets.

@gustavorv86
gustavorv86 / c_pthread_shared_variable_example.c
Last active March 5, 2024 22:13
Shared a global variable into multiple threads.
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
typedef struct {
pthread_t thread;
int id_thread;
long sec_usleep;
} thread_info_t;
@gustavorv86
gustavorv86 / get_md5.py
Created March 27, 2019 14:19
Python get MD5 of file
#!/usr/bin/env python
import hashlib
import os
import sys
def md5(path_file):
checksum = hashlib.md5()
@gustavorv86
gustavorv86 / tcp-file-transfer.py
Last active February 4, 2024 19:13
Python send and reveive files via TCP connection.
#!/usr/bin/env python3
import argparse
import logging
import os
import socket
import sys
BUFFER_SIZE = 1200
@gustavorv86
gustavorv86 / README.md
Last active November 25, 2023 21:13
Reading an infrared (IR) receiver with Python on GNU/Linux

Reading an infrared (IR) receiver with Python on GNU/Linux

Many development boards incorporate an infrared receiver, such as Orange PI, Bananapi, Libre computer, Pine64, etc.

This manual explains how to configure the infrared receiver in Linux and shows an example of how to read the infrared codes emitted by a remote control.

Configuration

Show all input devices:

@gustavorv86
gustavorv86 / tp-link-tl-wn821n-rtl8192eu-install.sh
Created November 8, 2023 09:45
Install Tp-Link wn821n rtl8192eu driver on GNU/Linux
@gustavorv86
gustavorv86 / debian-11-bullseye-sources.list
Last active November 8, 2023 07:06
Debian Bullseye/Oldstable official repositories
deb http://deb.debian.org/debian bullseye main contrib non-free
deb-src http://deb.debian.org/debian bullseye main contrib non-free
deb http://deb.debian.org/debian-security/ bullseye-security main contrib non-free
deb-src http://deb.debian.org/debian-security/ bullseye-security main contrib non-free
deb http://deb.debian.org/debian bullseye-updates main contrib non-free
deb-src http://deb.debian.org/debian bullseye-updates main contrib non-free
@gustavorv86
gustavorv86 / c_priority_queue_threads.c
Last active September 8, 2023 04:42
POSIX message priority queue example written in C/C++
/**
* Compile:
* gcc -std=gnu11 -Wall -Wextra c_priority_queue_threads.c -o priority_queue_threads -lpthread -lrt
*/
#include <errno.h>
#include <mqueue.h>
#include <fcntl.h> /* For O_* constants. */
#include <sys/stat.h> /* For mode constants. */
@gustavorv86
gustavorv86 / reverse-shell.py
Last active July 16, 2023 19:18
Linux Reverse Shell on Python.
#!/usr/bin/env python3
import argparse
import socket
import os
import pty
import sys
import time
WAIT_CONNECTION = 10
@gustavorv86
gustavorv86 / number-conversion.py
Last active July 11, 2023 08:26
Graphical user interface (aka GUI) to convert from/to binary, decimal, hexadecimal and IP address using Tkinter python modules.
#!/usr/bin/env python3
import ipaddress
import tkinter
import tkinter.ttk
import tkinter.messagebox
import sys
def bin2dec(value):
@gustavorv86
gustavorv86 / linux-bridge.md
Last active July 11, 2023 08:17
How to create a network bridge in Linux

How to create a network bridge in Linux

Requirements

Check if iproute2 is installed.

dpkg -s iproute2