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/python | |
# encoding: utf-8 | |
import sys, os, itertools as it | |
try: | |
root = sys.argv[1] | |
except IndexError: | |
root = os.getcwd() |
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 collections import defaultdict | |
class BadMatch(NameError): | |
"""Exception when your args don't match a pattern""" | |
pass | |
class Any(object): | |
""" | |
>>> 'wutup' == Any() | |
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
use std::io::net; | |
fn get_my_external_ip() -> Option<net::ip::IpAddr> { | |
net::tcp::TcpStream::connect("8.8.8.8", 53).and_then(|ref mut s| s.socket_name()).map(|a| a.ip).ok() | |
} | |
fn main() { | |
println!("My external IP: {}", get_my_external_ip()); | |
} |