Skip to content

Instantly share code, notes, and snippets.

View sudoguy's full-sized avatar
💤

Evgeny Kemerov sudoguy

💤
View GitHub Profile
@sudoguy
sudoguy / kinopub-subs-translate-ai.js
Last active May 23, 2025 13:55
Translation subtitles on kino.pub with Gemini AI
// ==UserScript==
// @name KinoPub Subtitle Downloader & Translator
// @namespace http://tampermonkey.net/
// @version 2.6 // Stricter Validation + Reduced Overlap
// @description Скачивание и перевод субтитров с KinoPub с помощью Google Gemini
// @author Your Name & AI Assistant
// @match *://kino.pub/*
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_xmlhttpRequest
@sudoguy
sudoguy / dbmodels.py
Last active February 5, 2019 08:25 — forked from deceptikon/dbmodels.py
"""SQLAlchemy db.Models."""
from flask import current_app as app
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
engine = create_engine(app.config["SQLALCHEMY_DATABASE_URI"])
@sudoguy
sudoguy / fnv64.py
Created March 6, 2018 10:04
FNV 64 hash python
def fnv64(val: str):
hval = 14695981039346656037
fnv_64_prime = 1099511628211
uint64_max = 2 ** 64
for s in val:
hval = hval ^ ord(s)
hval = (hval * fnv_64_prime) % uint64_max
return hval
@sudoguy
sudoguy / dropdb.py
Created September 17, 2015 10:06
Drop and recreate odoo database on python
import os
# replace <password> with your password
commands = ('echo <password> | sudo -S -u postgres psql -c "DROP DATABASE odoo;"',
'sudo -u postgres psql -c "CREATE DATABASE odoo;"',
'sudo -u postgres psql odoo -c "GRANT ALL privileges ON DATABASE odoo TO odoo;"',
'sudo -u postgres psql odoo -c "ALTER DATABASE odoo OWNER TO odoo;"')
for x in commands:
os.system(x)
@sudoguy
sudoguy / dropdb.sh
Created September 17, 2015 10:05
Drop and recreate odoo database
#! /bin/bash
# replace <password> with your password
echo <password> | sudo -u postgres psql -c "DROP DATABASE odoo;"
sudo -u postgres psql -c "CREATE DATABASE odoo;"
sudo -u postgres psql odoo -c "GRANT ALL privileges ON DATABASE odoo TO odoo;"
sudo -u postgres psql odoo -c "ALTER DATABASE odoo OWNER TO odoo;"