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
while true; do echo -n "◐\r"; sleep .1; echo -n "◓\r"; sleep .1; echo -n "◑\r"; sleep .1; echo -n "◒\r"; sleep .1; done | |
while true; do echo -n "◜\r"; sleep .1; echo -n "◠\r"; sleep .1; echo -n "◝\r"; sleep .1; echo -n "◞\r"; sleep .1; echo -n "◡\r"; sleep .1; echo -n "◟\r"; sleep .1; done | |
while true; do a=$a" "; echo -n "\r" $a "✈ "; sleep .1; done | |
while true; do a=$a" "; echo -n "\r" $a "\xcf\x80\xce\xbf\xcf\x8d\xcf\x84\xcf\x83\xce\xb1 "; sleep .1; done |
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
class Memento : | |
__mem__ = {} | |
def __init__(self, f) : | |
self.f = f | |
def __call__(self, arg) : | |
if arg not in self.__mem__ : | |
self.__mem__[arg] = self.f(arg) | |
return self.__mem__[arg] |
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
counter = 1 | |
class TestSingleton: | |
__instance = None | |
__var = 0 | |
def __init__(self): | |
global counter | |
self.__var = counter | |
counter += 1 |
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 <stdio.h> | |
#include <stdlib.h> | |
struct node { | |
int data; | |
struct node *next; | |
}; | |
struct list { | |
struct node *head; |
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
''' | |
Example of Floyd algorithm for loop detection | |
''' | |
class Node : | |
def __init__(self, data) : | |
self.next = None | |
self.data = data | |
def __str__(self) : |
We can't make this file beautiful and searchable because it's too large.
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
John,1,male,1880 | |
Mary,9655,female,1880 | |
William,2,male,1880 | |
Anna,9533,female,1880 | |
James,3,male,1880 | |
Emma,5927,female,1880 | |
Charles,4,male,1880 | |
Elizabeth,5348,female,1880 | |
George,5,male,1880 | |
Minnie,5126,female,1880 |
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
{"Andreas": "male", "Arely": "female", "Mortimer": "male", "Pauletta": "female", "Zita": "female", "Casen": "male", "Araceli": "female", "Ronald": "female", "Eura": "female", "Aracely": "female", "Destany": "female", "Cael": "male", "Kaleigh": "female", "Ayleen": "female", "Nikhil": "male", "Elex": "male", "Myah": "female", "Channie": "female", "Evalyn": "female", "Less": "male", "Jerel": "male", "Sandi": "female", "Lesa": "female", "Paul": "male", "Sandy": "female", "Kraig": "male", "Merlin": "male", "Vanesa": "female", "Matthew": "female", "Althea": "female", "Lucille": "female", "Samatha": "female", "Hamilton": "male", "Johnie": "female", "Dionne": "female", "Stephania": "female", "Stephanie": "male", "Raheem": "male", "Murl": "female", "Lafe": "male", "Ginger": "female", "Audy": "male", "Hughie": "male", "Jewell": "female", "Edra": "female", "Tatyanna": "female", "Quincy": "male", "Harvey": "male", "Agustus": "male", "Basil": "male", "Casey": "male", "Kaydence": "female", "Leilani": "female", "Dejuan": "m |
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
from itertools import groupby | |
[(i, len(list(j))) for i,j in groupby(sorted('hullabaloo'))] |
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
cat /var/log/maillog* | grep "$(date '+%b %d' | sed 's/0\([0-9]\)/ \1/g')" | grep "Cannot allocate memory" |
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
''' | |
Playing with MapReduce in python | |
ref. | |
http://mikecvet.wordpress.com/2010/07/02/parallel-mapreduce-in-python/ | |
''' | |
from multiprocessing import Pool | |
def generate_data(A = 90000, B = 20) : | |
return [ [ [j] for j in range(B)] for i in range(A)] |