A Pen by Massimo Santini on CodePen.
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 json import loads, dumps | |
from base64 import b64decode, b64encode | |
def relocate( conf_data, old_path, new_path ): | |
def rdt( dct ): | |
for k, v in dct.items(): | |
if isinstance( v, dict ): | |
rdt( v ) | |
else: |
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
import java.io.File; | |
import java.io.IOException; | |
import java.net.ServerSocket; | |
import java.net.Socket; | |
import java.net.URLDecoder; | |
import java.nio.charset.Charset; | |
import java.util.List; | |
import java.util.Locale; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; |
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
import static org.junit.Assert.assertEquals; | |
import java.util.Arrays; | |
import java.util.Comparator; | |
import java.util.Iterator; | |
import java.util.List; | |
import org.junit.Test; | |
public class LexicographicListComparator { |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 timeit import Timer | |
from operator import attrgetter | |
from random import randint | |
def timeit( stmt, setup ): | |
t = Timer(stmt=stmt, setup=setup) | |
print "%.2f usec/pass" % (100000 * t.timeit(number=10000)/10000) | |
class Person(object): | |
def __init__(self, age): |
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
$functions = <<FUNCTIONS | |
function _fixperms { | |
echo "*** Fixing /home/vagrant permissions and ownership" 1>&2 | |
chown -R vagrant:vagrant /home/vagrant | |
chmod -R go= /home/vagrant | |
} | |
function _github { | |
if ! [ -d /home/vagrant/sdt ]; then | |
echo "*** Cloning 'sdt' from GitHub" 1>&2 | |
su - vagrant -c 'hg clone git://github.com/mapio/sdt.git' |
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 main( int argc, char *argv[] ) | |
{ | |
printf( "Salve, %s!\n" ); | |
return 0; | |
} |
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
have b2 && | |
_b2 () { | |
local _b2_subcommands=( | |
'authorize_account' | |
'clear_account' | |
'create_bucket' | |
'delete_bucket' | |
'delete_file_version' | |
'download_file_by_id' | |
'download_file_by_name' |