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
[alias] | |
st = status | |
ci = commit -v | |
cii = commit -v --interactive | |
cia = commit -v -a | |
addi = add --interactive | |
addchanged = add -u | |
br = branch | |
co = checkout | |
diffwords = diff --word-diff |
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/env perl | |
use strict; | |
use warnings; | |
use Benchmark qw(cmpthese); | |
cmpthese shift || -3, { | |
"shift" => sub { | |
my $arg = shift; |
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
package permutation | |
// Based on https://stackoverflow.com/a/30230552/14660 by Paul Hankin | |
// perm := NewPermutation( slice ) | |
// for next := perm.Next(); next != nil; next = perm.Next() { | |
// ... | |
// } | |
// | |
// or |
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
test=> select count(*) from orders; | |
count | |
--------- | |
1003116 | |
(1 row) | |
test=> select count(distinct articleid) from orders; | |
count | |
-------- | |
999921 |
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/env perl | |
use strict; | |
use warnings; | |
use Carp; | |
BEGIN { | |
# uncomment to test pure Perl Mouse | |
# $ENV{MOUSE_PUREPERL} = 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
for i, j := 0, len(r)-1; | |
i < len(r)/2; | |
i, j = i+1, j-1 | |
{ | |
r[i], r[j] = r[j], r[i] | |
} | |
for i, j := 0, len(r)-1; | |
i < len(r)/2; | |
i, j = i+1, j-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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdarg.h> | |
#include <string.h> | |
char * strcat_ex( const char *s, ... ) | |
{ | |
if ( s == NULL ) { | |
return 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
#! /usr/bin/perl | |
use v5.18; | |
use strict; | |
use warnings; | |
my $total = 0; | |
local $/ = "\n\n"; | |
while(<DATA>) { |
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 <string.h> | |
#include <stdlib.h> | |
int read_line_fgetc(FILE *fp, char *line, int line_size){ | |
int c; | |
int i = 0; | |
while( (c = fgetc(fp)) > 0) { | |
if( (char)c == '\n' ) { | |
break; |
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
/* See http://www.pcg-random.org/using-pcg-c-basic.html */ | |
#include "pcg_basic.h" | |
#include <stdio.h> | |
void try_random(unsigned int seed, int initseq) { | |
pcg32_random_t rng; | |
pcg32_srandom_r(&rng, seed, initseq); | |
printf("Seed: %u\n", seed); | |
NewerOlder