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
// prime number generator | |
for (i <- 2 to 1000) | |
if((2 to i).find( j=> (i % j == 0 && i != j) ) == None) | |
println(i) | |
// function currying example | |
def matcher(haystack: List[Char])(needle: String) = { | |
haystack contains needle.charAt(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
CREATE USER 'username'@'localhost' IDENTIFIED BY '...'; | |
GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost'; | |
GRANT SELECT, LOCK TABLES on Project_app_production.* to 'user'@'localhost'; | |
SHOW GRANTS FOR 'root'@'localhost'; | |
select * from mysql.user; | |
--- |
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
<?php | |
/** | |
* Monad boxing integer side effects | |
* | |
* @package default | |
* @subpackage default | |
* @author Federico Marani | |
**/ | |
class IntegerBox | |
{ |
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 | |
from optparse import OptionParser | |
import hashlib | |
import sys | |
parser = OptionParser() | |
parser.add_option("-b", "--blocksize", dest="blocksize", type=int, default=1024, | |
help="Specify blocksize", metavar="blocksize") |
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 itertools | |
import random | |
import string | |
import functools | |
# support functions | |
#Sample implementation of ireduce() |
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
echo "this is a text in engish written only to demonstrate the validity of this method in selecting the right language" > corpus_en | |
echo "questo è un testo in italiano scritto solamente per dimostrare la validita di questo metodo nel selezionare il linguaggio voluto" > corpus_it | |
echo "questa è una prova di testo per testare la versione italiana" > test | |
(echo `cat corpus_en test | gzip | wc -c` en; echo `cat corpus_it test | gzip | wc -c` it) | sort -n | head -1 | |
echo "this is a test for the english version"> test | |
(echo `cat corpus_en test | gzip | wc -c` en; echo `cat corpus_it test | gzip | wc -c` it) | sort -n | head -1 |
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 inspect | |
REGISTRY = [] | |
CACHE = {} | |
def offline_runner(): | |
for fn, kwargs in REGISTRY: | |
#print "OFFLINE", fn, kwargs | |
CACHE[(fn, str(kwargs))] = fn(**kwargs) |
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 os | |
import dbm | |
import json | |
import uuid | |
print("BaKKit up") | |
try: | |
op = sys.argv[1] |
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 sys | |
from PySide.QtCore import QObject, Slot, QTimer | |
from PySide.QtGui import QApplication | |
from PySide.QtWebKit import QWebView, QWebPage | |
import logging | |
html = """ | |
<html> | |
<body> |
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 sys | |
from PySide.QtCore import QObject, Slot, QTimer, Qt | |
from PySide.QtGui import QApplication, QWidget, QSplitter, QVBoxLayout, QShortcut, QKeySequence | |
from PySide.QtWebKit import QWebView, QWebSettings, QWebInspector | |
html = """ | |
<html> | |
<body> | |
<h1>Hello!</h1><br> |
OlderNewer