This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use GD; | |
my ($char_count, $char_width, $char_height); | |
my $im; | |
my ($fg, $bg); | |
while (<>) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# Takes M parameters on the command line, binary strings of N digits. | |
# Filters stdin to stdout, printing only lines whose indices fall inside (or | |
# outside, if -invert is specified) the independent ranges specified by the | |
# binary string, where "" means "everything", "0" means "the first half", "01" | |
# means "the first quarter", "111" means "the last eighth" and so on. | |
use strict; | |
my @lines = <STDIN>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
// from http://download.intel.com/embedded/software/IA/324264.pdf | |
#define rdtscp_before() \ | |
({ uint32_t cycles_high, cycles_low; \ | |
__asm__ volatile ("CPUID\n\t" \ | |
"RDTSC\n\t" \ | |
"mov %%edx, %0\n\t" \ | |
"mov %%eax, %1\n\t": "=r" (cycles_high), "=r" (cycles_low):: \ | |
"%rax", "%rbx", "%rcx", "%rdx"); \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unsigned check_range(const char *bad, const char *good, size_t len, size_t bounds[2]) | |
{ | |
if (len < 2) { | |
if (len) | |
return *bad != *good; | |
return 0; | |
} else if (memcmp(bad, good, len)) { | |
size_t subbounds[2][2] = { { 0 } }; | |
int leftbad = check_range(&bad[0 ], &good[0 ], len / 2, subbounds[0]); | |
int rightbad = check_range(&bad[len / 2], &good[len / 2], len - len / 2, subbounds[1]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <assert.h> | |
#include <errno.h> | |
#include <stddef.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <limits.h> | |
#include <stdint.h> | |
#define RANK_0_LOG 5 | |
#define RANK_0_SIZE (1ul << RANK_0_LOG) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <search.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
struct record { | |
int key; | |
char val[16]; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stddef.h> | |
#include <string.h> | |
#define elem(Base, Index) \ | |
(((char *)Base)[(Index) * width]) | |
void swap(void *base, size_t width, size_t i0, size_t i1) | |
{ | |
char temp[width]; | |
memcpy(&temp, &elem(base,i0), width); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Taken from publicly available information at http://gcc.gnu.org/wiki/CompileFarm | |
# Put this in your ~/.ssh/config and s/LOGIN/username/ | |
# AMD Opteron Magny-Cours / 64 GB RAM / Supermicro AS-1022G-BTF / Debian x86-64 -- 2TB, 2x12x1.5 GHz | |
Host gcc10 | |
User LOGIN | |
Hostname gcc10.fsffrance.org | |
# GHz AMD Opteron 2212 / 4GB RAM / Dell SC1345 / Debian x86-64 -- 580G, 2x 2x2.0 | |
Host gcc11 | |
User LOGIN | |
Hostname gcc11.fsffrance.org |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// clobbers %rax ; this could cause issues with variadic functions | |
#define trace_wrap(Ret,Func,...) \ | |
({ \ | |
long long temp; \ | |
void flag_wrap(); \ | |
/* Write the function pointer into the red zone on the stack \ | |
* and hope that the function we call doesn't use up that much \ | |
* stack for its arguments */ \ | |
asm volatile("movq %0,-120(%%rsp)" : : "a"(Func)); \ | |
flag_wrap(__VA_ARGS__); \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module JCounter(input clk, input ce, output tick); | |
parameter STAGES = 6; | |
parameter SHIFTS = 10; | |
assign tick = stage[STAGES - 1].s[SHIFTS - 1]; | |
generate | |
genvar i; | |
for (i = 0; i < STAGES; i = i + 1) begin:stage |