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, FileWriter} | |
/* | |
usage: | |
===== | |
:power // switch power mode on | |
:load repl.scala // load this file | |
ReplHistory.save // save history | |
*/ |
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
trait F[T] extends Function1[T, Boolean] { | |
def apply(t: T): Boolean | |
def &&(g: T => Boolean) = (a: T) => apply(a) && g(a) | |
def ||(g: T => Boolean) = (a: T) => apply(a) || g(a) | |
def ^ (g: T => Boolean) = (a: T) => apply(a) ^ g(a) | |
def unary_! = (a: T) => !apply(a) | |
} | |
implicit def toF[T](a: T => Boolean) = new F[T] { def apply(x: T) = a(x) } |
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 | |
// for i in $(seq 1 200000); do wget -nv -O "$i.html" "http://linkuj.cz/?id=show&viewnr=4&typ=0&par=$i"; done; | |
error_reporting(E_ALL); | |
$fs = glob("*.html"); | |
//$fs = array_slice($fs, 0, 1000); | |
function xpath($dom, $path) { |
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
val letters = Map( | |
'a' -> 1, 'é' -> 3, 'k' -> 1, 'r' -> 1, 'ů' -> 4, | |
'á' -> 2, 'ě' -> 3, 'l' -> 1, 'ř' -> 4, 'v' -> 1, | |
'b' -> 3, 'f' -> 5, 'm' -> 2, 's' -> 1, 'x' -> 10, | |
'c' -> 2, 'g' -> 5, 'n' -> 1, 'š' -> 4, 'y' -> 2, | |
'č' -> 4, 'h' -> 2, 'ň' -> 6, 't' -> 1, 'ý' -> 4, | |
'd' -> 1, 'i' -> 1, 'o' -> 1, 'ť' -> 7, 'z' -> 2, | |
'ď' -> 8, 'í' -> 2, 'ó' -> 7, 'u' -> 2, 'ž' -> 4, | |
'e' -> 1, 'j' -> 2, 'p' -> 1, 'ú' -> 5) withDefaultValue 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
<?php | |
$letters = array( | |
'a' => 1, 'é' => 3, 'k' => 1, 'r' => 1, 'ů' => 4, | |
'á' => 2, 'ě' => 3, 'l' => 1, 'ř' => 4, 'v' => 1, | |
'b' => 3, 'f' => 5, 'm' => 2, 's' => 1, 'x' => 10, | |
'c' => 2, 'g' => 5, 'n' => 1, 'š' => 4, 'y' => 2, | |
'č' => 4, 'h' => 2, 'ň' => 6, 't' => 1, 'ý' => 4, | |
'd' => 1, 'i' => 1, 'o' => 1, 'ť' => 7, 'z' => 2, | |
'ď' => 8, 'í' => 2, 'ó' => 7, 'u' => 2, 'ž' => 4, |
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 | |
$users = array(); | |
foreach (range(1, 897) as $page) { | |
$dom = new DOMDocument(); | |
@$dom->loadHtmlFile("http://www.czechiatwitter.com/?page=$page"); | |
$xpath = new DOMXPath($dom); | |
$res = $xpath->query('//strong/a'); | |
foreach ($res as $r) { $users[] = $r->nodeValue; } |
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
(def letters { | |
\a 1 \é 3 \k 1 \r 1 \ů 4 | |
\á 2 \ě 3 \l 1 \ř 4 \v 1 | |
\b 3 \f 5 \m 2 \s 1 \x 10 | |
\c 2 \g 5 \n 1 \š 4 \y 2 | |
\č 4 \h 2 \ň 6 \t 1 \ý 4 | |
\d 1 \i 1 \o 1 \ť 7 \z 2 | |
\ď 8 \í 2 \ó 7 \u 2 \ž 4 | |
\e 1 \j 2 \p 1 \ú 5 | |
}) |
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
// java api | |
import org.w3c.dom._ | |
import javax.xml.xpath._ | |
import javax.xml.parsers._ | |
val domFactory = DocumentBuilderFactory.newInstance | |
domFactory.setNamespaceAware(true) | |
val doc = domFactory.newDocumentBuilder.parse("boox.xml") |
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 org.ccil.cowan.tagsoup.Parser | |
import org.xml.sax.InputSource | |
import javax.xml.transform | |
import java.net.URL | |
val url = new URL("http://boards.4chan.org/b/") | |
val reader = new Parser | |
reader.setFeature(Parser.namespacesFeature, false) | |
reader.setFeature(Parser.namespacePrefixesFeature, false) |
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
SET NAMES utf8; | |
SET foreign_key_checks = 0; | |
SET time_zone = 'SYSTEM'; | |
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'; | |
CREATE TABLE `posts` ( | |
`uid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`chan` varchar(10) CHARACTER SET ascii COLLATE ascii_bin NOT NULL, | |
`board` varchar(10) CHARACTER SET ascii COLLATE ascii_bin NOT NULL, | |
`thread_id` bigint(20) unsigned NOT NULL, |