Skip to content

Instantly share code, notes, and snippets.

View whitequark's full-sized avatar
🐈‍⬛

Catherine whitequark

🐈‍⬛
View GitHub Profile
In a magic kingdom there is a granite cliff in the shape of a cube 1km long at the edge. Once a century, a raven sits at the cliff and cleans his beak, eroding the cliff by 0.0001g. The amount of years that will pass before the cliff is ground to dust is less than Nᴀ.
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA256:EECDH+aRSA+RC4:EDH+aRSA:EECDH:RC4:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!SSLv3;
@whitequark
whitequark / binutils-2.25.1-or1k-R_PCREL-pcrel_offset.patch
Last active August 29, 2015 14:26
libbfd patch to correctly apply data relocations in .eh_frame and .gcc_except_table sections
--- a/bfd/elf32-or1k.c 2015-08-02 15:45:34.275922535 +0300
+++ b/bfd/elf32-or1k.c 2015-08-02 15:45:36.635931622 +0300
@@ -199,7 +199,7 @@
FALSE, /* partial_inplace */
0, /* src_mask */
0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
HOWTO (R_OR1K_16_PCREL,
@whitequark
whitequark / diff-pci-configs.sh
Created September 4, 2011 23:00
A script to find differences in PCI configuration space on Linux
#!/bin/bash
set +e
if ! [ "`id -u`" == '0' ]; then
echo 'This script must be run as root'
exit
fi
mkdir -p diff-pci-configs-data
@whitequark
whitequark / ast_quirks.rb
Created September 7, 2011 21:17
Treetop AST quirks
require 'treetop'
Treetop.load 'ast_quirks.treetop'
parser = SimpleExpressionParser.new
ast = parser.parse %q{42}
p ast.to_code
@whitequark
whitequark / strace-4.6-v4l2-ioctls.patch
Created October 5, 2011 00:02
V4L2 ioctl support for strace
diff -urN strace-4.6.old/defs.h strace-4.6.new/defs.h
--- strace-4.6.old/defs.h 2011-03-15 20:19:09.000000000 +0300
+++ strace-4.6.new/defs.h 2011-10-05 01:06:42.000000000 +0400
@@ -594,6 +594,7 @@
extern int rtc_ioctl(struct tcb *, long, long);
extern int scsi_ioctl(struct tcb *, long, long);
extern int block_ioctl(struct tcb *, long, long);
+extern int v4l2_ioctl(struct tcb *, long, long);
#endif
@whitequark
whitequark / gist:2622705
Created May 6, 2012 14:48
a piece of modern art
(3995:lookup-switch 3523 [3307, 3307, 3307, 3337, 3337, 3337, 3337, 3337, 3491, 3491, 3491, 3491, 3491, 3491, 3491, 3523]
(ternary
(3560:===
(3558:bit-or
(3555:lshift
(3551:integer 46)
(3553:integer 16))
(3556:integer 14))
(3559:get-local 3))
(3564:integer 0)
@whitequark
whitequark / update-package.sh
Created May 12, 2012 17:14
Pure shell update package installer for Android
#!/bin/bash
set -e
UPDATE_PKG=$1
if [ "$UPDATE_PKG" == "" ]; then
echo "Usage: $0 <update package>"
echo
exit 1
@whitequark
whitequark / gist:4705506
Last active December 12, 2015 03:18
NoSQL is for those who can't learn SQL.
# Convert raw stats into hourly stats.
def self.squash!(before=Time.now)
transaction do
range = where(%{
date_trunc('hour', collected_at) < date_trunc('hour', timestamp ?)
}, before)
from_id, to_id = range.minimum(:id), range.maximum('id')
return nil if [from_id, to_id].none?