This file contains 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
function githead() { | |
local commondir ref hash _ | |
local gitdir="${1:a}" | |
until [[ -e "$gitdir/.git" ]]; do | |
local updir="${gitdir%/*}" | |
[[ "$updir" == "$gitdir" ]] && return 1 | |
gitdir="$updir" | |
done | |
gitdir="$gitdir/.git" | |
[[ -f "$gitdir" ]] && read _ gitdir < "$gitdir" |
This file contains 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 <cstdio> | |
#include <cstring> | |
#include <cstdlib> | |
#include <cstdint> | |
#define VECLEN 16 | |
#define ADLER_MOD 65521 | |
typedef uint8_t vuint8_t __attribute__((ext_vector_type(VECLEN))); |
This file contains 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
from scipy.fftpack import fft | |
from matplotlib import pyplot | |
N = 65536 | |
f_s = 48000 | |
f_c = 1000 | |
prng_lfsr = 0x32B71700 | |
prng_tap = 0xb874 |
This file contains 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 <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
uint8_t Y(uint8_t r, uint8_t g, uint8_t b) { return ((r * 66 + g * 129 + b * 25 + 128) >> 8) + 16; } | |
uint8_t U(uint8_t r, uint8_t g, uint8_t b) { return ((r * -38 + g * -74 + b * 112 + 128) >> 8) + 128; } | |
uint8_t V(uint8_t r, uint8_t g, uint8_t b) { return ((r * 112 + g * -94 + b * -18 + 128) >> 8) + 128; } | |
uint32_t ref(uint8_t const* p) { | |
uint8_t lr = p[0], lg = p[1], lb = p[2], rr = p[3], rg = p[4], rb = p[5]; |
This file contains 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 <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
void split(uint8_t* r, uint8_t* g, uint8_t* b, uint16_t rgb16) { | |
*r = (((rgb16 >> 11) & 0x1f) * 255 + 15) / 31; | |
*g = (((rgb16 >> 5) & 0x3f) * 255 + 31) / 63; | |
*b = (((rgb16 >> 0) & 0x1f) * 255 + 15) / 31; | |
} |
This file contains 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 <stdio.h> | |
#include <math.h> | |
int main(void) { | |
long double x = 0.0; | |
long double phi = 0.61803398874989484820458683436563811772030917980576286213544862L; | |
long double t = 1.0; | |
for (;;) { | |
int n = 0; |
This file contains 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> | |
class Foo { | |
uint64_t& data; | |
uint64_t* const pdata; | |
public: | |
Foo(uint64_t& d) : data(d), pdata(&d) { } | |
inline uint64_t get(void) { return data; } | |
inline uint64_t pget(void) { return *pdata; } |
This file contains 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 <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
#define TABBITS 8 | |
#if 0 | |
extern uint32_t divfn(uint16_t i, uint16_t j); | |
#else |