Skip to content

Instantly share code, notes, and snippets.

View kode54's full-sized avatar

Christopher Snowhill kode54

View GitHub Profile
@kode54
kode54 / clock_scan.tcl
Last active December 25, 2015 22:18
This is a wrapper around clock scan for Tcl older than 8.6, which lacks the -format argument to manually specify a timestamp format. This will remove any timezone offset, which clock scan will choke on, and turns it into a relative time offset to apply to the remaining timestamp.
proc urllog:clock_scan {datestring} {
set regpat {([-+]{1}[0-9]{1,4})}
set offset_string "0 seconds"
if {[regexp $regpat $datestring -> offset]} {
regsub $regpat $datestring {} datestring
set offset_hours 0
set offset_minutes 0
set offset_length [string length $offset]
scan $offset %d offset
set offset_sign [expr { ($offset > 0) ? "ago" : "" }]
@kode54
kode54 / ciso-portability.patch
Created November 18, 2013 00:59
This patch fixes several portability issues and most or all of the warnings in the CISO Compressed ISO9660 tool, version 1.01.
diff -ur ciso-1.0.0/ciso.c ciso-1.0.2/ciso.c
--- ciso-1.0.0/ciso.c 2006-11-03 12:53:29.000000000 -0800
+++ ciso-1.0.2/ciso.c 2013-11-17 16:07:47.000000000 -0800
@@ -22,6 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <zlib.h> /* /usr(/local)/include/zlib.h */
#include <zconf.h>
@kode54
kode54 / higan_v094_osx.patch
Created January 21, 2014 03:53
Patch against higan v094 which does the following: 1) Adds the executable base path to the dlopen search path, to facilitate loading libananke.dylib from the app bundle. 2) Imports endian.h from the correct path. 3) Fixes noinline macro clash with Cocoa/Carbon headers. 4) Updates Ruby Carbon input implementation poll() function and removes an ex…
diff -urN higan_v094-source/nall/dl.hpp higan/nall/dl.hpp
--- higan_v094-source/nall/dl.hpp 2014-01-20 17:30:18.000000000 -0800
+++ higan/nall/dl.hpp 2014-01-20 18:17:41.000000000 -0800
@@ -60,9 +60,15 @@
handle = 0;
}
#elif defined(PLATFORM_MACOSX)
+static void junk_function() {}
inline bool library::open(const string& name, const string& path) {
if(handle) close();
@kode54
kode54 / test.c
Created January 28, 2014 01:12
Preprocessor macro push and pop test for GCC and Clang
#define X 1
#pragma push_macro("X")
#undef X
#define X -1
#pragma pop_macro("X")
int a[X];
int main(void)
{
@kode54
kode54 / usf_coverage.txt
Created February 18, 2014 05:34
PGO coverage of foo_input_usf
Microsoft (R) Profile Guided Optimization Manager 11.00.50727.1
Copyright (C) Microsoft Corporation. All rights reserved.
PGD File: foo_input_usf.pgd 02/16/2014 17:50:10
Module Count: 1 Function Count: 3021 Arc Count: 3280 Value Count: 191
Static instructions: 39839 Basic blocks: 9220 Average BB size: 4.3
Dynamic instructions: 1295151200270
entry static dynamic % run
int GetFrequenceValue(int input)
{
if ( !input ) return 0;
if ( LinearFrqTab != 1 )
{
return input / FrequenceDivFactor;
}
else
{
@kode54
kode54 / play.c
Created February 28, 2014 02:21
Attempt to feed Pcsx Reloaded save states into Highly Experimental, for probing purposes.
#include <stdint.h>
#define EMU_COMPILE
#define EMU_LITTLE_ENDIAN
#include "PsxCore/Core/psx.h"
#include "PsxCore/Core/bios.h"
#include "PsxCore/Core/iop.h"
#include "PsxCore/Core/r3000.h"
#define _USE_MATH_DEFINES
#include "iirfilters.h"
#include <math.h>
#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795
#endif
IIRFilter::IIRFilter()
#!/bin/sh
FUCKING_THING_TO_SIGN=$1
FUCKING_SIGNED=0
while [ $FUCKING_SIGNED -eq 0 ]; do
codesign -s 'Developer ID Application' --deep --force "$FUCKING_THING_TO_SIGN"
spctl -a "$FUCKING_THING_TO_SIGN" && FUCKING_SIGNED=1
done
@kode54
kode54 / git_filter_dir.bat
Created April 5, 2014 03:59
These scripts can be used to prune a Git repository down to just the contents of the specified subdirectory, and prunes the change history to only the files contained within.
@echo off
setlocal enableextensions enabledelayedexpansion
set dir=%1
set dir=!dir:\=/!
git remote rm origin
git filter-branch --tag-name-filter cat --prune-empty --subdirectory-filter "%dir%" HEAD
git reset --hard