Skip to content

Instantly share code, notes, and snippets.

View lovasoa's full-sized avatar
🎯
Focusing

Ophir LOJKINE lovasoa

🎯
Focusing
View GitHub Profile
@cgsdev0
cgsdev0 / house_builder.sh
Created February 3, 2024 16:07
house builder pattern in bash
#!/usr/bin/env bash
function house_builder() {
# floors,rooms,has_garage
echo "0,0,0"
}
function set_field() {
local f r g
IFS=, read f r g
import * as Comlink from "https://unpkg.com/comlink/dist/esm/comlink.mjs";
Comlink.transferHandlers.set("WORKERSQLPROXIES", {
canHandle: obj => false,
serialize(obj) {
const { port1, port2 } = new MessageChannel();
Comlink.expose(obj, port1);
return [port2, [port2]];
},
deserialize: (port) => {
@ilblackdragon
ilblackdragon / seq2seq.py
Last active May 22, 2022 21:42
Example of Seq2Seq with Attention using all the latest APIs
import logging
import numpy as np
import tensorflow as tf
from tensorflow.contrib import layers
GO_TOKEN = 0
END_TOKEN = 1
UNK_TOKEN = 2
@lovasoa
lovasoa / partial-evaluation.js
Last active December 28, 2023 05:56
Partial-evaluation for javascript.
/** pe
* @argument f: the multiple-argument function to turn into a partially-evaluatable
* @returns : A single-argument function that applies its argument as the first argument of f, and returns the partially-evaluated function
* @exemple: pe((a,b)=>a+b)(9)(1) === 10
*/
function pe(f, context, args) {
if(!args) args = [];
if (args.length === f.length) return f.apply(context, args);
return function partial (a) {
var args_copy = args.concat.apply(args, arguments);
@t2ru
t2ru / fib.rs
Created September 16, 2015 23:20
generic fibonacci in rust
extern crate num;
//use std::num::One;
use num::traits::One;
use std::cmp::PartialOrd;
use std::ops::{Add, Sub};
fn fib<T>(n: T) -> T where
T: One + PartialOrd + Add<Output=T> + Sub<Output=T> + Clone {
if n < T::one() + T::one() {
@airawat
airawat / 00-MapSideJoinDistCacheTextFile
Last active February 21, 2021 19:05
Map-side join example - Java code for joining two datasets - one large (tsv format), and one with lookup data (text), made available through DistributedCache
This gist demonstrates how to do a map-side join, loading one small dataset from DistributedCache into a HashMap
in memory, and joining with a larger dataset.
Includes:
---------
1. Input data and script download
2. Dataset structure review
3. Expected results
4. Mapper code
5. Driver code
@lovasoa
lovasoa / README.markdown
Last active January 25, 2020 01:05
The dezoomify script is capable of grabbing images from a webpage containing a Zoomify viewer and automatically stitching the images with javascript and the HTML5 <canvas> element.

Dezoomify

Out of date

This gist is out of date The project now has a true git repository: https://github.com/lovasoa/dezoomify

Reassemble tiles of a zoomify-powered image

This script makes one downloadable image from an image viewable via a flash zoomify interface.

anonymous
anonymous / 3dpf_golb1.txt
Created December 14, 2010 16:02
Detailed deconstruction of small (99K) Zoomify file
================================================================
3dpf_golb1.pff 100,944 bytes
================================================================
================================================================
(Unknown) 136 bytes
================================================================
[ 0000h ] (Unknown) 136 bytes
0000h: 00000000 00000000 0000006A 00000000 ...........j....
0010h: 00000000 00000000 3FC90FDB 00000000 ........?É.Û....