Skip to content

Instantly share code, notes, and snippets.

View leviyehonatan's full-sized avatar

Yehonatan Levi leviyehonatan

View GitHub Profile
@leviyehonatan
leviyehonatan / component.dart
Last active December 11, 2023 14:39
uploading parallel with status
void _process() async {
final uuid = Uuid();
final random = uuid.v4();
final outputFilename =
"${(await getTemporaryDirectory()).path}/$random.png";
await compute(stitch, [widget.images, outputFilename]);
setState(() {
_outputFilename = outputFilename;
});
img.Image? output = await img.decodeImageFile(outputFilename);
@leviyehonatan
leviyehonatan / pinDirectory.js
Created September 1, 2022 09:29
pin to ipfs using mypinata a complete directory
require("dotenv").config();
const fs = require("fs");
const FormData = require("form-data");
var rfs = require("recursive-fs");
const basePathConverter = require("base-path-converter");
const got = require("got");
const pinDirectoryToPinata = async (src) => {
const url = `https://api.pinata.cloud/pinning/pinFileToIPFS`;
var status = 0;
suspend fun syncResults(progress: (message: String) -> Unit) {
val directory = resultsDirectory
val files = directory.listFiles()
if (files.size == 0) return
progress("starting results sync")
files.map {
ioScope.launch {
progress("uploading planogram $it")
val jsonString = it.readText()
@leviyehonatan
leviyehonatan / YoloObjectDetection.kt
Last active March 13, 2021 16:38
kotlin singleton
class YoloObjectDetection private constructor(context: Context) {
companion object {
@Volatile private var INSTANCE: YoloObjectDetection? = null
fun getInstance(context: Context): YoloObjectDetection =
INSTANCE ?: synchronized(this) { INSTANCE ?: YoloObjectDetection(context).also { INSTANCE = it}}
}
}
import React, { useEffect, useState, useCallback, useRef } from 'react';
import Axios from 'axios';
import WaveformCanvas from './WaveformCanvas';
import Timeline from './Timeline';
import { useAnimationFrame } from '../../helpers/helper';
import { useKeyPress } from '../../hooks/keyPressHooks';
export default function Waveform({ src }) {
const audioContextRef = useRef();
const audioBufferRef = useRef();
import React, { useEffect, useState, useRef } from "react";
import WaveSurfer from "wavesurfer.js";
import TimeLine from "wavesurfer.js/dist/plugin/wavesurfer.timeline";
import MyTimeLine from "./wavesurfer.markers";
import { useKeyPress } from "./keyPressHooks";
import SoundTouch from "./soundtouch";
const ZOOM_RANGE = {
min: 20,
max: 200
import React, { useState } from 'react';
import { Form, Header, Segment, Dropdown, Label, Button } from 'semantic-ui-react';
import { Query, Mutation } from 'react-apollo';
import gql from 'graphql-tag';
import MembersSelectionBox from './MembersSelectionBox';
export default ({ id, onSaved }) => {
const [name, setName] = useState();
return (
<Segment>
@leviyehonatan
leviyehonatan / docker-compose.yml
Last active February 7, 2019 13:35
dayzz dockerized
version: "3"
services:
server:
image: node:8
volumes:
- ./:/app
working_dir: /app
depends_on:
- mongo
environment:
@leviyehonatan
leviyehonatan / app_v2.js
Last active January 29, 2019 18:22
my problem with flatlist overflow
import {Animated, Dimensions, NativeModules, Platform, StyleSheet} from 'react-native';
import {formStyle} from './forms';
import {FEED} from './app';
import DeviceInfo from 'react-native-device-info';
import * as config from '../config';
const { StatusBarManager } = NativeModules;
const WIDTH = Dimensions.get('window').width;
const HEIGHT = Dimensions.get('window').height;
fun setExactAlarm(type: Int, triggerAtMillis: Long, operation: PendingIntent ) {
if (Build.VERSION.SDK_INT >= 23)
alarmManager.setExactAndAllowWhileIdle(type, triggerAtMillis, operation)
else if (Build.VERSION.SDK_INT >= 19)
alarmManager.setExact(type, triggerAtMillis, operation)
else
alarmManager.set(type, triggerAtMillis, operation)
}
setExactAlarm(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + (1000 * notification.active_after),