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 "wantcurve.h" | |
#include <err.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <ctype.h> | |
wantcurve *read_wantcurve_from_path(char *path) { | |
FILE *fh; | |
if ( (fh = fopen(path, "rb")) == NULL ) |
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
sub read_curve_from { | |
my ($fn) = @_; | |
my $fh; | |
if ( $fn eq "-" ) { | |
$fh = \*STDIN; | |
} else { | |
open $fh, "<", $fn or die "Couldn't open $fn for reading: $!"; | |
} | |
return read_curve_string(do { local $/; <$fh> }); |
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
sub make_wantcurve { | |
my ($sr,$size,$pts) = @_; | |
my @points = sort { $a->[0] <=> $b->[0] } @$pts; | |
my $want = []; | |
FREQ: for my $i ( 0 .. $size-1 ) { | |
my $f = $i/$size*$sr; | |
if ( $f > $sr/2 ) { | |
$f = $sr-$f; # ah, imaginary numbers, how i love you so |
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
int pti = 0; | |
for (int i = 0; i < len; i++) { | |
float f = (float)i/len*sr; | |
if ( f < curve->pts[0].freq ) { | |
// before the first point | |
in[i].r = curve->pts[0].power; | |
} else if ( curve->pts[curve->ct-1].freq < f ) { | |
// after last point | |
in[i].r = curve->pts[curve->ct-1].freq; | |
} else { |
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
- (void)loadImage { | |
NSURL *url = [db getImageURL:mnam node:nodeidx]; | |
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; | |
[[URLHandler mainHandler] dataForURL:url sentTo:^(BOOL worked, NSData *data){ | |
if ( !worked ) { | |
UIAlertView *alert = [[UIAlertView alloc] | |
initWithTitle:@"Network Failure" | |
message:@"Couldn't download the comic. Make sure you're connected to a network." |
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
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
sub spawn { | |
if ( !fork ) { | |
system @_ and die; | |
exit 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
#!/usr/bin/perl | |
use warnings; | |
use strict; | |
use AnyEvent; | |
use AnyEvent::Socket; | |
use Coro; | |
use Coro::Handle; | |
my %open; |
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
// Compile and run in 32-bit mode: | |
// $ cc -Wall -m32 -o test test.c | |
// $ ./test | |
// false | |
// | |
// Contrast with 64-bit mode: | |
// $ cc -Wall -m64 -o test test.c | |
// $ ./test | |
// true | |
// |
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
### Keybase proof | |
I hereby claim: | |
* I am encryptio on github. | |
* I am encryptio (https://keybase.io/encryptio) on keybase. | |
* I have a public key whose fingerprint is D72A 7DD7 B5E5 9821 8E15 37A6 2FBB F02B 4281 437B | |
To claim this, I am signing this object: |
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
var charLookup = "??????????\n????????????????????? !?#$%&?()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[?]^_`abcdefghijklmnopqrstuvwxyz???~?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????"; | |
var bailoutSteps = 60000; | |
r.expr({ | |
program: "rot13 (from Wikipedia):"+ | |
"-,+[ Read first character and start outer character reading loop"+ | |
" -[ Skip forward if character is 0"+ | |
" >>++++[>++++++++<-] Set up divisor (32) for division loop"+ | |
" (MEMORY LAYOUT: dividend copy remainder divisor quotient zero zero)"+ |