Skip to content

Instantly share code, notes, and snippets.

View stv0g's full-sized avatar
🎅
working

Steffen Vogel stv0g

🎅
working
View GitHub Profile
@stv0g
stv0g / sext.c
Created February 6, 2014 10:14
Sign extension
/** @brief Sign extending a integer */
size_t sign_extend(ssize_t addr, int bits)
{
return (addr << -bits) >> -bits; // sign bit is maintained during arithmetic right shift
}
@stv0g
stv0g / jump_to_user_code.c
Last active December 31, 2015 18:09
x86-64 compatible call to user code
/** @brief Jump back to user code
*
* This function runs the user code after stopping it just as if
* it was a return from a procedure.
*
* @return 0 in any case
*/
static inline int jump_to_user_code(size_t ep, size_t stack)
{
#ifdef CONFIG_X86_64
@stv0g
stv0g / EDA_abbreviations.txt
Last active March 14, 2016 19:06
Electronic Design Automation / Embedded System Abbreviations
(GP)GPU (General-purpose) Graphic Processing Unit
AHB Advanced High-performance Bus
ALAP As Late As Possible
AMAT Average Memory Access Time
AMBA Advanced Microcontroller Bus Architecture
APB Advanced Peripherial Bus
APU Application Processing Unit
ARM {Acorns,Advanced} RISC Machines
ASAP As Soon AS Possible
ASIC Application Specific Integrated Circuit
@stv0g
stv0g / bash_fd_poc.c
Last active March 14, 2016 19:07
Using additional file descriptors for input/output
/**
* Compile: gcc fd.c -o fd_copy
* Usage: fd_copy 3< input_file 4> output_file
* Result: Copies contents of input_file to output_file
*/
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
@stv0g
stv0g / nasm_quickref.txt
Last active March 14, 2016 19:08
NASM quick reference
; NASM quick reference
;; Format der Instruktionen NASM
label: opcode dest, src
; vgl GNU Assembler
label: opcode src, dest
;; NASM Pseudoinstruktionen
@stv0g
stv0g / Boards.txt
Last active March 22, 2016 07:37
DIY Hacker FPGA Link collection
https://joelw.id.au/FPGA/CheapFPGADevelopmentBoards

Keybase proof

I hereby claim:

  • I am stv0g on github.
  • I am stv0g (https://keybase.io/stv0g) on keybase.
  • I have a public key ASB_Rx0hyS2Pj9_BFWN5TZHhQ3VvgUAUDKsVjfyfgDcplwo

To claim this, I am signing this object:

@stv0g
stv0g / .block
Last active July 31, 2017 08:10 — forked from mbostock/.block
Force-Directed Graph
license: gpl-3.0
height: 600
@stv0g
stv0g / README.md
Last active August 1, 2017 00:25
Check if a new backup should be triggered

This script can be added to your bash startup script in order to remind you to do weekly / daily backups.

@stv0g
stv0g / docker-netns.sh
Created January 24, 2020 15:34
docker-netns.sh
#!/bin/bash
# Install jq!!!
#
#
command -v jq >/dev/null 2>&1 || echo >&2 'Please install "jq": apt-get install jq'
NETNS="blue"
# Create docker networks if they not exist yet