Skip to content

Instantly share code, notes, and snippets.

View demdxx's full-sized avatar
:shipit:
infinity and beyond...

Dmitry Ponomarev demdxx

:shipit:
infinity and beyond...
View GitHub Profile
@demdxx
demdxx / mysql_cosine_similarity.sql
Created July 18, 2020 19:33
Cosine Similarity implementation in MySQL
-- for calculation of norm vector --
DELIMITER $$
CREATE FUNCTION vector_norm( vector JSON )
RETURNS DOUBLE
READS SQL DATA
DETERMINISTIC
BEGIN
DECLARE array_length INTEGER(11);
DECLARE retval DOUBLE(19,2);
#!/usr/bin/env sh
if [ "$#" -ne 3 ]; then
echo "use: gmv <source_dir> <file_name> <new_file_name>" >&2
exit 1
fi
seqname=`echo 's/\/'$2'$/'$3'/'`
find $1 -type f -name $2 | while read fn; do mv -v "${fn}" "`echo "${fn}" | sed -e "$seqname"`"; done
/**
* Prepare android resource files
*
* @copyright Dmitry Ponomarev <[email protected]> 2014
*
* Files: <src_dir>/file_name_<dpi_dir>.<ext> => <dst_dit>/<dpi_dir>file_name.<ext>
*/
package main
using System;
using System.IO;
namespace MonoCache.Android
{
public class SeekableBufferedStream : Stream
{
private long _BufferOffset = 0;
private long _Position = 0;
private long _BufferSize = 0;