Skip to content

Instantly share code, notes, and snippets.

View kargaranamir's full-sized avatar
🕸️
Focusing

Amir Hossein Kargaran kargaranamir

🕸️
Focusing
View GitHub Profile
@kargaranamir
kargaranamir / commit.md
Created September 26, 2023 02:41
How to change a recent commit date.
  1. change GIT_COMMITTER_DATE variable:
export GIT_COMMITTER_DATE="Sat Sep 20 08:00:00 2023 +0000"
  1. then commit your changes! I use GitHub UI, it's much easier to handle some of the tasks. But don't push!
  2. git commit --amend --no-edit --date="$GIT_COMMITTER_DATE"
@kargaranamir
kargaranamir / selenium_gradio.md
Last active August 25, 2023 20:13
install selenium in gradio

Create a file named packages.txt in the root directory of Gradio, and insert the following content:

chromium-driver

By doing this, you will ensure the installation of the Chromium driver for Debian.

create a a file named requirements.txt in the root directory of Gradio, and insert the following content:

@kargaranamir
kargaranamir / selenium_colab.md
Last active August 25, 2023 20:13
install selenium in google colab
# install chromium and selenium
!apt update
!apt install chromium-chromedriver
!pip install selenium
from selenium import webdriver
from selenium.common.exceptions import WebDriverException
@kargaranamir
kargaranamir / common.sh
Created May 22, 2023 18:15
common commands
# remove empty folders in the current directory.
find . -type d -empty -delete
# flat folder in. folder
find . -type f -exec mv -i {} . \;
# delete other files that doesnot match:
find . ! -name "*-sentences.txt" -type f -delete
# grep over not txt:
@kargaranamir
kargaranamir / udhr.md
Created March 17, 2023 14:30
UDHR (Universal Declaration of Human Rights) dataset
@kargaranamir
kargaranamir / find.md
Created March 10, 2023 22:09
Recursively find all files that match a certain pattern

Find files with ./XXX/XXX.md pattern:

find . -regex '.*/*/[^/]*.md'

Find number of files with ./XXX/XXX.md pattern:

find . -regex '.*/*/[^/]*.md' -printf '%i\n' | wc -l
import csv
file = open('vocab_first_column_persian_second_column_english')
csvreader = csv.reader(file)
start_b = "آ"
for header in csvreader:
start_a = header[0].strip()[0]
if start_a !=start_b:
@kargaranamir
kargaranamir / Google_colab_python3_9_or_python3_10.ipynb
Last active January 3, 2023 15:05
Use different version of Python in Google Colab (Python 3.9 or Python 3.10)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kargaranamir
kargaranamir / cispa-prof-pellegrino-challenge.ipynb
Last active February 2, 2023 18:24
cispa-prof-pellegrino-challenge.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kargaranamir
kargaranamir / screen-resolution.md
Created June 14, 2022 08:56
Desktop, Mobile, Tablet, Console Screen Resolution Data From https://gs.statcounter.com/screen-resolution-stats
[{'height': '2340', 'width': '1080', 'xusage': ['Mobile', 'Console']},
 {'height': '1920', 'width': '1080', 'xusage': ['Mobile']},
 {'height': '1440', 'width': '2560', 'xusage': ['Desktop', 'Console']},
 {'height': '1366', 'width': '1024', 'xusage': ['Tablet', 'Desktop']},
 {'height': '1280', 'width': '800', 'xusage': ['Tablet']},
 {'height': '1280', 'width': '720', 'xusage': ['Mobile']},
 {'height': '1200', 'width': '1920', 'xusage': ['Desktop']},
 {'height': '1194', 'width': '834', 'xusage': ['Tablet']},
 {'height': '1152', 'width': '2048', 'xusage': ['Desktop']},