(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
(ns in.grok.history.html-parser | |
(:require [clojure.contrib.logging :as log]) | |
(:import [org.htmlcleaner HtmlCleaner] | |
[org.apache.commons.lang StringEscapeUtils])) | |
(defn parse-page | |
"Given the HTML source of a web page, parses it and returns the :title | |
and the tag-stripped :content of the page. Does not do any encoding | |
detection, it is expected that this has already been done." | |
[page-src] |
;; in reply to http://www.sids.in/blog/2010/05/06/html-parsing-in-clojure-using-htmlcleaner/ | |
(ns html-parser | |
(:require [net.cgrand.enlive-html :as e])) | |
(defn parse-page | |
"Given the HTML source of a web page, parses it and returns the :title | |
and the tag-stripped :content of the page. Does not do any encoding | |
detection, it is expected that this has already been done." | |
[page-src] | |
(-> page-src java.io.StringReader. e/html-resource |
import numpy as np | |
from scipy import linalg | |
from sklearn.utils import array2d, as_float_array | |
from sklearn.base import TransformerMixin, BaseEstimator | |
class ZCA(BaseEstimator, TransformerMixin): | |
def __init__(self, regularization=10**-5, copy=False): | |
self.regularization = regularization |
(defn e-tree-seq | |
"tree-seqs enlive trees/graphs, at least instaparse ones" | |
[e-tree] | |
(if (map? (first e-tree)) | |
(tree-seq (comp seq :content) :content (first e-tree)) | |
(tree-seq (comp seq :content) :content e-tree))) |
#!/bin/bash | |
# play YUV444 FULL HD file | |
gst-launch-1.0 -v filesrc location=size_1920x1080.yuv ! \ | |
videoparse width=1920 height=1080 framerate=25/1 format=GST_VIDEO_FORMAT_Y444 ! \ | |
videoconvert ! \ | |
autovideosink | |
# play YUV422 FULL HD file | |
gst-launch-1.0 -v filesrc location=size_1920x1080.yuv ! \ |
(defprotocol IEditName | |
(get-name [this]) | |
(set-name! [this val])) | |
(deftype PersonName [^:volatile-mutable lname] | |
IEditName | |
(get-name [this] (. this lname)) | |
(set-name! [this val] (set! lname val))) | |
(def pname (PersonName. "hoge")) |
# MIT License | |
# | |
# Copyright (C) 2014 Jesper Borgstrup | |
# ------------------------------------------------------------------- | |
# Permission is hereby granted, free of charge, to any person | |
# obtaining a copy of this software and associated documentation | |
# files (the "Software"), to deal in the Software without restriction, | |
# including without limitation the rights to use, copy, modify, merge, | |
# publish, distribute, sublicense, and/or sell copies of the Software, | |
# and to permit persons to whom the Software is furnished to do so, |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
extern crate libc; | |
use std::io::{File, Open, ReadWrite, TempDir, Command, SeekSet}; | |
use std::io::process::{InheritFd}; | |
use std::os; | |
pub use self::libc::{ | |
STDIN_FILENO, | |
STDOUT_FILENO, | |
STDERR_FILENO | |
}; |