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
--Applescript direct | |
on replaceText(find, replace, subject) | |
set prevTIDs to text item delimiters of AppleScript | |
set text item delimiters of AppleScript to find | |
set subject to text items of subject | |
set text item delimiters of AppleScript to replace | |
set subject to "" & subject | |
set text item delimiters of AppleScript to prevTIDs |
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 [file] | grep -o '\$[^} ;&?"-]*' | sort -u |
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)] |
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
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
{"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 |
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
''' | |
Example of Floyd algorithm for loop detection | |
''' | |
class Node : | |
def __init__(self, data) : | |
self.next = None | |
self.data = data | |
def __str__(self) : |
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
counter = 1 | |
class TestSingleton: | |
__instance = None | |
__var = 0 | |
def __init__(self): | |
global counter | |
self.__var = counter | |
counter += 1 |
OlderNewer