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
import numpy as np, sys, random, argparse | |
parser = argparse.ArgumentParser() | |
parser.add_argument('-n', type=int, default=10) | |
parser.add_argument('-s', type=float, default=1.0) | |
args = parser.parse_args() | |
words = [x.strip() for x in sys.stdin] | |
partials = np.power(1.0 + np.arange(len(words)), -args.s).cumsum() |
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
import weechat | |
hist = {} | |
histlen = 32 | |
# [head, ..., tail] | |
queue = [] | |
def enqueue(msg): | |
global queue | |
if msg is None: |
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
#!/bin/sh | |
CTR=0 | |
while [ -f "out$CTR.mkv" ]; do | |
let CTR=CTR+1 | |
done | |
if [ -z "$1" ]; then | |
echo "missing input argument" | |
exit 1 |
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
/* The C JNIEnv typedef looks like this: */ | |
typedef const struct JNINativeInterface_ *JNIEnv; | |
/* These are the useful members of the struct JNINativeInterface_ with a | |
smidge of sed to clear away the clutter. Additionally, each /(.*)V/ | |
method has matching "\1A" and "\1" alternatives, i.e., if you see this: | |
jobject (*NewObjectV) (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); |
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 <unistd.h> | |
#include <sys/time.h> | |
#include <sys/select.h> | |
#include <errno.h> | |
/* this function does not do much error checking. be warned! */ | |
ssize_t read_timeout(int fd, char *buf, size_t len, int timeout) | |
{ | |
ssize_t sz, rsz; |
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
char *f="char *f=\"$\";\n" | |
"char buf[65536];\n" | |
"char in[65536];\n" | |
"char *sub_copy(char *b){\n" | |
"char *a=f;\n" | |
"for(;*a;a++)switch(*a){\n" | |
"case 10:*b++=92;*b++=110;*b++=34;*b++=10;*b++=34; break;\n" | |
"case 34:\n" | |
"case 92:*b++=92;\n" | |
"default:*b++=*a;\n" |
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
diff -rupN mpd-0.17.5.old/src/decoder/modplug_decoder_plugin.c mpd-0.17.5.new/src/decoder/modplug_decoder_plugin.c | |
--- mpd-0.17.5.old/src/decoder/modplug_decoder_plugin.c 2013-08-01 00:15:41.000000000 -0700 | |
+++ mpd-0.17.5.new/src/decoder/modplug_decoder_plugin.c 2013-10-04 21:36:17.978427703 -0700 | |
@@ -108,7 +108,7 @@ mod_decode(struct decoder *decoder, stru | |
ModPlug_GetSettings(&settings); | |
/* alter setting */ | |
- settings.mResamplingMode = MODPLUG_RESAMPLE_FIR; /* RESAMP */ | |
+ settings.mResamplingMode = MODPLUG_RESAMPLE_NEAREST; /* RESAMP */ | |
settings.mChannels = 2; |
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
/* binary.h -- Alex's BIN() macro (and related) */ | |
/* Copyright (C) 2013 Alex Iadicicco */ | |
#ifndef __INC_BINARY_H__ | |
#define __INC_BINARY_H__ | |
#define _BIN_DIGIT(c, n) (!((c) - '1')) | |
#define _BIN01(x) _BIN_DIGIT((x)[0], 0) | |
#define _BIN02(x) _BIN01((x)+1) | (_BIN01(x) << 1) | |
#define _BIN03(x) _BIN02((x)+1) | (_BIN01(x) << 2) |
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> | |
#include <stdlib.h> | |
#define BLANK 64 | |
static char *enc = | |
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; | |
static uint8_t dec[256]; | |
static void make_dec(void) | |
{ |
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 <unistd.h> | |
int main(int argc, char *argv[]) | |
{ | |
char buf[512]; | |
char *args[3] = { argv[0], NULL, NULL }; | |
int x = (argc > 1 ? atoi(argv[1]) : 0) + 1; | |
if (x == 10000) | |
return puts("done") && 0; |
NewerOlder