Skip to content

Instantly share code, notes, and snippets.

@thefloweringash
thefloweringash / Info.plist
Last active December 11, 2015 02:09
Info.plist with entries for testing with vid 0x1007 and pid 0x8400. https://github.com/thefloweringash/iousbhiddriver-descriptor-override
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>12C60</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>IOUSBHIDDriverDescriptorOverride</string>
#!/bin/bash
# pull apart a bzImage compressed with xz (or gzip),
# and put it back together in a format that pv-grub understands
# useful when your kernel is compressed but your pv-grub doesn't
# recognise it, for example rescue64 from system rescue cd.
# the result is *not* a bootable kernel outside of pv-grub
# worksforme on OS X, YMMV
@thefloweringash
thefloweringash / ipmitool-darwin-allow-ipmishell.patch
Created April 17, 2013 09:27
ipmitool force disables ipmishell on Darwin. I don't know why. It seems useful to me.
diff --git a/configure b/configure
index bdf6dae..f5b8e8d 100755
--- a/configure
+++ b/configure
@@ -12347,7 +12347,6 @@
enable_intf_open=no
enable_intf_lipmi=no
enable_intf_bmc=no
- enable_ipmishell=no
;;

Uses ntfswalk and sleuthkit.

Fetch MFT, find offset, update code near cluster_to_byte_offset.

Example ntfswalk usage:

ntfswalk32 -mftfile ../mft.raw -out ntfswalk-results -csv -action_include_clusterinfo

@thefloweringash
thefloweringash / make-patch.sh
Created August 22, 2013 02:37
Xpra on FreeBSD
#!/bin/sh
if [ ! -d 'xpra' ]; then
echo "Could not find xpra source dir"
exit 1
fi
XPRA_GTK_MAIN_FILES=`
grep -r . -El -e '^[[:space:]]*gtk\.main\(\)[[:space:]]*$'`
@thefloweringash
thefloweringash / gdb-session
Created August 22, 2013 04:26
Xpra 0.10.1 crash on startup on FreeBSD
[lorne@xenon ~/xpra-new/xpra-0.10.1]$ PYTHONPATH=$PWD/install/lib/python /usr/local/bin/gdb /usr/local/bin/python2.7
GNU gdb (GDB) 7.6 [GDB v7.6 for FreeBSD]
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-portbld-freebsd9.1".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
@thefloweringash
thefloweringash / gdb-session
Created August 22, 2013 04:35
pygtk crash after threads_init() but without threads_enter()
[lorne@xenon ~]$ cat crashme.py
#!/usr/local/bin/python2.7
import gtk.gdk
gtk.gdk.threads_init()
gtk.main()
[lorne@xenon ~]$ ./crashme.py
** (process:95092): WARNING **: Trying to register gtype 'GMountMountFlags' as enum when in fact it is of type 'GFlags'
** (process:95092): WARNING **: Trying to register gtype 'GDriveStartFlags' as enum when in fact it is of type 'GFlags'
@thefloweringash
thefloweringash / gdb-session
Created August 22, 2013 12:38
Minified pure gtk threads test and gdb session
[lorne@xenon ~]$ cat crashme.c
#include <gtk/gtk.h>
int main() {
gdk_threads_init();
gtk_main();
}
[lorne@xenon ~]$ cc -g `pkg-config --cflags --libs gtk+-2.0` -o crashme crashme.c
[lorne@xenon ~]$ gdb ./crashme
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
@thefloweringash
thefloweringash / patch-enc_x264.c.diff
Created August 23, 2013 05:17
Xpra 0.10.1: FreeBSD compatibility
--- ./xpra/codecs/enc_x264/enc_x264.c.orig 2013-08-06 21:11:22.000000000 +1200
+++ ./xpra/codecs/enc_x264/enc_x264.c 2013-08-23 17:08:56.000000000 +1200
@@ -17,7 +17,7 @@
#ifdef _WIN32
#define _STDINT_H
#endif
-#if !defined(__APPLE__)
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
#include <malloc.h>
#endif
@thefloweringash
thefloweringash / gist:6926689
Created October 10, 2013 22:37
apply str vs reduce str
user=> (def input (take 10000 (cycle (map char (range (int \a) (int \z))))))
#'user/input
user=> (bench (reduce str input))
Evaluation count : 1800 in 60 samples of 30 calls.
Execution time mean : 33.756996 ms
Execution time std-deviation : 278.588482 µs
Execution time lower quantile : 33.542863 ms ( 2.5%)
Execution time upper quantile : 34.797430 ms (97.5%)
Overhead used : 4.038278 ns