Skip to content

Instantly share code, notes, and snippets.

View sae13's full-sized avatar

Saeb sae13

View GitHub Profile
@sae13
sae13 / fontStyle.css
Last active November 10, 2018 21:42
@font-face {
font-family: Sahel;
src: url('https://cdn.rawgit.com/rastikerdar/sahel-font/5d124266/dist/Farsi-Digits/Sahel-FD.eot');
src: url('https://cdn.rawgit.com/rastikerdar/sahel-font/5d124266/dist/Farsi-Digits/Sahel-FD.eot?#iefix') format('embedded-opentype'),
url('https://cdn.rawgit.com/rastikerdar/sahel-font/5d124266/dist/Farsi-Digits/Sahel-FD.woff') format('woff'),
url('https://cdn.rawgit.com/rastikerdar/sahel-font/5d124266/dist/Farsi-Digits/Sahel-FD.ttf') format('truetype');
font-weight: normal;
}
@font-face {
#!/usr/bin/env python3
from subprocess import run, getoutput
from time import sleep
from pytg.sender import Sender
dlDir = "/tmp/es6/dl"
sentDir = "/tmp/es6/sent"
sender = Sender('localhost',6670)
to = "$050000007d208f3f0115b300fb607ab4"
ls = getoutput('find {} -name "*.*"'.format(dlDir)).splitlines()
@sae13
sae13 / JobRunOnce.py
Created June 1, 2018 13:05
python-telegram-bot job run_once example
from telegram.ext import Updater, Dispatcher, Job, CommandHandler
import logging
# Enable logging
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)
logger = logging.getLogger(__name__)
def error(bot, update, error):
"""Log Errors caused by Updates."""
@font-face {
font-family: Sahel;
src: url('https://cdn.jsdelivr.net/gh/rastikerdar/sahel-font@latest/dist/Farsi-Digits/Sahel-FD.eot');
src: url('https://cdn.jsdelivr.net/gh/rastikerdar/sahel-font@latest/dist/Farsi-Digits/Sahel-FD.eot?#iefix') format('embedded-opentype'),
url('https://cdn.jsdelivr.net/gh/rastikerdar/sahel-font@latest/dist/Farsi-Digits/Sahel-FD.woff') format('woff'),
url('https://cdn.jsdelivr.net/gh/rastikerdar/sahel-font@latest/dist/Farsi-Digits/Sahel-FD.ttf') format('truetype');
font-weight: normal;
}
@font-face {
from openpyxl import load_workbook
from openpyxl.worksheet.worksheet import Worksheet
from requests import get
xlsxFileAddress = "/home/saeb/PycharmProjects/SendSMS/xlsx/139804.xlsx" #xlsx file
def sendToSMSCenter(phone="09133917225", text="سلام دنیا"):
params = {
"from": "+98100020400",
public static void getUserName(String xlsLocation) throws IOException {
FileInputStream file = new FileInputStream( new File(xlsLocation));
Workbook workbook = new XSSFWorkbook(file);
Sheet sheet = workbook.getSheetAt(0);
for(Row row: sheet)
{
Cell tenCell = row.getCell(0);
tenCell.setCellType(CellType.STRING);
Cell sixCell = row.getCell(1);
sixCell.setCellType(CellType.STRING);
@sae13
sae13 / awk
Last active November 25, 2019 11:55
bash examples
ip a|awk '{if ($1 ~ /^[0-9]:/) print $1 ; if (/inet/) print $2}'
1:
127.0.0.1/8
::1/128
2:
172.16.6.164/24
fe80::681a:78de:211:28d2/64
3:
192.168.122.1/24
4:
@sae13
sae13 / wordpressTextDomainAction
Created March 10, 2020 16:42
load wordpress plugin text domain on init
{
load_plugin_textdomain('gflimitbyday',
false,
basename(dirname(__FILE__)) . '/languages');
}
add_action('init','gflimitbyday_add_languages');
#alias login "curl 'http://devapp01.icico.net.ir/oauth/token' -s -H 'Authorization: Basic U2FsZXM6cGFzc3dvcmQ=' -H 'Content-Type: application/x-www-form-urlencoded' --data 'grant_type=password&username=saeb&password=password'|jq '.access_token'"
#alias auth2 "echo \"Authorization: Bearer \" ( string replace -a '\"' '' (login))"
function nicico
set login (curl 'http://devapp01.icico.net.ir/oauth/token' -s -H 'Authorization: Basic U2FsZXM6cGFzc3dvcmQ=' -H 'Content-Type: application/x-www-form-urlencoded' --data 'grant_type=password&username=saeb&password=password'|jq '.access_token')
set auth2 (echo "Authorization: Bearer " ( string replace -a '"' '' $login))
# echo $login $auth2
curl -s -H $auth2 $argv
end
import django_filters
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from rest_framework import status
from rest_framework.generics import GenericAPIView
from rest_framework.mixins import ListModelMixin, RetrieveModelMixin, CreateModelMixin, DestroyModelMixin, \
UpdateModelMixin
from rest_framework.request import Request
from rest_framework.response import Response