Skip to content

Instantly share code, notes, and snippets.

View Shaked's full-sized avatar

Shaked Klein Orbach Shaked

View GitHub Profile
@Shaked
Shaked / README.md
Created December 1, 2017 19:07
In this gist I will try to connect between OpenSeaDragon and KonvaJS. See history for more details

Description

In this gist I will try to connect between OpenSeaDragon and KonvaJS. See history for more details

I have copied OpenSeaDragon's FabricJS plugin implementation in order to create the same plugin for KonvaJS.

Up until now I have only created a working Konva Rect:

Buildkit Example
# Terminal 1
$ mkdir /tmp/buildkit-example
$ cd /tmp/buildkit-example
$ k3d cluster create buildkitexample
...
$ docker buildx create \
--driver kubernetes \
--name bkworker \
@Shaked
Shaked / mouseMovingLines.js
Created October 27, 2017 22:43
Create a horizontal & vertical lines attached to mouse move with KonvaJS
var mouseMovingLines = {
enabled: true,
drawn: false,
xaxisLine: null,
yaxisLine: null,
stage: null,
layer: null,
init: function(stage, layer, options) {
this.options = $.extend({
strokeColor: "#fff",
@Shaked
Shaked / CroppingTool.java
Last active August 9, 2022 03:56
Android Camera
public class CroppingTool {
private static final String TAG = "CroppingTool";
public static byte[] cropRect(
byte data[],
int previewTop,
int previewLeft,
int previewBottom,
int previewRight,
int gridRight,
from flask import abort, jsonify
app = Blueprint('app', __name__)
@app.route("/save/name/:name", methods['POST'])
def save_file(name):
service = create_service()
result = service.save_name(name)
if result:
return jsonify(result=result)
@Shaked
Shaked / kindle.meta.js
Last active June 27, 2022 22:56
Kindle Keywords Exporter
// ==UserScript==
// @name KindleKeywordsExporter
// @namespace https://kindle.amazon.com/your_highlights
// @version 0.0.8
// @downloadURL https://gist.github.com/raw/65e198dcda8784c557075b9b89265a16/kindle.user.js
// @updateURL https://gist.github.com/raw/65e198dcda8784c557075b9b89265a16/kindle.meta.js
// @description Helps exporting highlighted keywords from Kindle
// @include https://kindle.amazon.com/your_highlights
// @match https://kindle.amazon.com/your_highlights
// @grant GM_setValue
@Shaked
Shaked / buildkitd.toml-configMap.yaml
Last active October 28, 2021 21:42
Kubernetes continuous integration using BuildKit, buildx and docker regisrty
apiVersion: v1
kind: ConfigMap
data:
buildkitd.toml: |
debug = true
root = "/var/lib/buildkit"
# see https://github.com/docker/buildx/issues/516#issuecomment-771236525
[registry."{{ .Values.localRegistryMirror }}"]
http = true
insecure = true
@Shaked
Shaked / README.md
Last active August 31, 2021 22:59
Rancher server with multipass and k3s multi node environment on macOS
  1. Create a VM for rancher server:
multipass launch --name rancher-server --cpus 4 --mem 4g --disk 20g
multipass exec rancher-server -- bash -c "curl -sfL https://get.k3s.io | K3S_KUBECONFIG_MODE="644" sh -"
multipass exec rancher-server sudo cat /etc/rancher/k3s/k3s.yaml > ~/.kube/rancher-server.yaml
RANCHER_SERVER_IP=$(multipass info k3s | grep IPv4 | awk '{print $2}')
sed -i '' "s/127.0.0.1/${RANCHER_SERVER_IP}/"  ~/.kube/rancher-server.yaml
kubie ctx default
  1. brew install helm@3
@Shaked
Shaked / Example of Requests
Last active July 24, 2020 23:34
Facebook Messenger Platform Webhook Duplicated Messages Bug
sleep_2
TheProcess
blah answer from http request: hello from http request
FB REQUEST: {"object":"page","entry":[{"id":"1637124163250118","time":1510609445717,"messaging":[{"sender":{"id":"1522824674478341"},"recipient":{"id":"1637124163250118"},"timestamp":1510609444865,"message":{"mid":"mid.$cAAXQ9Ib_cmJl6JwoAVft1bfqtwNH","seq":622503,"text":"sleep_2"}}]}]}
Shaked
sleep_21
TheProcess
blah answer from http request: hello from http request
#!/usr/bin/env python
import cv2
import time
import skvideo.io
import time
#https://stackoverflow.com/questions/49138457/what-is-the-opposite-of-cv2-videowriter-fourcc
def decode_fourcc(cc):
return "".join([chr((int(cc) >> 8 * i) & 0xFF) for i in range(4)])