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 python | |
import sys | |
import mmh3 | |
import math | |
import random | |
import struct | |
try: | |
import numpy as np | |
from matplotlib import pyplot |
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 MergeIterables { | |
private MergeIterables() {} | |
public static <T extends Comparable<T>> Iterable<T> mergeIterables(final List<? extends Iterable<? extends T>> iterables) { | |
return mergeIterables(iterables, Ordering.<T>natural()); | |
} | |
public static <T> Iterable<T> mergeIterables(final List<? extends Iterable<? extends T>> iterables, final Comparator<T> comparator) { | |
if (iterables.isEmpty()) { | |
return Collections.emptyList(); |
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 MajorCompactServersJob extends AbstractJob { | |
public static final String SHORT_OPT = "majorCompactServers"; | |
public static final String LONG_OPT = "majorCompactServers"; | |
public static final String DESCRIPTION = "Major compact all regions on a server or list of servers"; | |
private final HBaseAdminWrapper wrapper; | |
private final SlowCompactionManager compactor; | |
private final RegionLoadEstimation regionLoadEstimation; | |
private final HdfsLocalityInfo hdfsLocalityInfo; | |
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
^(?:a(?:c(?:ademy|countants||t(?:ive|or))|bogado|e(?:|ro)|d|g(?:|ency)|f|i(?:|rforce)|m|l(?:sace||lfinanz)|o|n|q|s(?:ia|sociates|)|r(?:pa|chi||my)|u(?:ction||tos|dio)|t(?:|torney)|w|x(?:a|)|z)|c(?:a(?:b|m(?:p|era)|l|ncerresearch|p(?:ital|etown)|s(?:a|h)|r(?:avan|e(?:|er(?:s|))|ds)|t(?:|ering)|)|c|e(?:rn|o|nter)|d|g|f|i(?:|t(?:ic|y))|h(?:annel|urch|r(?:istmas|ome)||eap)|k|m|l(?:aims|eaning|i(?:ck|nic)|othing|ub|)|o(?:des|ffee|m(?:p(?:any|uter)||munity)|l(?:lege|ogne)|o(?:p|king|l)|n(?:s(?:ulting|truction)|dos|tractors)|untry|)|n|r(?:uises|s||edit(?:card|))|u(?:isinella|)|w|v|y(?:|mru)|x|z)|b(?:a(?:yern||r(?:|gains)|nd)|b|e(?:|st|rlin|er)|d|g|f|i(?:|ke|z|d|o)|h|j|m(?:|w)|l(?:ack(?:|friday)|ue)|o(?:|utique|o)|n(?:pparibas|)|s|r(?:|ussels)|u(?:ild(?:|ers)|siness|zz|dapest)|t|w|v|y|z(?:h|))|e(?:at|c|e|du(?:cation|)|g|m(?:ail|erck)|n(?:ergy|terprises|gineer(?:ing|))|quipment|s(?:q||tate)|r|u(?:s|)|t|vents|x(?:p(?:ert|osed)|change))|d(?:a(?:y|d|ting|nce)|e(?:als|gree|mocrat|livery|nt(?:ist|al)|si|)|i(?:amonds|scount |
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 python | |
import re | |
from collections import defaultdict | |
from urllib2 import urlopen | |
def main(): | |
domains = set() | |
#domains |= get_domains_from_url('https://publicsuffix.org/list/effective_tld_names.dat') | |
domains |= get_domains_from_url('http://data.iana.org/TLD/tlds-alpha-by-domain.txt') |
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
from typedispatch import * | |
@dispatch(regexmulti(r'(\d{3})\D{0,2}(\d{3})\D?(\d{4})')) | |
def phone_numbers(phone_numbers): | |
for match in phone_numbers: | |
print '-'.join(match.groups()) | |
@dispatch() | |
def phone_numbers(text): |
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; | |
my $x = [qr/([aieou]+)/io, qr/(\d+)/o]; #<- Here is a list of 2 regexes... | |
my $line = <STDIN>; | |
foreach my $regex (@{$x}) { | |
if ($line =~ $regex) { | |
print "a vowel or digit!\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
#!/usr/bin/env python | |
""" | |
contactinfo.py is a simple script to get contact information from | |
Facebook. | |
To use, first install mechanize [1]. Then use the friendstocsv application [2] | |
on Facebook to export a csv file with all of your friends. Be sure | |
to include at least the profile URL. | |
Afterwards, edit this file to put your email, password, and user agent |
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
// Newbie programmer | |
int factorial_newbie(int n) { | |
if (n == 0) { | |
return 1 | |
} else { | |
return n * factorial_newbie(n - 1) | |
} | |
} | |
println factorial_newbie(6) |
OlderNewer