Skip to content

Instantly share code, notes, and snippets.

Avatar

Oleg Kalachev okalachev

View GitHub Profile
@okalachev
okalachev / mavlink_monitor.py
Last active Jan 20, 2022
MAVLink monitor tool
View mavlink_monitor.py
@okalachev
okalachev / http-client.py
Last active Oct 20, 2021
Networking examples
View http-client.py
import requests
r = requests.get('http://192.168.11.136:5000', params={'foo': 123})
print(r.text)
@okalachev
okalachev / stars.py
Last active Aug 10, 2021
Keep track of who stars and unstars your repos 😈
View stars.py
#!/usr/bin/env python3
# Fetch all GitHub repo stargazers
# Usage: REPO=<username>/<repo> ./stars.py
# Results are saved in JSON and TXT format into ./<username>-<repo>/ directory (by timestamp)
import os, os.path
from datetime import datetime
import requests
import json
@okalachev
okalachev / remove_tag.sh
Last active Jul 28, 2021
git: remove local and remote tag
View remove_tag.sh
TAG=<tag_name> && git tag -d $TAG && git push --delete origin $TAG
@okalachev
okalachev / README.md
Last active May 23, 2021
Show high CPU usage process (xbar plugin)
View README.md

Show high CPU usage process

The plugin for xbar, thath detects a high CPU consuming process (>50% CPU by default) and shows it in the top menu bar. If there is no high CPU usage the plugin stays quiet.

@okalachev
okalachev / copy
Created May 16, 2021
Generate scp command for copying a file to host
View copy
#!/usr/bin/env bash
# Usage: copy <filename>
SSH=($SSH_CONNECTION)
echo scp $1 $(whoami)@${SSH[2]}:$(pwd)
@okalachev
okalachev / README.md
Last active Apr 23, 2021
DT overlay to run OV7251 camera on CAM0 port of Compute Module 4
View README.md

Device Tree overlay to run OV7251 camera on CAM0 port of Compute Module 4

This will work on Raspberry Pi OS 2021-01-12 (related DT files were changed in later release).

Copy the binary device tree overlay file to /boot/overlays/:

sudo cp ov7251cam0.dtbo /boot/overlays/ov7251cam0.dtbo
@okalachev
okalachev / temp_plot.py
Last active Apr 21, 2021
Script for plotting RPi temperature graph
View temp_plot.py
# Running: PYTHONUNBUFFERED=1 python temp_plot.py | tee temp.csv
import time
import subprocess
print('uptime,temperature,throttling')
while True:
uptime = float(open('/proc/uptime', 'r').readline().split()[0]) / 60
temp = float(open('/sys/class/thermal/thermal_zone0/temp').read()) / 1000
throttled = subprocess.check_output(['vcgencmd', 'get_throttled'])
@okalachev
okalachev / deqsub.py
Last active Feb 26, 2020
rospy subscriber that doesn't loose messages
View deqsub.py
import rospy
from collections import deque
from threading import Event, Thread
def subscribe_deque(name, data_class, callback=None, callback_args=(),
queue_size=1, **kwargs):
def cb(msg):
queue.append(msg)
@okalachev
okalachev / tree.cpp
Created Dec 12, 2019
Tree game implemented in C++
View tree.cpp
#include <iostream>
#include <string>
using namespace std;
struct Node
{
public:
// Answer constructor
Node(string answer) :