Skip to content

Instantly share code, notes, and snippets.

View shahinism's full-sized avatar
🌱
Shahining

Reza Khanipour shahinism

🌱
Shahining
View GitHub Profile
$ pip install --upgrade pip
Requirement already satisfied: pip in /usr/local/lib/python3.9/site-packages (21.1.1)
Collecting pip
Downloading pip-21.2.4-py3-none-any.whl (1.6 MB)
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 21.1.1
Uninstalling pip-21.1.1:
Successfully uninstalled pip-21.1.1
Successfully installed pip-21.2.4
[tool.poetry]
name = "-"
version = "0.1.0"
description = "-"
authors = ["[email protected]"]
[[tool.poetry.source]]
name = "carnext"
url = "https://nexus.carnext.io/repository/python/simple"
secondary = true
@shahinism
shahinism / docker-compose.yml
Created January 30, 2020 13:48
PHP development on docker
# This compose is aimed to be self contained to run PHP applications
# I was using it to contribute on development of a WordPress website
version: '3'
services:
web:
restart: always
image: nginx:latest
volumes:
@shahinism
shahinism / requirements.txt
Created June 19, 2019 12:51
A simple script to extract codinghorror's content as text
atoma==0.0.15
attrs==19.1.0
backcall==0.1.0
certifi==2019.6.16
chardet==3.0.4
cssselect==1.0.3
decorator==4.4.0
defusedxml==0.6.0
entrypoints==0.3
fancycompleter==0.8
@shahinism
shahinism / header.tex
Created March 18, 2019 15:03
Convert .epub documents to eye friendly PDF
\usepackage[Latin,Mathematics,NumberForms,Punctuation,Symbols]{ucharclasses}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{Georgia}
\setsansfont[Ligatures=TeX]{Georgia}
\newfontfamily{\mydefaultfont}{Symbola}
\newfontfamily{\mymainfont}{Georgia}
\setTransitionsForSymbols{\mydefaultfont}{\mymainfont}
@shahinism
shahinism / flask.graphql.sentry.middleware.py
Last active September 14, 2018 06:38
Capture exceptions on sentry when using Flask-GraphQL
# By default Flask-GraphQL will handle all exceptions
# by showing a proper error message on the api.
from factory import sentry
from utils.logger import logger
class SentryMiddleware(object):
@classmethod
def on_error(cls, error):
@shahinism
shahinism / discourse_sso.py
Last active June 13, 2018 14:49
Handeling Discourse SSO using Python 3
# Sources:
# 1. https://meta.discourse.org/t/using-discourse-as-a-sso-provider/32974
# 2. https://meta.discourse.org/t/official-single-sign-on-for-discourse-sso/13045
import hmac
import hashlib
import random
import base64
from urllib import parse
@shahinism
shahinism / get_map.py
Last active August 22, 2021 21:35
US State ZipCode Map
#!/usr/bin/env python
# This is code a quick hack to extract resulted json format from
# phaster.com for a project
import json
import re
from collections import defaultdict
import requests
@shahinism
shahinism / AESCipher.py
Last active October 17, 2017 14:05 — forked from swinton/AESCipher.py
Encrypt & Decrypt using PyCrypto AES 256From http://stackoverflow.com/a/12525165/119849
import base64
from Crypto import Random
from Crypto.Cipher import AES
class AESCipher:
def __init__(self, key):
"""Key length should be of size 16, 24 or 32 based on AES function description
(eg. len(key) == 32 will provide AES256)

Keybase proof

I hereby claim:

  • I am shahinism on github.
  • I am shahinism (https://keybase.io/shahinism) on keybase.
  • I have a public key whose fingerprint is 39F1 2921 D7BE 8B5A 595A 0AFD DD79 65DB 9BC6 9149

To claim this, I am signing this object: