Skip to content

Instantly share code, notes, and snippets.

View hypothermic's full-sized avatar

hypothermic hypothermic

View GitHub Profile
@hypothermic
hypothermic / hue2rgb.vhd
Created June 7, 2022 15:26
Hue value to RGB color in pure VHDL
-- Loosely based off https://stackoverflow.com/a/34663498
-- but implemented with fixed arithmatic
-- to fit the 12-bit value of a VGA color
signal color : std_logic_vector (12-1 downto 1-1);
color_proc : process (clk, clk_en) is
begin
if rising_edge(clk) then
if clk_en = '1' then
@hypothermic
hypothermic / vitis_hls_archlinux.md
Last active April 26, 2022 08:05
Using Xilinx Vitis Vision libraries on Arch Linux

How to get Vitis HLS Vision 2021.2 running on Arch Linux

This information will probably be outdated once you read it, because Arch is a rolling distro, which means that packages get updated almost immediately when they get released. Old software like Xilinx tools depend on specific versions of these libraries and they don't like newer versions. This means that you'll have to downgrade some packages to get Xilinx tools like Vitis HLS working on your Arch machine.

  1. Downgrade opencv to 4.4.0-3
  2. Downgrade tbb to 2020.3
  3. Downgrade openexr (they changed name November 2021 so the Xilinx tools still refer to it as libIlmImf) to 2.5.5-1
@hypothermic
hypothermic / valgrind-gdb-debugging.md
Created March 1, 2022 10:38
Example of valgrind + vgdb + gdb debugging to find uninitialized memory segments

Introduction

It took me two hours to find out that I hadn't properly initialized a dynamic array that was allocated on the stack. Valgrind is truly an awesome tool, and in conjuction with GDB it is really powerful. I will have probably forgotten how to use Valgrind in a week from now, so that's why I'm writing this quick summary on how I managed to debug the issue. I hope it's useful for future reference.

1. Running the program

Keybase proof

I hereby claim:

  • I am hypothermic on github.
  • I am hypothermic (https://keybase.io/hypothermic) on keybase.
  • I have a public key whose fingerprint is 2E23 7E9D 9ADB 1B88 505B 3488 B052 6642 ACBE 5FB0

To claim this, I am signing this object:

@hypothermic
hypothermic / autoexec.cfg
Last active November 9, 2021 00:17
CSGO autoexec.cfg - 400 dpi sens ===== LAUNCH SETTINGS: +exec autoexec.cfg -tickrate 128 -novid -high -threads 6 -w 1280 -h 960 -language Dutch -console -freq 74
sensitivity 2.4
m_yaw 0.0165
rate "786432"
fps_max "0"
cl_cmdrate "128"
cl_updaterate "128"
bind 4 "use weapon_c4"
bind q "use weapon_flashbang"
:: https://blog.prowling.nu/2012/09/modifying-kvm-qemu-kvm-settings-for.html
:: Updated for WinX by hypothermic
@reg copy HKLM\HARDWARE\ACPI\DSDT\BXPC HKLM\HARDWARE\ACPI\DSDT\WOOT /s /f
@reg delete HKLM\HARDWARE\ACPI\DSDT\BXPC /f
@reg copy HKLM\HARDWARE\ACPI\DSDT\WOOT\BXDSDT HKLM\HARDWARE\ACPI\DSDT\WOOT\WOOT /s /f
@reg delete HKLM\HARDWARE\ACPI\DSDT\WOOT\BXDSDT /f
@hypothermic
hypothermic / main.s
Created September 15, 2020 19:15
Tekkit Classic server prototype in 64bit asm for linux 2.7+
/**
* Tekkit Classic / Minecraft 1.3- server prototype
* in x86_64 assembly (nasm syntax) using linux syscalls.
* I've bundled this into a single file to make it easy to use.
* Only works on LE currently.
*
* hypothermic, 15-09-2020
*/
/*
* See included Makefile or compile using following commands:
@hypothermic
hypothermic / arch_server.md
Last active September 10, 2020 22:40
Arch server installation

Arch server installation

Archlinux is perfect for minimal servers because it does not come with bloatware programs like other OSes (ex. centos, rhel, deb, etc) do and therefore reduces the potential attack surface. One of the biggest benefits due to Arch's rolling release cycle is that you will get security updates within hours, instead of days to months if you're using ubuntu, centos, etc. However, it must be configured in a right manner and great care must be taken on every action.

Installation guide

  1. Boot into Live ISO and switch to root user (su) if not already using
  2. Create root and swap partitions on disk you want to use.
@hypothermic
hypothermic / everything_wrong_with_php.md
Last active November 12, 2019 18:50
Everything wrong with PHP

Everything wrong with PHP

  • In object-oriented programming, constructors aren't functions. But in PHP they are declared using function __construct. Weird.
  • No annotations/attributes! How are we supposed to provide metadata about class members?! (and no, phpdoc isn't an annotation, fuck off.)
  • Namespace separators are a backslash, which means they have to be escaped in JSON and other languages.
  • Why do constructors start with __? I've never used this key on my keyboard before.
  • No strict type enforcement / non-null types.
  • No casting to arrays, or specific types.
  • No typed variables within method signatures.
  • No mixed varargs.
@hypothermic
hypothermic / virtualbox-resize-fixed-vdi-disk.sh
Created September 6, 2019 09:25
Virtualbox resize fixed VDI disk
# copy hdd, the result will be a dynamic hdd.
VBoxManage clonehd ./osdisk.vdi ./osdisk-copy.vdi
# resize it (to 25GB in this case)
VBoxManage modifyhd ./osdisk-copy.vdi --resize 25000