Skip to content

Instantly share code, notes, and snippets.

View putnik's full-sized avatar
🇺🇦
Нет войне!

Sergei Leshchina putnik

🇺🇦
Нет войне!
View GitHub Profile
echo "Hi!"
@putnik
putnik / install.sh
Last active October 8, 2023 13:45
OpenVoiceOS Russian config
# Configure RPi
sudo /sbin/iwconfig wlan0 power off
sudo sed -i 's/^exit 0/\/sbin\/iwconfig wlan0 power off\n\nexit 0/g' /etc/rc.local
# Install Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh ./get-docker.sh
sudo usermod -aG docker $USER
newgrp docker
@putnik
putnik / geoip.py
Created April 17, 2023 23:46
Script to count most popular countries by IP
# pip3 install python-geoip-python3
# pip3 install python-geoip-geolite2
from geoip import geolite2
import csv
ips = {}
countries = {}
total = 0
@putnik
putnik / install.sh
Last active January 16, 2023 19:49
Picroft + ReSpeaker 4-Mic Array + WaveShare WM8960 Audio HAT
### General
sudo apt update
sudo apt upgrade
sudo apt-get install libatlas-base-dev vim
mycroft-pip install --upgrade pip
curl https://sh.rustup.rs -sSf | sh
### Audio hat
git clone https://github.com/waveshare/WM8960-Audio-HAT.git
cd WM8960-Audio-HAT
@putnik
putnik / migrate.py
Created March 14, 2021 01:17
Скрипт синхронизации списков русского Викигида и Викиданных
# Copyright 2020 Sergey Leschina (mail@putnik.tech)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@putnik
putnik / Gadget-wikidataInfoboxExport.js
Created October 2, 2019 11:59
MediaWiki:Gadget-wikidataInfoboxExport.js for bewiki
var wieConfig = {
units: {
Q531: { search: [ 'св(?:\\.|етлавых|етлавыя)\\s*(?:гадоў|гады?)' ] },
Q4916: { search: [ '^€', '^EUR' ] },
Q4917: { search: [ '^(?:-|US)?\\$', 'долараў(?:\\sЗША)?', 'дол.' ] },
Q7727: { search: [ 'хвілін' ] },
Q8146: { search: [ 'ен' ] },
Q11573: { search: [ 'метр(?:ы|аш)' ] },
Q25344: { search: [ '^CHF' ] },
Q160680: { search: [ 'рублёў' ] },
<html>
<head>
<script src="http://code.jquery.com/jquery-2.0.0.js"></script>
<script>
var sparql = `
select ?item ?itemLabel ?article {
?item wdt:P31/wdt:P279/wdt:P279 wd:Q174211 .
?item wdt:P279 wd:Q11173
OPTIONAL { ?article schema:about ?item; schema:isPartOf <https://ru.wikipedia.org/> }
SERVICE wikibase:label { bd:serviceParam wikibase:language "ru,en" }
@putnik
putnik / pre-commit.sh
Last active March 11, 2019 09:09 — forked from peinwag/pre-commit.sh
Precommit hook for git that checks new modified lines against a given codingstandard with phpcs
#!/bin/bash
files=$(git diff-index --name-only --diff-filter=ACMR HEAD --)
for file in $files; do
phpcsout=$(phpcs -s $file --standard=phpcs.xml)
if [ "$phpcsout" != "" ]; then
affectedLines=$(git blame -p -s $file | grep 00000000 | cut -d " " -f2)
@putnik
putnik / order_awards.py
Last active January 9, 2022 10:38
Generate a sorted list of awards from Wikidata
# Copyright 2018-2022 Sergey Leschina <mail@putnik.tech>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
{
"$schema": "https://vega.github.io/schema/vega-lite/v2.json",
"description": "Population over time.",
"data": {
"values": [
{"year": 1907,"population": 51815},
{"year": 2011,"population": 310956},
{"year": 2017,"population": 269022}
]
},