Skip to content

Instantly share code, notes, and snippets.

// Snippet ported from xboxdrv
{ // find endpoints
struct usb_config_descriptor *config;
struct usb_interface *interface;
struct usb_interface_descriptor *altsetting;
struct usb_endpoint_descriptor *endpoing;
for (
config = dev->config;
#include <stdint.h>
#include <stdio.h>
// sanity check
// test for eight-bit-bytes
int main(int argc, char **argv) {
if (255 == UINT_LEAST8_MAX) {
printf("pass\n");
return 0;
require File.join(File.dirname(__FILE__),'helper')
describe 'The load order' do
it 'should not cause explosions when loading physics before arbiter' do
require 'physics'
require 'arbiter'
end
end
#include "buffer.h"
/* statically allocate tests */
#define TEST_MAX (2 << 8)
struct test {
struct test *next;
char *desc;
int pass;
} tests[TEST_MAX];
#define pi 3.1415926535897932
double sin(double a) {
double y;
double x = a / (pi / 2);
int fol = x;
int neg = (int)(x / 2) & 1;
int inv = (int)x & 1;
#define FPS 30
enum player_state {
PLAYER_HALT,
PLAYER_LEFT,
PLAYER_RIGHT,
PLAYER_DOWN,
PLAYER_UP
};
@acdimalev
acdimalev / gem-depcheck
Created August 4, 2011 10:51
Check for uninstalled gem dependencies.
#!/usr/bin/ruby
require 'rubygems'
installed_gems = Gem::Dependency.new '', Gem::Requirement.default
missing = []
# mind the short-hand, looping over installed gem specs
specs = Gem.source_index.search installed_gems
specs.each do |spec|
gem = Gem::Dependency.new spec.name, spec.version
# looping over gem dependencies
specs = Gem.source_index.search gem
@acdimalev
acdimalev / broadcom-sta.patch
Created November 19, 2011 17:45
broadcom-sta patch for Debian squeeze-backports kernel
diff --git a/amd64/src/wl/sys/wl_linux.c b/amd64/src/wl/sys/wl_linux.c
index dbd6e89..c5d9ba9 100644
--- a/amd64/src/wl/sys/wl_linux.c
+++ b/amd64/src/wl/sys/wl_linux.c
@@ -1418,7 +1418,7 @@ static void
_wl_set_multicast_list(struct net_device *dev)
{
wl_info_t *wl;
- struct dev_mc_list *mclist;
+ struct netdev_hw_addr *ha;
@acdimalev
acdimalev / part-mount
Created December 9, 2011 05:58
a quick and dirty script for mounting partitions of a disk image
#!/bin/sh
# part-mount
#
# a quick and dirty script for mounting
# partitions of a disk image
#
if test $# -ne 3; then
echo Usage: $0 DISK-IMAGE PARTITION DIR; exit
#include <sys/ioctl.h>
#include <unistd.h>
#include "unicode_ascii_translation_table.c"
#define CSI "\x1B["
int is_ascii_printable(char c) {
return (c > 0x1F) & (c != 0x7F);
}