Skip to content

Instantly share code, notes, and snippets.

View reganto's full-sized avatar

Morteza N. Selseleh reganto

View GitHub Profile
@reganto
reganto / omega.py
Last active September 19, 2022 10:17
Show image as thumbnail in Django admin change list (list view) and change form
# Django 3.2.15 LTS
# Project structure
#
# project/
# config/
# __init__.py
# settings.py
# urls.py
# asgi.py
@reganto
reganto / gist:c9db6c94340e1d0474883db1ce001367
Created June 16, 2022 08:37 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@reganto
reganto / pipuninst_all
Created April 7, 2022 10:23
pipuninst_all alias
# ~/.aliases
pipuninst_all='pip uninstall -y -r <(pip freeze)'
# ~/.zshrc or ~/.bashrc
source ~/.aliases
#!/bin/bash
while true
do
export DISPLAY=:0.0
battery_level=`cat /sys/class/power_supply/BAT0/capacity`
battery_status=`cat /sys/class/power_supply/BAT0/status`
if [ $battery_status = "Charging" ] && [ $battery_level -ge 85 ];
then
# kdialog --msgbox "Battery fully charged" 5 # for KDE
notify-send -u critical "Battery fully charged" # for Gnome
@reganto
reganto / captcha.py
Created April 6, 2020 06:18
A simple captcha with python
from random import choice
from operator import add, mul, sub
def captcha():
try_count = 0
while True:
numbers = [number for number in range(1, 5)]
operators_functions = [add, mul, sub]
operators_functions_litrals_map = {add: "+", mul: "*", sub: "-"}
@reganto
reganto / substitute.py
Created February 18, 2019 08:41
Substitute indices in Python strings
# substitute indices in Python strings
def substitute(entry, i, j):
entry = list(entry)
entry[i], entry[j] = entry[j], entry[i]
return ''.join(entry)
# call sample
@reganto
reganto / password.py
Created July 26, 2018 06:34
simple gen and hash password
import string
import random
import uuid
import hashlib
import os
def gen_password():
print("Gen Password . . .\n")
try:
password = input("Enter a password or Enter . to generate one :")