Skip to content

Instantly share code, notes, and snippets.

John Tsiombikas jtsiomb

Block or report user

Report or block jtsiomb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jtsiomb
jtsiomb / xsection.c
Last active May 12, 2019
Example of rendering cross-sections of closed geometry with OpenGL
View xsection.c
/* Example of rendering cross-sections of closed non-self-intersecting geometry
* with the stencil buffer. See draw_cross_section for details.
*
* Controls:
* - rotate object by dragging with the left mouse button
* - move cross-section plane back and forth by dragging up/down with the right
* mouse button
*
* Compile with: cc -o xsection xsection.c -lGL -lGLU -lglut
*
@jtsiomb
jtsiomb / mbox_attachments.c
Last active Feb 10, 2019
Scans a mailbox (mbox format) and extracts all attachments with the help of munpack
View mbox_attachments.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include <alloca.h>
#include <unistd.h>
#include <fcntl.h>
#include <dirent.h>
#include <sys/wait.h>
@jtsiomb
jtsiomb / fixname.sh
Created Jan 15, 2019
Shell script to fix filenames to abide by my arbitrary "clean filename" rules
View fixname.sh
#!/bin/sh
# ___________________________________________________
# / \_
# | fixname - cleans up filenames | \
# | | |
# | author: John Tsiombikas <nuclear@member.fsf.org> | |
# | license: public domain | |
# \___________________________________________________/ |
# \___________________________________________________/
#
@jtsiomb
jtsiomb / capsctrl.asm
Last active Sep 8, 2018
DOS TSR for remapping caps lock to control (see comment at the end for pre-built binaries)
View capsctrl.asm
; DOS caps lock -> ctrl remapper
; Author: John Tsiombikas <nuclear@member.fsf.org>
; This program is public domain. Do whatever you like with it
; build with: nasm -o capsctrl.com -f bin capsctrl.asm
org 100h
bits 16
mov ax, 0900h
mov dx, msg
int 21h
@jtsiomb
jtsiomb / glclip_example.c
Created Aug 18, 2018
OpenGL user clip planes example fixed function & shaders (discard)
View glclip_example.c
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <math.h>
#include <assert.h>
#include <alloca.h>
#include <GL/glew.h>
#ifdef __APPLE__
#include <GLUT/glut.h>
#else
@jtsiomb
jtsiomb / rinplace.c
Created Mar 24, 2018
In-place search & replace efficiently even in huge files (UNIX)
View rinplace.c
/*! cc -o rinplace -pedantic -Wall -g rinplace.c */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
struct snode {
@jtsiomb
jtsiomb / 1 - unistate.h
Last active Nov 19, 2017
OpenGL global uniform state tracking
View 1 - unistate.h
#ifndef UNISTATE_H_
#define UNISTATE_H_
#include "vmath/vmath.h"
class ShaderProg;
enum StType {
ST_UNKNOWN,
ST_INT, ST_INT2, ST_INT3, ST_INT4,
You can’t perform that action at this time.