Skip to content

Instantly share code, notes, and snippets.

View gammy's full-sized avatar

gammy gammy

  • Stockholm
View GitHub Profile
@gammy
gammy / gist:02362302cd9e099c7feb
Created December 29, 2015 13:43
Xrandr configuration
xrandr --output DP-0.8 --mode 2560x1440 --pos 1080x368 --rotate normal --output DVI-D-0 --mode 1920x1080 --pos 3640x0 --rotate left --output HDMI-0 --mode 1920x1080 --pos 0x0 --rotate left --output DVI-I-1 --off --output DVI-I-0 --off --output DP-1 --off --output DP-0 --off
shadow = true;
no-dnd-shadow = true;
no-dock-shadow = true;
clear-shadow = true;
shadow-radius = 7;
shadow-offset-x = -7;
shadow-offset-y = -7;
shadow-opacity = 0.7;
shadow-red = 0.0;
shadow-green = 0.0;
@gammy
gammy / .vimrc
Last active December 4, 2015 14:35
My vim/gvim configuration file. Requires the moria theme for gvim.
" Gammies vimrc. This will work for both vim and gvim.
" Use Vim settings, rather then Vi settings
" This must be first, because it changes other options as a side effect.
set nocompatible
set nomodeline " Disable trying to read modelines in files
" (best to keep it off if you're unaware of it anyway)
if has("autocmd")
" When editing a file, always jump to the last known cursor position.
gammy@hypatia:~/code/ipec/admain$ git blame ad_pcie.h | grep BY_PORT
62eb51b2 (Kristian Gunstone 2015-10-23 13:39:09 +0200 25) #define TEST_TRIP_BY_PORT(state, port) ((state & (1 << port)) >> port)
gammy@hypatia:~/code/ipec/admain$ git diff 62eb51b2 | grep BY_PORT
-#define TEST_TRIP_BY_PORT(state, port) ((state & (1 << port)) >> port)
- status = TEST_TRIP_BY_PORT(trip_state, test_port);
- status = TEST_TRIP_BY_PORT(trip_state, test_port);
* Also see the AD_TEST_TRIP_BY_PORT helper macro in ad.h.
-#define TEST_TRIP_BY_PORT(state, port) ((state & (1 << port)) >> port)
- status_a = TEST_TRIP_BY_PORT(trip_state, 0);
@gammy
gammy / ne2000_28_10_15.diff
Created October 27, 2015 23:27
An updated patch for NE2000 emulation in dosbox. More to follow.
diff --git a/configure.ac b/configure.ac
index dc2aa0f..a8c552e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -372,6 +372,16 @@ else
AC_MSG_WARN([Can't find libpng, screenshot support disabled])
fi
+AH_TEMPLATE(C_NE2000,[Define to 1 to enable NE2000 ethernet passthrough, requires libpcap])
+AC_CHECK_HEADER(pcap.h,have_pcap_h=yes,)
g++ -DHAVE_CONFIG_H -I. -I../.. -I../../include -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -g -O2 -mno-ms-bitfields -MT ne2000.o -MD -MP -MF .deps/ne2000.Tpo -c -o ne2000.o ne2000.cpp
In file included from ne2000.cpp:49:0:
../../include/ne2000.h:450:3: error: conflicting declaration ‘typedef struct bx_ne2k_t bx_ne2k_t’
} bx_ne2k_t;
^
../../include/ne2000.h:199:3: note: previous declaration as ‘typedef struct bx_ne2k_t bx_ne2k_t’
} bx_ne2k_t;
^
../../include/ne2000.h:454:7: error: redefinition of ‘class bx_ne2k_c’
class bx_ne2k_c {
@gammy
gammy / temprpm.bash
Created October 23, 2015 09:10
Display RPM and temperature on my machine
#!/usr/bin/env bash
sensors \
| grep -e fan -e temp -e Core -e Physical \
| grep -v -e '0 RPM ('
disks=$(lsblk --list --output NAME,TYPE \
| grep disk \
| cut -d ' ' -f 1 \
| sed -s 's#\(.*\)#/dev/\1#')
@gammy
gammy / fdemutool.bash
Last active December 26, 2022 00:52
Mount/Read/Write Floppy Emulation USB sticks
#!/usr/bin/env bash
# This is a tool to assist in the usage of floppy disk hardware emulators:
# https://en.wikipedia.org/wiki/Floppy_disk_hardware_emulator
#
# Several of these devices (presumably cheaper ones) don't store
# floppy drives as files on an existing file system, but rather just
# store the raw data with a 96K offset. It renders the USB-stick
# useless for any other purposes.
#
# It also means that you need customized software to access the virtual
@gammy
gammy / wc2_build.bash
Created September 15, 2015 19:57
Generate a Warcraft II mixed-mode CD from mp3 and data files
#!/usr/bin/env bash
# Gammies attempt to reconstruct the original
# Warcraft II - Tides Of Darkness DOS/WIN95 CD.
#
# The copy I obtained from myabandonware.com had
# been incorrectly ripped, with the audio tracks being
# garbage (verified by converting the bin to wav).
#
# What you need:
# - The original game files
for (uint32_t i = 0; i < byte_count; i += 2)
{
uint8_t offset = i / 2;
unsigned char data_lo = rawdata[i + 1];
unsigned char data_hi = rawdata[i];
interimvalue[offset] = (1 << 0 ) * ((data_hi >> 0) & 0x1) +
(1 << 1 ) * ((data_hi >> 1) & 0x1) +
(1 << 2 ) * ((data_hi >> 2) & 0x1) +
(1 << 3 ) * ((data_hi >> 3) & 0x1) +