Skip to content

Instantly share code, notes, and snippets.

@AlmuHS
AlmuHS / smp_demo_pthread.c
Last active October 8, 2023 21:33
SMP Demo Code: Execute a bunch of threads, showing by screen which cpu are executing each - 32-bit version
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
#include <sys/types.h>
#define MS_STOP_TIME 100
#define NUM_THREADS 16
unsigned int get_apic_id(void){
unsigned int cpu_eax, cpu_ebx, cpu_ecx, cpu_edx;
@AlmuHS
AlmuHS / process_child.cpp
Last active March 22, 2023 13:03
Get the child of a process by its name in Linux
#include <algorithm>
#include <vector>
#include <iostream>
#include <fstream>
#include <proc/readproc.h>
void ProcIdFromParentProcId(int parentProcId, std::vector<int>& procId) {
PROCTAB *proc = openproc(PROC_FILLSTAT);
@AlmuHS
AlmuHS / getch.cpp
Last active November 8, 2022 15:52
getch() implementations for Windows and Linux, without conio.h or ncurses.h
#include <iostream>
#ifdef WIN32
#include <windows.h>
char getch(){
HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
DWORD mode = 0;
GetConsoleMode(hStdin, &mode);
@AlmuHS
AlmuHS / gist:baf236e4079bf9584852c1823e27cbfe
Last active November 8, 2019 00:17
Some english translation for spanish computing terms
proyecto = project
sistema operativo = operating system
aplicaciones = applications
usuario = user
controlador ~= driver (or controller)
direcciones = address
memoria = memory
planificador de procesos = scheduler
paralelizacion = parallelism
concurrente = concurrent
@AlmuHS
AlmuHS / lista_enlazada.cpp
Created June 4, 2019 00:18
Implementación de una lista enlazada sencilla en C++
#include <iostream>
using namespace std;
struct TNodo{
int datos;
TNodo* siguiente;
};
TNodo *inicial, *final;
@AlmuHS
AlmuHS / qemu_hurd.sh
Last active September 2, 2019 01:05
Debian GNU/Hurd Qemu script
#+BEGIN_SRC sh :results output :exports both
#!/bin/bash
#modprobe kvm
#modprobe kvm_intel
#qemu-img create -f qcow2 hurd.img 20G
MEMORY=2G
FILE=hurd_qemu/hurd.img
CDROM=Descargas/debian-hurd-2017-i386-DVD-1.iso
# If I ever need to add a cdrom
echo "running ssh"
@AlmuHS
AlmuHS / nxtlinux.md
Last active November 27, 2018 18:28
Como conectar el robot Lego Mindstorms NXT mediante bluetooth desde GNU/Linux

Conexión bluetooth del robot Lego Mindstorms NXT desde GNU/Linux

Con esta guía aprenderemos los pasos a seguir para establecer la conexión entre el ladrillo del Lego Mindstorms NXT y nuestro equipo GNU/Linux.

Requisitos:

  • Sistema operativo GNU/Linux
  • bluetoothctl
  • rfcomm

Proceso a seguir

  1. Abrir el intérprete de comandos
@AlmuHS
AlmuHS / Hurd_SMP.md
Last active September 20, 2018 15:46
New project: Fix SMP support in GNU/Hurd

Hurd_SMP project

Objective

The objective of this project is fix and complete SMP support (multiprocessing) in GNU/Hurd

Current situation:

GNU/Hurd includes a tiny SMP support, as this FAQ explain

But this support is very limited:

@AlmuHS
AlmuHS / Debian_Hurd_Install.md
Last active January 11, 2024 04:03
Debian GNU Hurd installation in real hardware

How to install Debian GNU/Hurd in a real PC

Debian GNU/Hurd installation guide to real hardware

Requirements

  • An old PC
  • DVD-R or CD-R
  • Recommended hardware
    • Wired Network Connection
  • CPU with high clock speed