Skip to content

Instantly share code, notes, and snippets.

View rezkam's full-sized avatar
🏠
Working from home

Rez rezkam

🏠
Working from home
View GitHub Profile
from functools import wraps
def simple_decorator(func):
def __wrapper(*args, **kwargs):
return func(*args, **kwargs)
return __wrapper
def with_wraps(func):
@wraps(func)
def __wrapper(*args, **kwargs):
package main
import (
"bytes"
"fmt"
"net"
"strings"
)
func main() {
package main
import (
"bytes"
"fmt"
"net"
"strings"
)
func main() {
@rezkam
rezkam / remove_twitter_favorites.py
Created May 13, 2019 23:14
Remove likes (favorite) from your tweets using twitter API (Working with Python 3.5+)
"""
Remove likes (favorite) from your tweets using twitter API
you need to install twitter-client for python to use this code:
pip install python-twitter ( more info https://github.com/bear/python-twitter)
to use this you need to generate authntication tokens for your account
find more info on (https://developer.twitter.com/en/docs/basics/authentication/guides/access-tokens)
"""
import asyncio
$ curl -i example.com/api/article/4
HTTP/1.1 200 OK
Date: Sat, 09 Aug 2018 16:09:50 GMT
Last-Modified: Sat, 02 Aug 2018 12:02:47 GMT
Content-Type: application/json
{
id: 4,
content: "Heres a blog article, it has lots of content...",
@rezkam
rezkam / decorator.py
Created January 28, 2018 06:14
decorator
from functools import wraps
def simple_decorator(func):
def __wrapper(*args, **kwargs):
return func(*args, **kwargs)
return __wrapper
def with_wraps(func):
@wraps(func)
def __wrapper(*args, **kwargs):
@rezkam
rezkam / crop_image.py
Last active February 12, 2016 23:19
Pillow Crop
from PIL import Image
img = Image.open("image_name.jpg")
if img.size[0] == 800:
new_size = (0, 0 , img.size[0] , img.size[1] - 24)
else:
new_size = (0, 0 , img.size[0] , img.size[1] - 12)
new_image = img.crop(new_size)
new_image.save("new_size_image.jpg")
@rezkam
rezkam / install-comodo-ssl-cert-for-nginx.rst
Last active January 29, 2016 14:13 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@rezkam
rezkam / axonsms_send.py
Created January 10, 2016 08:30
SMS Send Code for axonsms.com Webservice
'''
Python Sample Code for axonsms.com SMS Panel
Mohammad Reza Kamalifard mr.kamalifard@gmail.com
To Use this code you need to install suds from pip
$> pip install suds
@rezkam
rezkam / Itmard_git_alias.sh
Last active June 1, 2022 07:09
New git alias set of ITMARD
#itmard git alias v0.4
alias gis='git status'
alias gil='git log'
alias gull='git pull origin '
alias gica='git commit -a -m '
alias gush='git push origin '
alias granch='git branch '
alias gich='git checkout '
alias gif='git diff'
alias gifa='git fetch --all'