Skip to content

Instantly share code, notes, and snippets.

View anton-petrov's full-sized avatar
:octocat:
🥷

Anton Petrov anton-petrov

:octocat:
🥷
View GitHub Profile
@anton-petrov
anton-petrov / README.MD
Created August 8, 2021 08:14 — forked from RichardBronosky/README.MD
cb - A leak-proof tee to the clipboard - Unify the copy and paste commands into one intelligent chainable command.

cb

A leak-proof tee to the clipboard

This script is modeled after tee (see [man tee][2]) and works on Linux, macOS, Cygwin, WSL/WSL2

It's like your normal copy and paste commands, but unified and able to sense when you want it to be chainable.

This project started as an answer to the StackOverflow question: [How can I copy the output of a command directly into my clipboard?][3]

@anton-petrov
anton-petrov / generate-ssh-key.sh
Created September 14, 2021 10:32 — forked from denisgolius/generate-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/mozilla_rsa
@anton-petrov
anton-petrov / response_23462456245634
Last active October 4, 2021 08:38
ответ службы моделирования
{
"task_id": "f979ee5f-f23a-4781-b4d7-e650240ac867",
"task_status": "SUCCESS",
"client_id": "3da0118b-869e-48e0-aeee-bb6ebb2bd8f8",
"result": {
"items": [
{
"field_id": "134ad57e-35e7-49c6-86b2-ba61b4f77e2d",
"real_crop_id": "d9007491-9e9f-4dc5-81f3-c6aa4392dcc2",
"start_date": "2022",
@anton-petrov
anton-petrov / texteditor.py
Created November 23, 2021 14:23
Текстовый редактор на Tkinter
import tkinter as tk
from tkinter.filedialog import askopenfilename, asksaveasfilename
def open_file():
filepath = askopenfilename(
filetypes=[("Text Files", "*.txt"), ("All Files", "*.*")]
)
if not filepath:
return
txt_edit.delete(1.0, tk.END)
@anton-petrov
anton-petrov / centerline.py
Created December 8, 2021 12:53
Test centerline fork
import pickle
from shapely.geometry import Polygon
from centerline.geometry import Centerline
import time
def st_time(func):
"""
st decorator to calculate the total time of a func
"""
@anton-petrov
anton-petrov / JupyterHub.service
Last active February 28, 2022 09:18
Installing JupyterHub on Linux Ubuntu (Debian)
[Unit]
Description=JupyterHub
[Service]
Type=simple
Environment="PATH=/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/opt/anaconda3/bin"
ExecStart=/usr/bin/env jupyterhub --port=10001
User=root
Group=root
@anton-petrov
anton-petrov / uvicorn-gunicorn-fastapi.docker
Created May 12, 2022 09:10
Dockerfile for uvicorn + gunicorn + fastapi
FROM antonapetrov/uvicorn-gunicorn-fastapi:miniforge3.9
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get upgrade -y && apt-get install curl -y && apt-get clean
# For conda, uncomment if needed
# RUN conda update --all --yes
# RUN conda install -c conda-forge psycopg2=2.9.3 --yes && conda clean --all
WORKDIR /app/
@anton-petrov
anton-petrov / install_docker_buildx.sh
Created August 22, 2022 08:52
Install docker buildx plugin in Ubuntu 22.04
# See https://docs.docker.com/build/buildx/install/
mkdir -p $HOME/.docker/cli-plugins
wget -O $HOME/.docker/cli-plugins/docker-buildx https://github.com/docker/buildx/releases/download/v0.9.1/buildx-v0.9.1.linux-amd64
chmod +x $HOME/.docker/cli-plugins/buildx
@anton-petrov
anton-petrov / .zshrc
Last active August 24, 2022 15:05
My zshrc environment
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
@anton-petrov
anton-petrov / extend.sh
Created November 16, 2022 06:45
Resize llvm partition in Linux
#!/bin/bash
# This script will increse the size of the LVM disk partition so that you can take advantage of additional space after increasing the virtual
# disk size either through virtualbox, openstack, or some other virtualization tool
if [ -z "$1" ] ; then
echo "You must specify the disk device being extended, eg: /dev/sda or /dev/vda";
echo "Example Usage: ./extend-lvm.sh /dev/sda";
echo "Run 'fdisk -l' to see the existing devices and partitions. If there are more than one, this will also give you a clue as to which one has grown and needs to be modified";
exit 1
fi