Skip to content

Instantly share code, notes, and snippets.

View kardeiz's full-sized avatar

Jacob Brown kardeiz

View GitHub Profile
@kardeiz
kardeiz / mlt.rs
Last active May 22, 2020 18:35
`MoreLikeThis` query for `tantivy`
use std::collections::{BinaryHeap, HashMap};
use tantivy::{
query::{BooleanQuery, BoostQuery, Occur, Query, TermQuery, Weight},
schema::{FieldType, IndexRecordOption, Schema, Term, Value},
tokenizer::{
BoxTokenStream, FacetTokenizer, PreTokenizedStream, StopWordFilter, TokenFilter, Tokenizer,
TokenizerManager,
},
Document, Searcher,
types {
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/javascript js;
application/atom+xml atom;
application/rss+xml rss;
FROM tomcat:7-jre8
RUN apt-get update
RUN apt-get install -y imagemagick
PassengerId Pclass Name Sex Age SibSp Parch Ticket Fare Cabin Embarked Survived
1 3 Braund, Mr. Owen Harris male 22 1 0 A/5 21171 7.25 S 0
2 1 Cumings, Mrs. John Bradley (Florence Briggs Thayer) female 38 1 0 PC 17599 71.2833 C85 C 1
3 3 Heikkinen, Miss. Laina female 26 0 0 STON/O2. 3101282 7.925 S 1
4 1 Futrelle, Mrs. Jacques Heath (Lily May Peel) female 35 1 0 113803 53.1 C123 S 1
5 3 Allen, Mr. William Henry male 35 0 0 373450 8.05 S 0
6 3 Moran, Mr. James male 0 0 330877 8.4583 Q 0
7 1 McCarthy, Mr. Timothy J male 54 0 0 17463 51.8625 E46 S 0
8 3 Palsson, Master. Gosta Leonard male 2 3 1 349909 21.075 S 0
9 3 Johnson, Mrs. Oscar W (Elisabeth Vilhelmina Berg) female 27 0 2 347742 11.1333 S 1
#!/bin/sh
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
cd $SCRIPTPATH
source /etc/init.d/functions
source ./.env
#[async]
pub fn extract_multipart(req: Request) -> err::Result<(String, HashMap<String, Vec<PathBuf>>, SaveDir)> {
use multipart::server::{Multipart};
use std::io::Cursor;
pub fn get_boundary(req: &Request) -> Option<String> {
fn get_boundary_mime(mime: &::hyper::mime::Mime) -> Option<String> {
use ::hyper::mime;
var Utils = {
waitForElem: function(selector, cb) {
var elem = $(selector);
if (elem.length) {
cb();
} else {
setTimeout(function() {
Utils.waitForElem(selector, cb);
}, 100);
}
var Utils = {
waitForElem: function(selector, cb) {
var elem = $(selector);
if (elem.length) {
cb();
} else {
setTimeout(function() {
Utils.waitForElem(selector, cb);
}, 100);
}
var Utils = {
waitForElem: function(selector, cb) {
var elem = $(selector);
if (elem.length) {
cb();
} else {
setTimeout(function() {
Utils.waitForElem(selector, cb);
}, 100);
}
@kardeiz
kardeiz / main.rs
Created August 4, 2017 19:14
hyper async + mysql async
extern crate hyper;
extern crate mysql_async as my;
extern crate net2;
extern crate tokio_core;
extern crate futures;
use std::net::SocketAddr;
use hyper::server::Service;
use hyper::server::Http;