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 | |
# Resolve many domain names at a TLD for the zone asynchronously. | |
# | |
# Author: Rusty Conover <rusty@luckydinosaur.com> | |
# | |
use strict; | |
use warnings; | |
use AnyEvent::DNS; | |
use AnyEvent; |
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
% These are the standard size rules, they list the tier and the | |
% limitations. | |
% | |
% Record format: Tier name, longest, median, shortest, max lenght plus | |
% girth, is media flag, max weight | |
standard_size_tier_rule(product_size_tier_small_standard_size, 15, 12, 0.75, _, 1, 14/16). | |
standard_size_tier_rule(product_size_tier_small_standard_size, 15, 12, 0.75, _, 0, 12/16). | |
standard_size_tier_rule(product_size_tier_large_standard_size, 18, 14, 8, _, _, 20). | |
% Determine the rules that are standard size tiers |
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
use strict; | |
use warnings; | |
use Benchmark; | |
use Crypt::ScryptKDF qw(scrypt_hash random_bytes); | |
my $types = { | |
map { | |
my $v = $_; | |
$v => sub { | |
scrypt_hash("s3kr1t_password", random_bytes(), 2**$v, 8, 1, 32); |
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
def collatz_count_until_1(n): | |
count = 0 | |
while n != 1: | |
if n % 2 == 0: | |
n = n / 2 | |
else: | |
n = (3 * n) + 1 | |
count += 1 | |
return count |
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
def collatz_count_until_1(n): | |
count = 0 | |
while n != 1: | |
if n % 2 == 0: | |
n = n / 2 | |
else: | |
n = (3 * n) + 1 | |
count += 1 | |
return count |
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
use strict; | |
use warnings; | |
sub collatz_count_until_1 { | |
my $n = shift; | |
my $count = 0; | |
while ($n != 1) { | |
$n = (($n % 2 == 0) ? ($n/2) : (($n*3) + 1)); | |
$count++; | |
} |
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> | |
int collatz_count_until_1(unsigned int n) { | |
int count = 0; | |
while(n != 1) { | |
if(n % 2 == 0) { | |
n /= 2; | |
} else { | |
n = (3 * n) + 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
'use strict'; | |
function collatz_count_until_1(n) { | |
var count = 0; | |
while(n !== 1) { | |
if(n % 2 === 0) { | |
n /= 2; | |
} else { | |
n = (3 * n) + 1; | |
} | |
count++; |
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
public class Collatz { | |
private static int count_until_1(long n) { | |
int count = 0; | |
while(n != 1) { | |
if(n % 2 == 0) { | |
n /= 2; | |
} else { | |
n = (n * 3) + 1; | |
} | |
count++; |
OlderNewer