Skip to content

Instantly share code, notes, and snippets.

View iuridiniz's full-sized avatar

Iuri Diniz iuridiniz

View GitHub Profile
@iuridiniz
iuridiniz / OnceExample.java
Last active August 26, 2025 11:25
sync.Once (golang) in java
public class OnceExample {
public static void main(String[] args) {
testSimpleOnce();
testStatefulOnce();
}
private static void testSimpleOnce() {
SimpleOnce simpleOnce = new SimpleOnce();
System.out.println("Initial state: " + simpleOnce.getState()); // NOT_EXECUTED
@iuridiniz
iuridiniz / LICENSE
Last active July 15, 2025 08:21
C strtrim function: Trims leading and trailing whitespace from a string in-place
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2025 Iuri Diniz <iuridiniz-at-EMAIL-BIG-G.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@iuridiniz
iuridiniz / libs.md
Created July 7, 2025 11:10
8 Python Libraries So Good, I Stopped Writing My Own Scripts

Source

1. Rich 💅

It transforms plain command-line outputs into visually appealing and readable formats. You can easily add styled tables, markdown, syntax-highlighted tracebacks, and progress bars to make terminal applications more user-friendly.


@iuridiniz
iuridiniz / LameMP3Streamer.java
Last active May 16, 2025 13:23
The LameMP3Streamer class provides methods to encode raw audio data to MP3 * format using the LAME library
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/**
@iuridiniz
iuridiniz / dump.py
Created January 13, 2023 14:58
Dump environment variables, system information and other useful information
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Dump environment variables, system information and other useful information"""
import os
import contextlib
import platform
import psutil
import requests
@iuridiniz
iuridiniz / import.py
Created December 1, 2022 20:16
import all modules from this directory (recursively) to register them
import importlib
import os.path
import pkgutil
def import_all_modules(path, package):
# import all modules from this directory (recursively) to register endpoints in api_blueprint
# print("++importing all modules from: " + path)
pkgs = []
for (_, module_name, ispkg) in pkgutil.iter_modules([path]):
# print(f"importing module {module_name!r} in path {path!r} (ispkg={ispkg})")
@iuridiniz
iuridiniz / README.md
Last active December 16, 2022 18:48
SQL FROM validate_json_schema 0.1.1 (https://github.com/gavinwahl/postgres-json-schema)
@iuridiniz
iuridiniz / install_ena_2_5_0.sh
Last active November 9, 2021 19:31
install_ena_2_5_0.sh
#!/bin/sh
# curl -k https://gist.githubusercontent.com/iuridiniz/1562fb3f708535d78995d66877727c9c/raw/install_ena_2_5_0.sh | sh
set -x -e
apt-get install -y \
linux-headers-`uname -r` \
wget \
curl \
build-essential \
@iuridiniz
iuridiniz / overclock.c
Last active April 7, 2021 11:23
overclock nvidia (reverse engineering)
/*
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <[email protected]>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.