Skip to content

Instantly share code, notes, and snippets.

View Apocryphon-X's full-sized avatar
🎉
This time, let's do things the right way.

Dante Mendoza Apocryphon-X

🎉
This time, let's do things the right way.
  • National Polytechnic Institute
  • México
  • 06:08 (UTC -06:00)
View GitHub Profile
#include <iostream>
#include <string>
struct color {
short r;
short g;
short b;
};
std::string as_24bit_ansi(color values) {
@Apocryphon-X
Apocryphon-X / args_analyzer.py
Last active December 18, 2024 21:40
`parse_argument_list` accepts a flags "register" as second argument to handle things like -h / --help or things like --debug flags!
"""
The MIT License (MIT)
Copyright (c) 2024 - Present, @Apocryphon-X (Dante Mendoza Leyva)
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
@Apocryphon-X
Apocryphon-X / 1.seven_segments_controller.vhd
Last active December 30, 2024 03:40
[VHDL] 7-Segment Display Controller designed to display the number "1515" as an example.
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
-- * Author: Dante Mendoza Leyva (4CV13)
entity seven_segments_controller is Port (
clk: in std_logic;
anodes: out std_logic_vector(3 downto 0);
display_glyph: out std_logic_vector(6 downto 0)
@Apocryphon-X
Apocryphon-X / 1.four_bit_number_select.vhd
Last active December 18, 2024 21:37
Display the selected 4-bits number in the seven segments display. (4-bit numbers can be edited using switches)
-- * Author: Dante Mendoza Leyva
-- * Group: 4CV13
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.numeric_std.all;
entity seven_segments_driver is Port (
clk: in std_logic;
@Apocryphon-X
Apocryphon-X / 1.toggle_led_using_button.vhd
Last active December 18, 2024 21:38
Every time the button is pressed, the chosen led changes from '0' to '1' or from '1' to '0' respectively. Button press takes effect only after 120μs of being held (assuming `clk` is assigned to a 100MHz clock).
-- * Author: Dante Mendoza Leyva
-- * Group: 4CV13
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.numeric_std.all;
entity led_test is Port (
clk: in std_logic;
@Apocryphon-X
Apocryphon-X / template.cpp
Last active December 30, 2024 03:42
[C++] Template for Competitive Programming
#ifdef LOCAL
#define _FORTIFY_SOURCE 2
#define _GLIBCXX_DEBUG_PEDANTIC
#define _GLIBCXX_DEBUG
#define debug(x) \
std::cerr << std::boolalpha << "\x1b[33m[DEBUG] " \
<< #x" = " << x << "\x1b[0m\n"
#else
#define NDEBUG 1
#define debug(x) 1
try:
# pip install requests rich
import requests
from rich.console import Console
from rich.progress import Progress, SpinnerColumn, TimeElapsedColumn
from rich.traceback import install
from rich import inspect
from rich import print
except ImportError as e:
print(e, "- Is it installed?")
@Apocryphon-X
Apocryphon-X / google_autorevert_translation.js
Last active May 15, 2025 23:02
Este script de Tampermonkey revierte las traducciones automáticas molestas en los resultados de búsqueda de Google. //// This Tampermonkey script reverts the annoying automatic translations in Google search result snippets. It’s important to adapt the script to match the user’s preferred language.
// ==UserScript==
// @name Google ─ Auto‑click “Ver original *”
// @namespace https://tampermonkey.net/users/señor
// @version 1.1.0
// @description Hace clic automáticamente en todos los elementos con jsaction="YjLrZe" cuyo texto comience con "Ver original ", preservando la posición de scroll y evitando rebotes visuales. Es importante adaptar el prefijo al idioma del usuario.
// @author Apocryphon-X (Asistencia: GPT-4o)
// @match *://www.google.com/*
// @grant none
// @run-at document-idle
// ==/UserScript==