This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import getopt | |
import sys | |
argv = sys.argv[1:] | |
opts, args = getopt.getopt(argv, 'x:y:') | |
# list of options tuple (opt, value) | |
print(f'Options Tuple is {opts}') | |
# list of remaining command-line arguments |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default class DeepDiffMapper { | |
static VALUE_CREATED = 'created' | |
static VALUE_UPDATED = 'updated' | |
static VALUE_DELETED = 'deleted' | |
static VALUE_UNCHANGED = 'unchanged' | |
static map(obj1, obj2, changedOnly = true) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
from http.server import BaseHTTPRequestHandler, HTTPServer | |
import logging | |
import sys | |
COLOR = "\033[1;32m" | |
RESET_COLOR = "\033[00m" | |
class S(BaseHTTPRequestHandler): | |
def _set_response(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Basic tuples | |
let myTuple: [ string, number, boolean? ]; | |
myTuple = [ 'test', 42 ]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Удалить словарь из списка: | |
thelist[:] = [d for d in thelist if d.get('id') != 2] | |
# Используя синтаксис thelist[:], мы можем сохранить ссылку на исходный список и избежать создания нового списка. | |
# Это может быть полезно, если переменная thelist уже используется в других частях кода, и вы хотите обновить ее содержимое. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://stackoverflow.com/questions/5651654/ffmpeg-how-to-split-video-efficiently - VIDEO SPLIT | |
time ffmpeg -v quiet -y -i input.ts -vcodec copy -acodec copy -ss 00:00:00 -t 00:30:00 -sn test1.mkv | |
time ffmpeg -v quiet -y -i input.ts -vcodec copy -acodec copy -ss 00:30:00 -t 01:00:00 -sn test2.mkv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* чтобы размыть под layer CSS (например, для модалок) */ | |
backdrop-filter: blur(7px); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
os.path.isfile("bob.txt") # Does bob.txt exist? Is it a file, or a directory? | |
os.path.isdir("bob") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from enum import Enum, auto | |
class Color(Enum): | |
RED = auto() | |
BLUE = auto() | |
GREEN = auto() | |
list(Color) # [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Binary request and save | |
# Request the profile picture of the OP: | |
response = requests.get("https://i.stack.imgur.com/iysmF.jpg?s=32&g=1") | |
with open("response.jpg", "wb") as f: | |
f.write(response.content) |
NewerOlder