Monday, January 27, 2014

Truth Tables

I made a truth table generator.  There are many of these, but as usual, none met my standards for working exactly how I wanted them to.

You can change what operators are used to represent AND, OR, and NOT, and you can use short hand of writing variables together for AND or OR.  It also shows what actual logical comparison it makes in javascript so you know if what you are writing is being interpreted correctly.  I wanted to make the columns in the table color code to show which functions were equivalent, but that was annoying; so it just displays decimal values at the end for you to manually compare.

Tuesday, January 21, 2014

Snapping windows to half screen in Fluxbox

I've recently begun using Windows 7 more heavily, and one feature I do miss when on Linux, despite initially scoffing at it, is the ability to snap a window to half the screen.  I figured this wouldn't be too hard to replicate, and it turns out I was right.  There is a program called wmctrl which should be usable with any windows manager, but Fluxbox had some built in commands I used.

I stole a very good idea from this thread about using the numpad to move windows to either the left/right, top/bottom, or the four corners of the screen.

Here is what I added to my ~/.fluxbox/keys file:
#1920 / 2 = 960
#1080 / 2 = 540
Control KP_0 :Minimize
Control KP_1 :MacroCmd {ResizeTo 958  540} {MoveTo 00 00 LowerLeft}   
Control KP_2 :MacroCmd {ResizeTo 1920 540} {MoveTo 00 00 LowerLeft}   
Control KP_3 :MacroCmd {ResizeTo 958  540} {MoveTo 00 00 LowerRight}   
Control KP_4 :MacroCmd {ResizeTo 958 1060} {MoveTo 00 00 UpperLeft}   
Control KP_5 :Maximize
Control KP_6 :MacroCmd {ResizeTo 958 1060} {MoveTo 00 00 UpperRight}   
Control KP_7 :MacroCmd {ResizeTo 958  540} {MoveTo 00 00 UpperLeft}   
Control KP_8 :MacroCmd {ResizeTo 1920 540} {MoveTo 00 00 UpperLeft}   
Control KP_9 :MacroCmd {ResizeTo 958  540} {MoveTo 00 00 UpperRight}  

Note the subtraction of 2 pixels from the left/right measurements to account for window borders.  Also, note the subtraction of 20 pixels from the full height measurement to account for my taskbar.  Finally, note that the title bar will be overlapped when stacked vertically.

Here is a sample after using Ctrl+7, Ctrl+1, Ctrl+6:

Friday, January 17, 2014

Wednesday, January 1, 2014

The Best of The Onion

A reddit thread asked for favorite headlines, and someone at The Onion coded up a page for the highest voted ones.