Skip to content

Instantly share code, notes, and snippets.

@Ilgrim
Ilgrim / basic-freebsd-bridge.sh
Created June 4, 2022 02:55 — forked from rubenerd/basic-freebsd-bridge.sh
Basic HP MicroServer FreeBSD bridge with 4-port NIC
######
## Basic FreeBSD bridge for HP MicroServer and 4-port PCI-E NIC
## Details from dmesg:
## - <HP Ethernet 1Gb 2-port 332i Adapter, ASIC rev. 0x5720000>
## - <Intel(R) PRO/1000 Network Connection 7.6.1-k>
set -e
cat >> /boot/loader.conf <EOF
## Add network bridge support
@Ilgrim
Ilgrim / app.py
Created May 29, 2022 23:25 — forked from blakebjorn/app.py
Example communication between flask application and python worker using zeroMQ
import zmq
from flask import Flask
from threading import Thread
HOST = '127.0.0.1'
PORT = 9090
TASK_SOCKET = zmq.Context().socket(zmq.REQ)
TASK_SOCKET.connect('tcp://{}:{}'.format(HOST, PORT))
app = Flask("app")
@Ilgrim
Ilgrim / samba-ad-dc-howto.md
Created May 11, 2022 20:10 — forked from oneohthree/samba-ad-dc-howto.md
samba-ad-dc-howto.md

Instalación de Samba como Active Directory Domain Controller (AD DC)

Consideraciones previas

  • Sistema operativo: Debian GNU/Linux 9 (Stretch)
  • Nombre de host: dc
  • Nombre de dominio: foo.bar
  • Dirección IP: 192.168.0.1

Configuración de nombres de hosts

@Ilgrim
Ilgrim / ARMDebianUbuntu.md
Created May 10, 2022 07:56 — forked from Liryna/ARMDebianUbuntu.md
Emulating ARM on Debian/Ubuntu

You might want to read this to get an introduction to armel vs armhf.

If the below is too much, you can try Ubuntu-ARMv7-Qemu but note it contains non-free blobs.

Running ARM programs under linux (without starting QEMU VM!)

First, cross-compile user programs with GCC-ARM toolchain. Then install qemu-arm-static so that you can run ARM executables directly on linux

@Ilgrim
Ilgrim / port_manipulation.cpp
Created May 5, 2022 14:36 — forked from nadavmatalon/port_manipulation.cpp
Arduino: Port Manipulation
// DDRD (R/W) pin direction (0 = INPUT / 1 = OUTPUT)
// PORTD (R/W) pin state (INPUT: 0 = LOW / 1 = HIGH | OUTPUT: 0 = PULL-UP DIACTIVATED / 1 = PULL-UP ACTIVATED)
// PIND (R) pin state (INPUT ONLY: 0 = LOW / 1 = HIGH)
// bit(n) // calculates value of n-th bit (returns: 0 / 1)
// bitRead(byteName, n) // gets value of n-th bit of byte (returns: 0 / 1)
// bitSet(byteName, n) // sets value of n-th bit of byte to 1
// bitClear(byteName, n) // sets value of n-th bit of byte to 0
// bitWrite(byteName, n, val) // sets value of n-th bit of byte to 0 or 1

SDCC - Interfacing with Z80 assembler code

The basics

When writing code to be compiled with SDCC targetting Z80, assembler code fragments can be inserted in the C functions by enclosing them between the __asm and __endasm; tags:

void DoNotDisturb()
{
  __asm

di

@Ilgrim
Ilgrim / ft2232_to_digilent_jtag.md
Created March 6, 2022 18:33 — forked from rikka0w0/ft2232_to_digilent_jtag.md
FT2232 to Digilent JTag for Xilinx FPGAs (ISE/Vivado)

The Digilent JTag uses FT2232, but its configuration EEPROM contains secrete data needed to be recoginzed by Xilinx ISE/Vivado. The following method only works on linux (tested on Ubuntu16.04), but the patched FT2232 doggle also works on Windows. Since WSL1 does not provide USB device access, the following method will not work for WSL1.

DONT use FT_Prog on offical Digilent cable, as it can trash the firmware! The offical eeprom contains secrete data that cannot be handled correctly by FT_Prog.

Here are steps to create a Digilent-like Jtag that can be used in Xilinx ISE and Vivado

  1. Install softwares: sudo apt-get install libftdi1 ftdi-eeprom
  2. Create a file "flash_digilent.conf" with the following content:
@Ilgrim
Ilgrim / Arduino Assembler - Makefile
Last active May 9, 2022 11:21 — forked from mhitza/Makefile
Programming Arduino Uno (ATmega386P) in assembly
%.hex: %.asm
avra -fI $<
rm *.eep.hex *.obj *.cof
all: $(patsubst %.asm,%.hex,$(wildcard *.asm))
upload: ${program}.hex
avrdude -c arduino -p m328p -P /dev/arduino-uno -b 115200 -U flash:w:$<
monitor:
@Ilgrim
Ilgrim / RPIwithQEMU.md
Created December 14, 2021 19:51 — forked from plembo/RPIwithQEMU.md
Emulating a Raspberry Pi with QEMU

Emulating a Raspberry Pi with QEMU

Goal: Emulate a Raspberry Pi with QEMU in order to run the Raspbian O/S (based on Debian Linux).

The current setup is not ideal. For one thing, the maximum RAM allowed using the "versatile-pb" firmware is 256 Mb. In addition, only the most basic peripherals, a keyboard and mouse, are supported.

A number of articles have been written on this topic. Most are outdated, and the few recent ones are missing key information.

@Ilgrim
Ilgrim / socket_chat.py
Created August 29, 2021 20:41 — forked from owainlewis/socket_chat.py
Python socket based chat server
#!/usr/bin/python3
import socket, sys, threading
# Simple chat client that allows multiple connections via threads
PORT = 9876 # the port number to run our server on
__version__ = "0.0.1"
class ChatServer(threading.Thread):