Skip to content

Instantly share code, notes, and snippets.

View llandsmeer's full-sized avatar
💡

Lennart Landsmeer llandsmeer

💡
View GitHub Profile
@llandsmeer
llandsmeer / libtccdemo.c
Created March 9, 2020 20:38
LibTCC demo - usage example for live c code compilation & execution
#include <stdio.h>
#include <stdlib.h>
#include <libtcc.h>
void callme(int x) {
printf("hello, %d\n", x);
}
void error_func(void * user, const char * msg) {
printf("TCC Error: %s\n", msg);
@llandsmeer
llandsmeer / tracexecv2.c
Created March 9, 2020 19:51
Execute syscall in other process
#include <assert.h>
#include <errno.h>
#include <signal.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/ptrace.h>
@llandsmeer
llandsmeer / b.c
Created February 16, 2020 23:26
Execute instructions inside ptrace tracee... might be one of the ugliest hacks I made to date..
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <wait.h>
#include <assert.h>
#include <errno.h>
#include <sys/signal.h>
#include <sys/types.h>
#include <sys/ptrace.h>
@llandsmeer
llandsmeer / lineprof.py
Created November 5, 2018 04:15
Simple ugly single file line by line real time python profiler
#!/usr/bin/env python3
import threading
import re
import signal
import os
import curses
import keyword
import sys
import time
import ast
@llandsmeer
llandsmeer / qt5_opengl.py
Last active October 4, 2018 22:55
Minimal PyQt5 + PyOpenGL Widget (with debug logging and ctrl-c exit)
import sys, ctypes, signal
from OpenGL import GL, GLU
from PyQt5 import QtCore, QtGui, QtWidgets
position_data = (ctypes.c_float*12)(
-1,-1, 1,-1, -1,1, 1,-1, 1,1, -1,1)
vertex_shader = (GL.GL_VERTEX_SHADER, '''
#version 150