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 / settings.json
Last active November 12, 2020 10:49
Windows Terminal
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"alwaysShowTabs": true,
"initialCols": 120,
"initialRows": 30,
"requestedTheme": "dark",
"keybindings": [
{
@anton-petrov
anton-petrov / pandas_to_sql.py
Created May 14, 2020 16:03
Пример сохранения (передачи) Pandas.DataFrame в MySQL
from sqlalchemy import create_engine
import mysql.connector
import pandas as pd
# CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country
customers = {
"CustomerID" : [1, 2, 3, 4, 5],
"CustomerName" : ["Alfreds Futterkiste", "Ana Trujillo Emparedados y helados", "Antonio Moreno Taquería", "Around the Horn", "Ilya Tikhonov"],
"ContactName" : ["Maria Anders", "Ana Trujillo", "Antonio Moreno", "Thomas Hardy", "Anton Petrov"],
"Address" : ["Obere Str. 57", "Avda. de la Constitución 2222", "Mataderos 2312", "120 Hanover Sq.", "Dolgoprudnyi"],
pip install jupyter_http_over_ws
jupyter serverextension enable --py jupyter_http_over_ws
jupyter notebook --NotebookApp.allow_origin='https://colab.research.google.com' --port=8888 --NotebookApp.port_retries=0
@anton-petrov
anton-petrov / actual_time_in_linux.sh
Created August 8, 2020 12:13
Update time in GNU/Linux OS to actual state.
sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z"
@anton-petrov
anton-petrov / heartbeat.py
Created September 4, 2020 12:58
Пульс по вебкамере
# https://habr.com/ru/post/517424/
import cv2
import io
import time
import numpy as np
from matplotlib import pyplot as plt
@anton-petrov
anton-petrov / home-brew_m1.sh
Created December 24, 2020 04:38
Homebrew for Apple M1
# We'll be installing Homebrew in the /opt directory.
cd /opt
# Create a directory for Homebrew. This requires root permissions.
sudo mkdir homebrew
# Make us the owner of the directory so that we no longer require root permissions.
sudo chown -R $(whoami) /opt/homebrew
# Download and unzip Homebrew. This command can be found at https://docs.brew.sh/Installation.
@anton-petrov
anton-petrov / python_environment_setup.md
Created December 30, 2020 05:44 — forked from wronk/python_environment_setup.md
Setting up your python development environment (with pyenv, virtualenv, and virtualenvwrapper)

Overview of Python Virtual Environments

This guide is targetted at intermediate or expert users who want low-level control over their Python environments.

When you're working on multiple coding projects, you might want a couple different version of Python and/or modules installed. This helps keep each workflow in its own sandbox instead of trying to juggle multiple projects (each with different dependencies) on your system's version of Python. The guide here covers one way to handle multiple Python versions and Python environments on your own (i.e., without a package manager like conda). See the Using the workflow section to view the end result.


h/t @sharkinsspatial for linking me to the perfect cartoon

@anton-petrov
anton-petrov / App Indicator
Created January 26, 2021 04:18
App Indicator
https://extensions.gnome.org/extension/615/appindicator-support/
@anton-petrov
anton-petrov / winfonts.sh
Created January 27, 2021 16:46
Install Windows fonts in Fedora
sudo dnf install curl cabextract xorg-x11-font-utils fontconfig
sudo rpm -i https://downloads.sourceforge.net/project/mscorefonts2/rpms/msttcore-fonts-installer-2.6-1.noarch.rpm
sudo fc-cache -v
@anton-petrov
anton-petrov / settings.json
Last active July 30, 2021 09:20
Settings for Windows Terminal
{
"$schema": "https://aka.ms/terminal-profiles-schema",
// Add custom actions and keybindings to this array.
// To unbind a key combination from your defaults.json, set the command to "unbound".
// To learn more about actions and keybindings, visit https://aka.ms/terminal-keybindings
"actions": [
// Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
// These two lines additionally bind them to Ctrl+C and Ctrl+V.
// To learn more about selection, visit https://aka.ms/terminal-selection
{