Skip to content

Instantly share code, notes, and snippets.

View gormih's full-sized avatar
🧸
bear

Michael Alexeevich gormih

🧸
bear
View GitHub Profile
import zipfile
zip_ref = zipfile.ZipFile(current_zip_full_path, 'r')
extract_to = current_zip_full_path + '_temp'
zip_ref.extractall(extract_to)
zip_ref.close()
@gormih
gormih / postgresql_russian_unaccent_config.sql
Last active December 12, 2017 13:39
Create postgresql russian unaccent configuration
CREATE EXTENSION unaccent;
CREATE TEXT SEARCH CONFIGURATION russian_unaccent( COPY = russian );
ALTER TEXT SEARCH CONFIGURATION russian_unaccent
ALTER MAPPING FOR hword, hword_part, word
WITH unaccent, russian_stem;
# -*- coding: utf-8 -*-
import dns.resolver
from ipwhois import IPWhois
import warnings
def chek_yandex_security(host):
yandex_dns = ['77.88.8.7', '77.88.8.3']
resolver = dns.resolver.Resolver()
@gormih
gormih / MobSF REST API Python.py
Created October 8, 2019 14:06 — forked from ajinabraham/MobSF REST API Python.py
MOBSF REST API Python Requests Example
"""
MOBSF REST API Python Requests
"""
import json
import requests
from requests_toolbelt.multipart.encoder import MultipartEncoder
SERVER = "http://127.0.0.1:8000"
FILE = 'SAP/diva-beta.apk'
def s_p_s_result(my, enemy):
if my == enemy:
return 'Ничья'
elif (my, enemy) in [('Ножницы', 'Бумага'), ('Камень', 'Ножницы'), ('Бумага', 'Камень')]:
return 'Ты победил'
else:
return 'Я выиграл'
from django.conf import settings
import datetime
class LogIPCookies(object):
def __init__(self):
print(u'http ip log cookies init')
@staticmethod
def process_request(request):
ip = request.META['REMOTE_ADDR']
import psycopg2
import random
num_iterations = 1000
db = 'domains'
host = '127.0.0.1'
pwd = 'topsecretmegapassword'
conn = psycopg2.connect(database=db,
user=db,
password=pwd)
from django.core.management.base import BaseCommand, CommandError
from django.db import connection, connections
from django.db.utils import OperationalError
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('target_base', nargs='+', type=str)
# -*- coding: utf-8 -*-
import requests
from stem import Signal
from stem.control import Controller
import time
class TorSession(object):
@gormih
gormih / remove me from repositories.py
Last active September 2, 2020 14:16
Remove user from all repositories, exclude allowed owners.
from github import Github
def go_github():
allowed_acc = ['allowed_friend1', 'allowed_friend2', 'username']
account = Github("username", "password")
for repo in account.get_user().get_repos():
owner = repo.owner.login
if owner not in allowed_acc:
print(owner)
repo.remove_from_collaborators('username')