Skip to content

Instantly share code, notes, and snippets.

View maximtrp's full-sized avatar

Maksim Terpilovskii maximtrp

View GitHub Profile
@maximtrp
maximtrp / Orange Pi PC + Arch Linux ARM.md
Last active May 4, 2024 20:03
Guide on how to install Arch Linux ARM on SD card for your Orange Pi PC board

Orange Pi PC + Arch Linux ARM: installation guide

This guide is based on multiple guides as well as official instructions for the other boards found on the Internet:

  1. https://github.com/RoEdAl/alarm-uboot-sunxi-armv7
  2. https://uthings.uniud.it/building-mainline-u-boot-and-linux-kernel-for-orange-pi-boards
  3. https://archlinuxarm.org/platforms/armv7/allwinner/pcduino3

I have gone through all these steps recently and got a working board with my favorite Arch Linux ARM. I hope it will be helpful for someone else.

@maximtrp
maximtrp / docker-compose.yml
Created August 12, 2022 15:30
docker-compose.yml for YouTrack
version: "3"
services:
youtrack:
image: jetbrains/youtrack:2022.2.52874
container_name: "youtrack"
volumes:
- ./youtrack/data:/opt/youtrack/data
- ./youtrack/conf:/opt/youtrack/conf
- ./youtrack/logs:/opt/youtrack/logs
@maximtrp
maximtrp / mystem.py
Last active February 10, 2021 18:44
MyStem Simple Wrapper Functions
import subprocess as sp
import json
def get_lemma(x):
lemma = x['analysis'][0].get('lex') if x['analysis'] else x.get('text')
return lemma
def mylem(x):
p = sp.Popen(['mystem', '-l', '--format', 'json'], stdin=sp.PIPE, stdout=sp.PIPE, stderr=sp.STDOUT)
stdout = p.communicate(input=bytes(x, encoding='utf-8'))
@maximtrp
maximtrp / copy-left-ch.sh
Created December 14, 2020 08:16
Copy left channel to the right with Pulseaudio
#!/usr/bin/bash
pactl load-module module-remap-sink \
sink_name=reverse-stereo \
master=0 \
channels=2 \
master_channel_map=front-left,front-right \
channel_map=front-left,front-left
pactl set-default-sink reverse-stereo
@maximtrp
maximtrp / pip-update.sh
Created December 11, 2020 17:34
Filter updated packages installed using pip (and not pacman)
#!/usr/bin/bash
# updated packages
echo "[1] Getting updated packages list"
pip list -o | tail -n +3 | cut -d" " -f1 | tr - _ | sort > updated.txt
# pip-managed packages
echo "[2] Getting packages managed by pip"
find /usr/lib/python3.9/site-packages/ -name INSTALLER | grep --color -oE "site-packages/([^-\/]*?)" | sed "s/site-packages\///g" | sort > installed.txt
@maximtrp
maximtrp / ecdf.py
Created October 26, 2020 16:42
Simple ECDF in Python
def ecdf(data, num=100):
y = np.linspace(0, 100, num)
x = np.percentile(data, y)
return x, y
def ecdf_plot(data, ax=None):
x, y = ecdf(data)
return ax.plot(x, y) if ax is not None else plt.plot(x, y)
@maximtrp
maximtrp / tpr_tnr_calc.py
Last active January 17, 2019 13:20
Calculation of sensitivities and specificities per class for scikit-learn machine learning algorithms
import numpy as np
from sklearn.datasets import make_multilabel_classification
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import confusion_matrix
# Dataset init
x, y = make_multilabel_classification(n_samples=1000, n_features=10, n_classes=3, n_labels=1, random_state=0)
y = y.sum(axis=1)
x_train, x_test, y_train, y_test = train_test_split(x, y, random_state=0, test_size=0.33)
@maximtrp
maximtrp / circles.py
Created August 11, 2018 05:16
Random circles visualization
import numpy as np
import PIL.Image as pim
import PIL.ImageDraw as pid
import palettable as pal
circles = 10
points = 9
radius = 128
width = 2000
height = 2000