Skip to content

Instantly share code, notes, and snippets.

View realamirhe's full-sized avatar
👓

Amir.H Ebrahimi realamirhe

👓
View GitHub Profile
@realamirhe
realamirhe / DoG_filters.py
Last active July 12, 2020 04:52
Difference of Gaussian Filter with numpy
# http://fourier.eng.hmc.edu/e161/lectures/gradient/node9.html
"""
σ1 := width or std for first gussian distribution
σ2 := width or std for second gussian distribution
"""
def DoG(σ1, σ2, shape):
if (σ1 == 0 or σ2 == 0):
print("WARNING: Result Filter gonna be all zero. σ1 and σ2 must be non zero")
return np.zeros(shape)
@realamirhe
realamirhe / embed ltr between rtl in latex.py
Last active July 19, 2020 17:51
fix: major bug caused in replacement
import clipboard
paragraph = """
مجموعه دادگان بررسی شده که مورد پذیرش قرار نگرفتندcaltech101،cats_vs_dogs، caltech_birds2010، colorectal_histology، coil100، dmlabو DTD
برای سادگی و ادامه توضیحات نام گذاری‌ها را فارسی میکنیم
lfw (صورت‌های برچسب‌گذاری غرب (ص.ب.غ))، celeb_a ( مشهور الف )
توضیح کلی در مورد دو مجموعه مورد پذیرش بالاهر دو در منابع مجموعه دادگان tensorflow موجود هستند. اندازه (مشاهیرالف) تقریبا 8 برابر (ص.ب.غ) است پس در صورت انتخاب نیاز به منابع بیشتری برای مرحله‌ی آموزش داریم.
( صورت‌های برچسب‌گذاری‌شده غرب )
تصاویر برچسب گذاری‌شده که برای تشخیص تصویر در شرایط بدون قید بررسی شده‌اند.
نسخه‌ای که در دسترس هست نسخه ۰.۱.۰ است‌
تعداد ۱۳۲۳۳ داده در مجموعه آموزش موجود هست
@realamirhe
realamirhe / .env
Created April 30, 2021 06:28
configuring redis docker-compose.yml file using password from .env file
# redis
REDIS_PORT=6379
REDIS_PASSWORD=pass1234
@realamirhe
realamirhe / install Puppeteer with downloaded chrome-linux .md
Last active August 16, 2021 12:12
install puppteer with local chrome-linux installation file. (offline/without extra download)

When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API.

If you have chrome-linux.zip by chance here is instruction to get it into work

  1. PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1 yarn add puppeteer
  2. make a folder named .local-chromium in node_modules/puppeteer
  3. if you are in linux make another folder named linux-901912 in .local-chromium

version is the same as the version which you've downloaded chromimum e.g. in https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/901912/chrome-linux.zip

@realamirhe
realamirhe / flutter-installation.md
Last active October 5, 2021 17:55
Installing flutter in Ubuntu with sanctions

Installing flutter in Ubuntu with sanctions

  1. Install snap
  2. follow instruction of this youtube video

Notes:

install flutter with snap

@realamirhe
realamirhe / js.array.cheat-sheet.md
Last active October 26, 2021 16:44
Javascript array cheat sheet

Here is a list of array operations that you can review, such as blitz. From now on, we'll be working with these arrays.

const numbers: number[] = [0, 1, 2];
const alphabet: string[] = ['a', 'b', 'c'];

Indexing

@realamirhe
realamirhe / btree.ts
Created October 28, 2021 03:40
in-order BTree traversal in typescript with generators
// binary tree
interface INode {
left: INode | null;
value: number;
right: INode | null;
}
class BinaryTree {
public root: INode;
@realamirhe
realamirhe / conatenation.py
Created July 9, 2021 11:05
Extract audio from power point (pptx file) with ffmpeg in python
import os
PREFIX_LENGTH = len('media')
POSTFIX_LENGTH = len('.wma')
files = [file for file in os.listdir('.') if file.endswith('wma')]
files.sort(key=lambda string: int(string[PREFIX_LENGTH: -1*POSTFIX_LENGTH]))
count_of_files = len(files)
input_query = ' -i '.join(files)
@realamirhe
realamirhe / useUndoRedo.ts
Created October 28, 2021 13:33
undo redo react hook which don't cause re-render
import { useRef, useCallback } from 'react';
export const useUndoRedo = <T>() => {
const undoStack = useRef<T[]>([]);
const undoPointer = useRef(-1);
const add = useCallback((item: T) => {
const pointer = ++undoPointer.current;
undoStack.current.length = pointer;
undoStack.current[pointer] = item;
@realamirhe
realamirhe / tweet-crawler.js
Last active November 4, 2022 09:53
tweet client crawler
window.tweetsRef = {};
function debounceEvent(callback, time) {
let interval;
return () => {
clearTimeout(interval);
interval = setTimeout(() => {
interval = null;
callback(arguments);