Skip to content

Instantly share code, notes, and snippets.

View wyatt8740's full-sized avatar
💭
I get better every day, I hope. Energetic.

Wyatt Ward wyatt8740

💭
I get better every day, I hope. Energetic.
View GitHub Profile
@wyatt8740
wyatt8740 / sdljoytest.cpp
Created February 21, 2014 16:34
SDL Joystick Button ID finder
/* SDLJOYTEST
Prints the ID numbers of SDL input devices when activated.
EXAMPLE: if you are trying to find the SDL button ID of the 'A' button on
an imaginary gamepad or joystick, run this program and then press
the 'A' button on your joystick. As long as it is working properly,
the program will print the IDs of whatever buttons are being held down,
allowing you to enter that ID into a config file for inputs.
So say the 'A' button prints an ID of '5'. That means that the ID
5 is what you should enter for the config file.
@wyatt8740
wyatt8740 / glkterm-colors.diff
Created October 23, 2014 16:51
Add color support to glkterm, and adds some POSIX definitions for windows platforms (to make it compatible with pdcurses)
diff -r glkterm-orig/glkterm.h glkterm/glkterm.h
185a186,187
> extern int pref_fgcolor;
> extern int pref_bgcolor;
diff -r glkterm-orig/gtwindow.c glkterm/gtwindow.c
25a26,34
> #ifdef WIN32
> #define SIGCONT 18 /* Continue - POSIX implementation */
> #define SIGSTOP 19 /* Stop - POSIX implementation). */
> #define SIGTSTP 20 /* Keyboard stop - POSIX implementation. */
@wyatt8740
wyatt8740 / windowsconsolechangesize
Created November 6, 2014 05:19
Pieced together example of changing the console size in C. Compiles with mingw GCC.
/* Pieced together from tutorials and source files found online. None I used carried license information. */
/* This allows you to set your command prompt's display size. */
#include <windows.h>
#include <stdio.h>
void setConSize(int xsize,int ysize) {
WORD wConBufSize;
COORD coord;
coord.X=xsize;
coord.Y=ysize;
SMALL_RECT Rect;
diff -x '*.html' -x '*.png' -a -r -u a/gtk+-3.22.7/gtk/gtkfilechooserwidget.c b/gtk+-3.22.7/gtk/gtkfilechooserwidget.c
--- a/gtk+-3.22.7/gtk/gtkfilechooserwidget.c 2016-12-30 09:55:56.000000000 -0500
+++ b/gtk+-3.22.7/gtk/gtkfilechooserwidget.c 2017-01-25 19:38:43.000000000 -0500
@@ -2420,7 +2420,10 @@
gdk_device_get_source (device) == GDK_SOURCE_TOUCHSCREEN;
get_selection_modifiers (widget, event, &modify, &extend);
- if (!is_touchscreen &&
+ /* Ubuntu, disable the new behaviour of opening sometime on single click
+ it's confusing for users and the change had no rational
@wyatt8740
wyatt8740 / sortdate.sh
Last active March 23, 2017 20:57
Change date modified on files so they can be sorted by date and remain in alphabetical order. Useful for some terrible photo apps on Android and a couple desktop linux programs as well. Requires either `ksh` (korn shell) or the mirBSD korn shell clone, which Android uses.
#! /usr/bin/ksh
# hack to sort photos by name in programs that stupidly use dates.
# I believe this will handle up to 86400 files in a directory.
# (60*60*24)
# after that, you get exciting undefined behavior because I don't increment
# day, month, or year.
#export ITERSEC=1
#export ITERSEC=59
#export ITERMIN=59
#export ITERHOUR=23
@wyatt8740
wyatt8740 / fizzbuzz.c
Created March 6, 2017 01:44
FizzBuzz in C. This can be simplified (i % 15), but I did not think to do it that way when writing it myself.
#include <stdio.h>
int isdivisible(int i){ /* return 0 if number is divisible by 3 or 5 */
if( ((i % 3) == 0) || ((i % 5) == 0) ){
return 0;
}
else {
return -1;
}
}
int main(int argc, char *argv[]){
@wyatt8740
wyatt8740 / fix-bdf.c
Created March 14, 2017 13:47
fix BDF offset
#include <stdio.h>
#include <stdlib.h>
/*
* I made this because gbdfed didn't properly convert a windows font to a console bitmap font.
* This subtracts 5 from the "ENCODING" field of a BDF font file for each instance of it.
* Good luck reading it. You'll need it, I think. I can barely read it looking back, but it
* made a lot of sense when I first wrote it.
* Kids, don't write code like this at work!
*/
@wyatt8740
wyatt8740 / userChrome.css
Last active March 22, 2017 20:45
A really shoddy userChrome.css that fixes various bugs that have surfaced in the Firefox 3 Seamonkey theme in recent months. Dunno why I'm not just patching the theme itself honestly. Lots of redundancy here too. Has tiny embedded images in base64.
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */
/*
* https URL bar colour
*/
#urlbar[level] .autocomplete-textbox-container >* {background-color: #FFFFFF !important; color: #000000 !important; }
toolbar, menubar { /* THIS IS THE OVERRIDE I NEEDED ALL ALONG!!!! */
-moz-appearance: none !important;
@wyatt8740
wyatt8740 / update-gtk3.sh
Created April 2, 2017 21:42
Downloads latest debian GTK3 source, patches to fix annoyances, and compiles.
#! /bin/bash
# for this to work correctly, make an empty directory and put this shellscript inside it, along with the patch 'gtk3_make_filechooser_not_suck.patch'.
# Running this in a directory with a previous gtk source tree or any other files or directories may make this script behave unexpectedly!
# the patch file is found at:
# https://gist.github.com/wyatt8740/ae82550264564e2bba49b58d3e07f0f5.
# raw patch file (direct link):
# https://gist.github.com/wyatt8740/ae82550264564e2bba49b58d3e07f0f5/raw/bc5bc32d15e852ba92a8b0b710e01960c371ba8b/gtk3_make_filechooser_not_suck.patch
@wyatt8740
wyatt8740 / buttonsoverlay.xul
Last active April 15, 2017 20:24
Some useful togglers for https://addons.mozilla.org/en-US/firefox/addon/custom-buttons/ . Quick toggles to change the default character set to SHIFT-JIS where undefined, to make new tabs open in the background, and to enable/disable an add-on (in this case, "Inline Disposition"). In Custom Buttons' internal XUL format for easy restoration.
<overlay id="custombuttons-profile-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- Firefox -->
<toolbarpalette id="BrowserToolbarPalette"><toolbarbutton id="custombuttons-button1" label="New Tabs in Foreground" tooltiptext="New Tabs in Foreground" class="toolbarbutton-1 chromeclass-toolbar-additional" context="custombuttons-contextpopup" image="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAABSklEQVQ4y8WSPU7EQAyFP9sTJH4Ogihp4QZ00AE9uQsXWK5AR4OoQRRwATqOsYIkY1PMJNnVAg0FlqKxx/bz85vAH01GZ7G4ie8K2vZKfsvJ2Lx/fMTnxwcRpVZEEDPeX165vDhHpM4KQIKd3T3atiVNVFTx0jnVac0NQ4+IAkEgJVktjfTeHp9+3LPrhw0GXdcVAICzs1P6of9BJCHnvHG/XC5ngIfnF8KdNaVijensV8eaNAMcHJ6gMdCYkAwak/oxxUnBDEzBBFTg+f6uAHQ5UHfcIQe4C9khu5IcsheA5GAqmMJ2IzODIQfqVeEMRNRfJJg9Sn58ifEVAAanAhTZYlp3bm8mGCFFmTMB5By4r6okM4sIiNocAqnAD7Gyggfg48R1tQMBqSOjxga9rzCwLYNsiIAoiNVTQQ00zb7VONkKwO11y7/ZFzqqlEEaW1NCAAAAAElFTkSuQmCC" cb-oncommand="/*CODE*/&#xA;var prefManager = Components.classes[&quot