Skip to content

Instantly share code, notes, and snippets.

View vsimko's full-sized avatar
💭
building stuff

Viliam Simko vsimko

💭
building stuff
View GitHub Profile
// sending-a-file-as-multipart-through-xmlhttprequest
https://stackoverflow.com/questions/9395911/sending-a-file-as-multipart-through-xmlhttprequest
// change the id `USE-YOUR-ID`
const img = document.getElementById('USE-YOUR-ID');
// extracts image data from <img> element through canvas
const canvas = document.createElement('canvas');
// Created by Viliam Simko
// using the example from https://github.com/Sneko/node-openalpr.git
const openalpr = require("node-openalpr")
const fs = require('fs')
async function identify(path) {
return new Promise((resolve, reject) => {
openalpr.IdentifyLicense(path, (error, output) =>
error
# show whole messages as formatted JSON
curl -s https://stream.wikimedia.org/v2/stream/recentchange | grep data | sed 's/^data: //g' | jq .
# show only title and comment
curl -s https://stream.wikimedia.org/v2/stream/recentchange | grep data | sed 's/^data: //g' | jq '{title:.title, comment:.comment}'
@vsimko
vsimko / RemoteIteratorWrapper.scala
Created August 30, 2017 23:06 — forked from timvw/RemoteIteratorWrapper.scala
scala wrapper for hadoop remote iterator
import org.apache.hadoop.fs.RemoteIterator
/**
* Converts RemoteIterator from Hadoop to Scala Iterator that provides all the familiar functions such as map,
* filter, foreach, etc.
*
* @param underlying The RemoteIterator that needs to be wrapped
* @tparam T Items inside the iterator
* @return Standard Scala Iterator
*/
myscatter_lower <- function(data,
point_color = "white",
border_color = NA,
point_size = 3) {
drawcell <- function(fx, fy, datax, datay) {
oldpar <- par(mar = c(0,0,0,0), bg = "white")
on.exit(par(oldpar), add = TRUE)
\makeatletter
\renewenvironment{thebibliography}[1]{
\section*{\refname}%
\@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}%
\list{\@biblabel{\@arabic\c@enumiv}}{
\leftmargin0pt
\@openbib@code
\usecounter{enumiv}
}%
\let\p@enumiv\@empty

How to install node-red:

mkdir mynodered
cd mynodered
yarn add --network-concurrency 1 node-red
./node_modules/.bin/node-red
# these libraries required corrplot 0.84, download from github
# install.packages("devtools")
# devtools::install_github("taiyun/corrplot")
library(raster)
library(corrplot)
citation("corrplot")
s <- stack("~/Work/biggis/data/data-julian/Auto150_georef.tif")
nlayers(s)
plot(s[[1]])
# install required packages
sudo apt install mplayer kafkacat
# create a separate dir for the frames
mkdir frames
cd frames
# download video to vid.avi
curl -o vid.avi "http://www.engr.colostate.edu/me/facil/dynamics/files/drop.avi"