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
# Returns a new hash applying the supplied transform to all values | |
class Hash | |
def copy_and_transform(&transform) | |
rv = self.class.new | |
self.each do |k,v| | |
case transform.arity | |
when 1 | |
rv[k] = yield(v) | |
when 2 | |
rv[k] = yield(k,v) |
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/ruby | |
MAX_ROUNDS = 50 | |
# Splits the deck of cards into two equal parts | |
# in the case of an odd deck size, the extra card goes in the first part | |
def cut(cards) | |
b_size = cards.length / 2 | |
a_size = cards.length - b_size | |
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/perl | |
# Generates a random IPv6 address in the same subnet as the machine is currently in | |
# Written by Dustin Lundquist <[email protected]> | |
use strict; | |
use warnings; | |
sub getglobaladdress { |
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/perl | |
# $Id$ | |
# This script enables IPv6 proxy arp for each address assigned to a container | |
# on this host. It also enables the nessacary sysctls for neighbor | |
# advertisments to be sent for container addresses. | |
# | |
# Written by Dustin Lundquist <[email protected]> | |
use warnings; | |
use strict; |
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/perl | |
use strict; | |
use warnings; | |
use LWP; | |
use LWP::Protocol::http; # So we can manipulate EXTRA_SOCK_OPTS | |
use HTTP::Request::Common; | |
# LWP DNS round Robin |
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
set ai " auto indenting | |
set history=100 " keep 100 lines of history | |
set ruler " show the cursor position | |
set et | |
set shiftwidth=4 | |
set tabstop=4 | |
set modeline | |
set spell | |
highlight constant ctermfg=lightblue | |
set background=dark |
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
*.aux | |
*.log | |
*.dvi | |
*.ps | |
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 <string.h> | |
#include <stdio.h> | |
void print_maps(); | |
char *foo = "This string is allocated in the string pool within the text segment which is read and execute only so it should be considered a const char *\n"; | |
char bar[] = "This string is allocated in the initialized data section of the data segement\n"; | |
char *baz; | |
int |
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/perl | |
use strict; | |
use warnings; | |
use LWP; | |
# $prerequisites->{course}->{requirement} | |
my $prerequisites = {}; | |
my $ua = LWP::UserAgent->new(); |
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
#Compiling step | |
gcc -std=c99 -Wall -Wextra -Wfatal-errors -pedantic-errors -O3 -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=200809L -c sni_proxy.c | |
gcc -std=c99 -Wall -Wextra -Wfatal-errors -pedantic-errors -O3 -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=200809L -c config.c | |
gcc -std=c99 -Wall -Wextra -Wfatal-errors -pedantic-errors -O3 -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=200809L -c cfg_parser.c | |
gcc -std=c99 -Wall -Wextra -Wfatal-errors -pedantic-errors -O3 -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=200809L -c cfg_tokenizer.c | |
gcc -std=c99 -Wall -Wextra -Wfatal-errors -pedantic-errors -O3 -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=200809L -c util.c | |
gcc -std=c99 -Wall -Wextra -Wfatal-errors -pedantic-errors -O3 -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=200809L -c server.c | |
gcc -std=c99 -Wall -Wextra -Wfatal-errors -pedantic-errors -O3 -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=200809L -c listener.c | |
gcc -std=c99 -Wall -Wextra -Wfatal-errors -pedantic-errors -O3 -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=200809L -c table.c | |
gcc -std |
OlderNewer