Skip to content

Instantly share code, notes, and snippets.

#ifndef WIN32_NO_STATUS
# define WIN32_NO_STATUS
#endif
#include <windows.h>
#include <assert.h>
#include <stdio.h>
#include <winerror.h>
#include <winternl.h>
#include <stddef.h>
#include <winnt.h>
@taviso
taviso / ScaleWindow.c
Last active May 9, 2016 12:51
Apparently win32k is not Chuck Norris.
#ifndef WIN32_NO_STATUS
# define WIN32_NO_STATUS
#endif
#include <windows.h>
#include <assert.h>
#include <stdio.h>
#include <winerror.h>
#include <stddef.h>
#include <winnt.h>
#include <limits.h>
#ifndef WIN32_NO_STATUS
# define WIN32_NO_STATUS
#endif
#include <windows.h>
#include <assert.h>
#include <stdio.h>
#include <winerror.h>
#include <winternl.h>
#include <stddef.h>
#include <winnt.h>
@taviso
taviso / testcase.ps
Last active August 30, 2018 05:30
GhostScript Testcase
%!PS
% This is ghostscript bug #699687 (split out from bug #699654)
% ImageMagick define setpagedevice, just remove their definition. This doesn't
% do anything if not using ImageMagick.
userdict /setpagedevice undef
% function to check if we're on Linux or Windows
/iswindows {
% Just checking if paths contain drive
@taviso
taviso / fbmon.c
Last active July 22, 2019 06:54
fbmon bug
#include <stdio.h>
#include <stdint.h>
#include <string.h>
/*
$ gcc fbmon.c
$ ./a.out
*** stack smashing detected ***: <unknown> terminated
Aborted (core dumped)
@taviso
taviso / getopt.sh
Last active December 17, 2019 02:42
Using ctypes.sh to parse options
#!/bin/bash
#
# $ bash test.sh --my_opt=foo --my_opt bar
# option_index was int:0
# foo
# option_index was int:0
# bar
if ! source ctypes.sh; then
echo please install ctypes.sh
@taviso
taviso / newpid.c
Created April 14, 2015 13:35
Apport/Abrt Vulnerability Demo Exploit.
#define _GNU_SOURCE
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <signal.h>
#include <elf.h>
#include <err.h>
#include <syslog.h>
#include <sched.h>
@taviso
taviso / rebinder.c
Created November 12, 2013 16:34
Simple rebinding nameserver.
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <netdb.h>
#include <time.h>
@taviso
taviso / .Xresources
Last active February 1, 2021 10:43
Enable Xft support in XTerm Menus
! Set the default XTerm UI font (menus, toolbar, etc)
XTerm*XftFont: Courier:size=10:antialias=true:style=Regular
! All my resources are available here (I disable the Xaw3D effect, I think it looks a bit dated!)
! https://gist.github.com/taviso/a4543b1752fba55017e8fcc2fe052c0a
! It looks like this: https://imgur.com/a/m2PGuuz
!
@taviso
taviso / DefText.c
Created November 8, 2017 17:16
NtUserDefSetText() in Windows 10 will panic if you set the ansi flag incorrectly.
#include <windows.h>
#include <winternl.h>
#include <stdio.h>
#pragma comment(lib, "user32")
#pragma comment(lib, "gdi32")
typedef struct _LARGE_STRING {
ULONG Length;
ULONG MaximumLength:31;