Skip to content

Instantly share code, notes, and snippets.

@h4k1m0u
h4k1m0u / Plot_dates.py
Created July 2, 2025 19:25
Plot bar chart of dates appearing in the txt file using matplotlib
#!/usr/bin/env python3
"""
Python datetime: https://docs.python.org/3/library/datetime.html
Numpy datetime: https://numpy.org/doc/stable/reference/arrays.datetime.html
Pandas datetime: https://pandas.pydata.org/docs/user_guide/timeseries.html
"""
import numpy as np
from datetime import datetime
import matplotlib.pyplot as plt
@h4k1m0u
h4k1m0u / plot.gnuplot
Created July 1, 2025 21:59
Plot daily data consumption calculated by vnstat using gnuplot's bar plot
set style fill solid 0.5;
set xtics rotate
set xlabel "Day";
set ylabel "MiB";
# data file passed as a command-line argument (variable ARG1)
# 0: pseudo-column for indexes starting from zero = x-axis
# 2: y-axis=2nd column in file
# xticklabels(1): ticks on x-axis from 1st column in file
plot ARG1 using 0:2:xticlabels(1) title "Daily data usage in MiB" with boxes;
@h4k1m0u
h4k1m0u / images-pdfs.md
Last active May 20, 2025 18:12
Bash notes related to images and pdf files

Batch processing

  • Install batcher Gimp plugin by copying its extracted folder to ~/.config/GIMP/3.0/plug-ins.
  • Multiple images can be easily resized from its gui in gimp.

Multiple image to pdf

  • Gimp not used because the pdf produced is too large on the disk.
  • convert (from imagemagick) and img2pdf without the --imgsize option, produce pages of different sizes in the same pdf document.
  • Without sorting by number, wildcards would sort files in an alphabetical order.
@h4k1m0u
h4k1m0u / kde.md
Last active May 18, 2025 14:12
Notes about KDE

Minimal plasma installation

$ sudo pacman -Sy plasma-desktop

Plasma applet for managing audio volume

Visible in lower-right corner:

$ sudo pacman -Sy plasma-pa
@h4k1m0u
h4k1m0u / ld.md
Created March 6, 2025 20:28
Notions about gcc and the linker ld

Linking order

The dependent executable should appear before the libraries it depends on, as order is important (See 1).

@h4k1m0u
h4k1m0u / Android.md
Last active April 22, 2025 20:18
Notes about coding Android apps with Kotlin using Android Studio

Kotlin

  • Statically typed language.
  • Outputs bytecode that runs on the JVM (like Java).

Build Automation tools for JVM projects

All of them are similar to CMake but for Java/Kotlin:

  • Gradle: Build system for Android used for compilation, packaging (APK), and for dependency management. Preferred for Kotlin projects.
@h4k1m0u
h4k1m0u / frida.md
Created January 12, 2025 22:13
Notes taken from youtube videos about Frida

What is it

An instrumentation tool for x86, Android..., that targets binary applications.

Usage

  • To debug live processes.
  • To execute your script inside another process.

Applications

  • Frida is used for dynamic reverse engineering (i.e. analyze a program while software is running).
  • Static reverse engineering software in contrast take binaries to dissect them.
@h4k1m0u
h4k1m0u / steganography_read.c
Created August 15, 2024 16:10
Use steganography to read/write a textual password from/to sequential pixels' least-significant bits
#include <limits.h>
#include <string.h>
#include <stdbool.h>
#include <gd.h>
#include "utils.h"
/**
* Print password written beforehand on image with steganography_write.c
* - GD documentation: https://libgd.github.io/manuals/2.1.1/files/preamble-txt.html
@h4k1m0u
h4k1m0u / Sierpinski.c
Last active April 10, 2025 16:59
Draw a Sierpinski triangle using Chaos game
#include <gd.h>
// C doesn't allow variable length arrays (even using a constant)
#define N_CORNERS 3
typedef struct {
int x;
int y;
} Point;
@h4k1m0u
h4k1m0u / read_bitmap.c
Created July 6, 2024 13:32
Parse bitmap image to find RGB values at given row and column
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
/**
* Parse bitmap image to find RGB values at given row and column
* Bitmap format: https://en.wikipedia.org/wiki/BMP_file_format
* Tested input bitmap image saved in Gimp without color space information and in 24bits format