Skip to content

Instantly share code, notes, and snippets.

@taviso
taviso / .Xresources
Last active Jan 1, 2021
XTerm Configuration
View .Xresources
! 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 / .Xresources
Last active Feb 1, 2021
Enable Xft support in XTerm Menus
View .Xresources
! 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 / fwpacl.c
Created May 14, 2020
Attempt to reset a FWP Engine Security Descriptor.
View fwpacl.c
#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 / getopt.sh
Last active Dec 17, 2019
Using ctypes.sh to parse options
View getopt.sh
#!/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 / emoji.sh
Created Aug 29, 2019
UNIX signals as emoji
View emoji.sh
declare -ar _status=(
[ 0]=😀 # Success
[ 1]=🤨 # Error
[129]=📞 # SIGHUP
[130]=🛑 # SIGINT
[131]="(╯°□°)╯︵ ┻━┻" # SIGQUIT
[132]=👮 # SIGILL
[133]=🐍 # SIGTRAP
[134]=💥 # SIGABRT
@taviso
taviso / fbmon.c
Last active Jul 22, 2019
fbmon bug
View fbmon.c
#include <stdio.h>
#include <stdint.h>
#include <string.h>
/*
$ gcc fbmon.c
$ ./a.out
*** stack smashing detected ***: <unknown> terminated
Aborted (core dumped)
@taviso
taviso / msdn.sh
Created Jul 12, 2019
Read MSDN pages in a terminal.
View msdn.sh
# 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 / testcase.ps
Last active Aug 30, 2018
GhostScript Testcase
View testcase.ps
%!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 / DefText.c
Created Nov 8, 2017
NtUserDefSetText() in Windows 10 will panic if you set the ansi flag incorrectly.
View DefText.c
#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;
@taviso
taviso / delete-twitter-dm.js
Created Nov 3, 2017
Automate deleting twitter direct messages.
View delete-twitter-dm.js
// Open direct messages window, paste this into console.
function deleteNextConversation()
{
if (!(dm = document.getElementsByClassName("DMInbox-conversationItem")[0])) {
clearInterval(tmr)
return;
}
dm.firstChild.click();
setTimeout('document.getElementsByClassName("js-actionDeleteConversation")[0].click()', 1000);