Skip to content

Instantly share code, notes, and snippets.

View fortunto2's full-sized avatar

Rustam Salavatov fortunto2

View GitHub Profile
@protasovse
protasovse / model.py
Last active April 5, 2020 06:38
#python, #django, test model example
"""
Модели
"""
from django.db import models
from django.contrib.auth import get_user_model
class RecordManager(models.Manager):
def get_queryset(self):
return super().get_queryset().filter(deleted=False)
@50Bytes-dev
50Bytes-dev / Dockerfile
Last active June 7, 2022 22:19
ACME traefik get manual dns challenge
FROM traefik:v2.2
RUN touch acme.json
RUN chmod 600 acme.json
@darwing1210
darwing1210 / async_download_files.py
Last active March 12, 2024 04:42
Script to download files in a async way, using Python asyncio
import os
import asyncio
import aiohttp # pip install aiohttp
import aiofile # pip install aiofile
REPORTS_FOLDER = "reports"
FILES_PATH = os.path.join(REPORTS_FOLDER, "files")
def download_files_from_report(urls):
@Bahus
Bahus / json_schemed_field.py
Last active November 15, 2023 10:12
Django JSONField with Pydantic schema support
from functools import partial
import pydantic
import logging
from django.contrib.postgres.fields import JSONField
from typing import Type, Union, Tuple
from django.core.serializers.json import DjangoJSONEncoder
@fortunto2
fortunto2 / print.sh
Created May 26, 2018 20:12
Скрипт для печати текста в консоль, удобно для вставления рекурсивно из папки всех файлов в Word
#!/bin/bash
#argument extention
FEXT=$1
if [ $# -eq 0 ]
then
echo "No arguments, example: py"
exit 0
fi
@k06a
k06a / install-ffmpeg-with-h265.sh
Last active March 9, 2021 15:51
H265 with ffmpeg
# Installing ffmpeg with H265 support
brew tap varenc/ffmpeg
brew install varenc/ffmpeg/ffmpeg --with-fdk-aac --HEAD
# Installing mp4edit tool
brew install bento4
@windyinsc
windyinsc / ffmpeg-cheatsheet.md
Last active September 7, 2023 12:15 — forked from larvata/ffmpeg-cheatsheet.md
ffmpeg notes

ffmpeg Cheatsheet

  • Join TS Files
  • Convert TS to MP4
  • Download Online AES-128 Encrypted HLS video
  • Convert Video to GIF
  • Extract Audio and Convert it to MP3
  • Burn Subtitles into Video

Join TS Files

@vividvilla
vividvilla / mailer.py
Last active August 5, 2022 20:14
Mailer - Simple Python wrapper to send email via SMTP
from smtplib import SMTP # Use this for standard SMTP protocol (port 25, no encryption)
# from smtplib import SMTP_SSL as SMTP # This invokes the secure SMTP protocol (port 465, uses SSL)
from email.mime.text import MIMEText
class Email(object):
SMTP_CONFIG = dict(
server="your_smtp_server_hostname",
username="your_smtp_server_username",
password="your_smtp_server_password"
@KaiyangZhou
KaiyangZhou / knapsack.py
Last active February 12, 2022 17:21
Python Implementation of 0/1 Knapsack Algorithm Based on Dynamic Programming
import numpy as np
'''
------------------------------------------------
Use dynamic programming (DP) to solve 0/1 knapsack problem
Time complexity: O(nW), where n is number of items and W is capacity
------------------------------------------------
knapsack_dp(values,weights,n_items,capacity,return_all=False)
Input arguments:
@whi-tw
whi-tw / jobs.yml
Last active March 22, 2022 05:19
rclone python config wrapper
tasks:
- name: backup_something
local: "/path/to/sync"
remote: "memset_memstore:path/to/remote"
operation: sync
- name: backup_something_else
local: "/another/path/to/sync"
remote: "memset_memstore:another/path/to/remote"
operation: sync