Skip to content

Instantly share code, notes, and snippets.

View moaminsharifi's full-sized avatar
🎆
HARDCODE (not CORE)

Amin Sharifi moaminsharifi

🎆
HARDCODE (not CORE)
View GitHub Profile
@SamadiPour
SamadiPour / main.js
Last active February 5, 2024 10:18
ADSL TCI plan sorter
const planCards = document.querySelectorAll('#service-list .uk-card');
const cardDetails = [];
function convertPersianNumbersToEnglish(text) {
return text.replace(/[۰-۹]/g, (char) => String.fromCharCode(char.charCodeAt(0) - '۰'.charCodeAt(0) + '0'.charCodeAt(0)));
}
planCards.forEach(card => {
const title = convertPersianNumbersToEnglish(card.querySelector('.uk-card-title').textContent.trim());
const description = convertPersianNumbersToEnglish(card.querySelector('.uk-card-body p').textContent.trim());
@nainemom
nainemom / subtranslate.lua
Last active April 26, 2024 04:03
MPV script to translate current line of subtitle
-- Simple mpv script to translate subtitle using crow (online) or sdcv (offline) dictionaries.
-- INSTALLATION:
-- To install it, first install crow (https://crow-translate.github.io) and/or sdcv (http://dushistov.github.io/sdcv/) on your marchine with your favorite dicts and then,
-- copy this file to '~/.config/mpv/scripts/' (Linux) or '%AppData%\mpv\scripts\' (Windows).
-- sdcv help:
-- you can download offline dicts from http://download.huzheng.org/Quick/ (or anywhere else) and copy extracted dic folder to '~/.stardict/dic/'
-- CONFIGURATION:
local config = {
@homfarnam
homfarnam / gist:6542fed4aab9b4b3e3e28b75301cafea
Created June 16, 2020 05:22
show products prices only for users
function wootips_hide_price_add_cart_not_logged_in() {
if ( !is_user_logged_in() ) {
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
add_action( 'woocommerce_single_product_summary', 'wootips_print_login_to_see', 31 );
add_action( 'woocommerce_after_shop_loop_item', 'wootips_print_login_to_see', 11 );
}
Operation Pandas Time Modin Time Speedup
pd.read_csv('esea_master_dmg_demos.part1.csv') 8.38 3.22 2.6
pd.concat([df for _ in range(5)]) 3.56 0.041 86.83
df.groupby(by='wp_type') 0.00029 0.059 0.0049
df.fillna(value=0) 1.8 0.21 8.57
df.dropna() 1.24 1.71 0.73
df.count() 1.09 0.046 23.70
df.drop_duplicates() 7.68 13.38 0.57
df.describe() 1.30 4.69 0.28
df['seconds'].max() 0.015 0.26 0.058
@aishwarya-singh25
aishwarya-singh25 / hog.py
Created August 29, 2019 07:56
HOG feature Descriptor
#creating hog features
fd, hog_image = hog(resized_img, orientations=9, pixels_per_cell=(8, 8),
cells_per_block=(2, 2), visualize=True, multichannel=True)
@amrza
amrza / run.py
Last active April 11, 2024 07:14
How to write RTL(Arabic/Persian) text on images in python.
# Tested on Python 3.6.1
# install: pip install --upgrade arabic-reshaper
import arabic_reshaper
# install: pip install python-bidi
from bidi.algorithm import get_display
# install: pip install Pillow
from PIL import ImageFont
@wnasich
wnasich / outgoing_emails_with_sendgrid.sh
Last active March 23, 2022 16:52
Install outgoing email from Debian/Ubuntu system through SendGrid
$ sudo apt install postfix mailutils
# Choose host type 'No configuration'
$ sudo cp /usr/share/postfix/main.cf.debian /etc/postfix/main.cf
$ sudo vi /etc/postfix/main.cf
# Add lines below
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:apikey:paste_your_key_here
smtp_sasl_security_options = noanonymous
@Bonno
Bonno / mp4-to-wav
Created February 10, 2015 09:24
Convert mp4 to WAV with ffmpeg
ffmpeg -i <infile> -ac 2 -f wav <outfile>
@iros
iros / API.md
Created August 22, 2012 14:42
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method: