Skip to content

Instantly share code, notes, and snippets.

View sae13's full-sized avatar

Saeb sae13

View GitHub Profile
function kutt
set API "5deD1GnnzAvAcp5updIjNvbnolj7jkEiI6~yi"
set mainDomain "https://69b.ir/"
set URL $mainDomain"api/v2/links"
set date (date "+%N")
set custom (string sub -l 6 $date)
if test $argv[2]
set custom $argv[2]
end
set newUrl $mainDomain$custom
@sae13
sae13 / ValaGenre.py
Last active December 29, 2020 17:15
#!/usr/bin/env python3
import concurrent.futures
import logging
import re
from sys import argv
if '-v' in argv:
logging.basicConfig(level=logging.DEBUG)
else:
logging.basicConfig(level=logging.INFO)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from telegram.ext import (Updater, CommandHandler, MessageHandler, Filters, RegexHandler, StringRegexHandler, BaseFilter)
from telegram import MessageEntity
import logging
group_admins = {}
# Enable logging
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)
@sae13
sae13 / php iran phone regex
Created July 7, 2020 16:54
رجکس شماره مبایل
<?php
$a = "9133917225";
$mobile_pattern = "/^(\s)*(\+98|0098|98|0)?(9\d{9})(\s*|$)/";
preg_match($mobile_pattern,$a,$matches);
if(sizeof($matches) === 5)
var_dump($matches[3]);
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
#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
@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');
@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:
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);
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",