Skip to content

Instantly share code, notes, and snippets.

View mahenzon's full-sized avatar

Suren Khorenyan mahenzon

View GitHub Profile
@mahenzon
mahenzon / py-pattern-matching.ipynb
Created April 9, 2023 17:20
Python Pattern Matching
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mahenzon
mahenzon / main.ipynb
Last active April 15, 2023 17:36
SOLID Principles Python examples
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mahenzon
mahenzon / main.ipynb
Created March 26, 2023 18:17
Python compare timeit vs time and use perf_counter
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mahenzon
mahenzon / main.ipynb
Created February 27, 2023 19:48
Python timeit example w/ or w/o elif/else
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mahenzon
mahenzon / whisper-cpp-setup-mac.md
Last active February 11, 2023 21:47
Как установить и настроить Whisper на mac, чтобы выполнять транскрипцию аудио

Установка

Скачиваем https://github.com/ggerganov/whisper.cpp

По-простому это нажать Code и выбрать Download ZIP

По-нормальному это скачать через git:

  • нажать Code и скопировать ссылку
  • в терминале сделать git clone {вставить ссылку}
@mahenzon
mahenzon / database-local-dump.sql
Created January 25, 2022 20:33
MySQL Database dump for demo purposes
-- MySQL dump 10.13 Distrib 8.0.27, for macos11.6 (arm64)
--
-- Host: 127.0.0.1 Database: blog_app
-- ------------------------------------------------------
-- Server version 5.5.5-10.6.5-MariaDB-1:10.6.5+maria~focal
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8mb4 */;
@mahenzon
mahenzon / .gitlab-ci.yml
Created January 9, 2022 08:35
GitLab CI multistage
.build-and-push-multistage:
stage: build-and-push
image: docker:20.10.7-dind
variables:
# space separated
services: app-build app-prod
# pull / push in this number of parallel jobs
parallelism: 2
before_script:
- apk add --no-cache docker-compose
@mahenzon
mahenzon / main.py
Created November 23, 2021 18:13
Python + gspread demo
import string
from pprint import pprint
import gspread
from gspread import Cell, Client, Spreadsheet, Worksheet
from gspread.utils import rowcol_to_a1
import requests
SPREADSHEET_URL = "https://docs.google.com/spreadsheets/d/.../"
@mahenzon
mahenzon / gspread-demo.py
Last active November 23, 2021 07:02
Python + gspread small demo
"""
gspread demo
gspread==4.0.1
requests==2.26.0
"""
import string
from pprint import pprint
@mahenzon
mahenzon / aws-get-ip-ranges-for-region.py
Created April 2, 2021 10:24
Get AWS IP ranges for region
import requests
ip_ranges = requests.get('https://ip-ranges.amazonaws.com/ip-ranges.json').json()['prefixes']
amazon_ips = set()
ec2_ips = set()
for item in ip_ranges:
if item['region'] != 'eu-west-1':