Skip to content

Instantly share code, notes, and snippets.

View rodnaxel's full-sized avatar

Aleksandr Smirnov rodnaxel

  • Finland
View GitHub Profile
@rodnaxel
rodnaxel / geo2rect.py
Created December 23, 2021 09:22
Convert geographic coordinates (longitude, latitude) to rectangular Gauss-Kruger projection (example for Moskow)
# Географические координаты точки (в градусах)
dLon = 37.618 # Долгота (положительная для восточного полушария)
dLat = 55.752 # Широта (положительная для северного полушария)
# Номер зоны Гаусса-Крюгера (если точка рассматривается в системе
# координат соседней зоны, то номер зоны следует присвоить вручную)
zone = int(dLon/6.0+1)
# Импорт математических функций
from math import sin, cos, tan, pi
@rodnaxel
rodnaxel / qt-project.pro
Last active September 6, 2021 12:49
Script autorun windeployqt after build project (for OS Windows)
# Add this line below to your pro-file
# Deployment
CONFIG(debug, debug|release ) {
} else {
DESTDIR = distrib
DEPLOY_TARGET = $${OUT_PWD}/$${DESTDIR}
PATH_TO_QML_FILES = $${PWD}/
@rodnaxel
rodnaxel / qt-plotly-demo.py
Created July 28, 2021 19:55
Simple example plotly application with QWebEngine
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton
from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.QtCore import QDir, QUrl
import plotly
import plotly.graph_objects as go
@rodnaxel
rodnaxel / raspi-setup-gitea.md
Created May 4, 2021 14:55 — forked from afragen/raspi-setup-gitea.md
Installing Gitea on Raspberry Pi 3 b+ with nginx and automatic backups

Setup Gitea on Raspberry Pi (3b+)

These instructions are based on this article: https://docs.gitea.io/en-us/install-from-source/.

Setup Raspberry Pi with minimal Raspbian image. You need to connect to the HDMI port and set the following:

Use Noobs to install Raspian.

Open menu Preferences > Raspberry Pi Settings

@rodnaxel
rodnaxel / configure_kivy_rpi3.sh
Created March 3, 2021 08:40
Install and configure kivy for raspberry pi 3
# Build libsdl2
sudo apt build-dep libsdl2
wget http://www.libsdl.org/tmp/SDL-2.0.zip
unzip SDL-2.0.zip
cd SDL-2.0.15-14858
./configure
make
sudo make install
# Copy libsdl2 files to /usr/lib/arm-linux-gnueabihf/
@rodnaxel
rodnaxel / raspberry-pi-chroot-armv7-qemu.md
Created November 13, 2020 05:42 — forked from jkullick/raspberry-pi-chroot-armv7-qemu.md
Chroot into Raspberry Pi ARMv7 Image with Qemu
# install dependecies
apt-get install qemu qemu-user-static binfmt-support

# download raspbian image
wget https://downloads.raspberrypi.org/raspbian_latest

# extract raspbian image
unzip raspbian_latest
@rodnaxel
rodnaxel / vscode_initialize.py
Last active August 24, 2021 16:45
Initialize C/Cpp project for VSCode (only Linux)
#! /usr/bin/env python3
import argparse
import sys
import os, os.path
import subprocess
import json
# Template tasks (use to compile)
@rodnaxel
rodnaxel / py_mount.py
Created May 15, 2020 17:01
The script uset to mount device by Linux
import os
import subprocess
def cmd(args: list, as_root=False):
args = args if not as_root else ['root'].extend(args)
print(args)
result = subprocess.run(args,
capture_output=True,
shell=False,
import argparse
import re
INDENT = 4 * " "
pattern = r"(?P<label>\w+:)?(?P<code>[^;]*)?;?(?P<comment>.*)?"
def parse_label(line: str) -> str:
if not line:
return ''
@rodnaxel
rodnaxel / create_datascience_env.sh
Created November 27, 2019 13:42
Create data science env on Linux used to Pipenv
# Create virtualenv used to pipenv
mkdir datascience/
cd datascience/
pipenv install --python 3.7
pipenv shell
# Install neccesary package
pipenv install numpy pandas jupyter ipython plotly matplotlib
# Install support plotly