Skip to content

Instantly share code, notes, and snippets.

View shriphani's full-sized avatar

Shriphani Palakodety shriphani

View GitHub Profile
@sids
sids / html_parser.clj
Created May 6, 2010 05:44
HTML Parsing in Clojure using HtmlCleaner.
(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
@mnemnion
mnemnion / e-tree-seq.clj
Last active November 3, 2020 18:32
a tree-seq function for enlive style trees or graphs in clojure. Made for instaparse, may not fit all cases.
(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)))
@strezh
strezh / GStreamer-1.0 some strings.sh
Last active October 2, 2023 09:00
GStreamer-1.0 personal cheat sheet
#!/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 ! \
@shinmuro
shinmuro / mutable-deftype.clj
Last active January 5, 2021 22:10
Clojure deftype that has mutable field and setter method sample.
(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"))
@jesperborgstrup
jesperborgstrup / ec_lsag_test.py
Last active March 11, 2023 21:23
Python implementation of Linkable Ring Signatures over Elliptic curves
# 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,
@staltz
staltz / introrx.md
Last active May 24, 2024 07:56
The introduction to Reactive Programming you've been missing
@rolandshoemaker
rolandshoemaker / editor.rs
Created December 28, 2014 17:35
Drop to $VISUAL or $EDITOR to edit a String in rust (via temporary file)
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
};
@hrbrmstr
hrbrmstr / continents.json
Created January 22, 2015 01:01
Continents GeoJSON
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.