This file contains hidden or 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
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
This file contains hidden or 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
| Windows host: | |
| cp C:\Users\anton\.ssh\id_rsa.pub C:\Users\anton\authorized_keys | |
| cd C:\Users\anton\ | |
| scp authorized_keys [email protected]:~/.ssh | |
| Ubuntu host: | |
| service ssh status Start sshd if necessary | |
| mkdir ~/.ssh/ | |
| chmod 700 ~/.ssh | |
| chmod 600 ~/.ssh/authorized_keys |
This file contains hidden or 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
| credential.helper=osxkeychain | |
| init.defaultbranch=master | |
| user.name=Anton Petrov | |
| [email protected] | |
| user.signingkey=/Users/anton/.ssh/id_ed25519.pub | |
| core.pager=delta | |
| core.editor=nano | |
| interactive.difffilter=delta --color-only | |
| delta.navigate=true | |
| delta.light=false |
This file contains hidden or 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
| #!/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 |
This file contains hidden or 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
| # 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 |
This file contains hidden or 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
| # 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 |
This file contains hidden or 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 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/ |
This file contains hidden or 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
| [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 |
This file contains hidden or 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 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 | |
| """ |
This file contains hidden or 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 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) |