Skip to content

Instantly share code, notes, and snippets.

@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 / msdn.sh
Created July 12, 2019 22:30
Read MSDN pages in a terminal.
# man equivalent for msdn pages so I can look them up in the console.
function msdn()
{
local lucky="https://www.google.com/search?btnI"
local query="q=site:docs.microsoft.com+inurl:/en-us/windows/desktop/"
local title="Microsoft Developer Network"
local cache="${HOME}/.msdn/"
if ! type lynx > /dev/null; then
echo "error: lynx is not installed, please install it." 1>&2
@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 / emoji.sh
Created August 29, 2019 18:14
UNIX signals as emoji
declare -ar _status=(
[ 0]=😀 # Success
[ 1]=🤨 # Error
[129]=📞 # SIGHUP
[130]=🛑 # SIGINT
[131]="(╯°□°)╯︵ ┻━┻" # SIGQUIT
[132]=👮 # SIGILL
[133]=🐍 # SIGTRAP
[134]=💥 # SIGABRT
@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 / fwpacl.c
Created May 14, 2020 00:37
Attempt to reset a FWP Engine Security Descriptor.
#include <stdio.h>
#include <windows.h>
#include <fwpmu.h>
#include <sddl.h>
#include <malloc.h>
//
// Attempt to reset a FWP Engine Security Descriptor.
// For https://github.com/henrypp/simplewall/issues/680
@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 / .Xresources
Last active April 4, 2024 10:13
XTerm Configuration
! XTerm resources
!
! Remember to run `xrdb < .Xresources` after changing anything.
!
! Tavis Ormandy <taviso@gmail.com>
! Set the default UI font (menus, toolbar, etc)
XTerm*XftFont: Segoe UI:size=10:antialias=true:style=Regular
! Color of UI Components
@taviso
taviso / recycle.c
Last active July 29, 2022 01:56
recycle PID
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <errno.h>
#include <stdbool.h>
#include <stdlib.h>
#include <err.h>
#include <sys/types.h>
#include <sys/wait.h>