Skip to content

Instantly share code, notes, and snippets.

View creotiv's full-sized avatar

Andrey Nikishaev creotiv

View GitHub Profile
#!/bin/bash
# Script to monitor CPU throttling time and generate a plot
# Check if Python and required packages are installed
if ! command -v python3 &> /dev/null; then
echo "Python 3 is required but not installed. Please install Python 3."
exit 1
fi
@creotiv
creotiv / Instal.md
Last active October 30, 2024 21:07
Dir concatenation script for ChatGPT

Install

sudo apt-get install xclip
pip3 install pyperclip

chmod +x cc.py
sudo mv cc.py /usr/local/bin/cc
@creotiv
creotiv / 99-bluetooth-keyboard.rules
Created October 28, 2024 12:03
Scripts for work automation in Ubuntu
# /etc/udev/rules.d/99-bluetooth-keyboard.rules
ACTION=="add", SUBSYSTEM=="bluetooth", RUN+="/home/creotiv/AUTOMATION/remap_mini_bt_keyboard.sh"
<!DOCTYPE html>
<html>
<head>
<title>Video Stream</title>
</head>
<body>
<video controls>
<source src="/video" type="video/mp4">
Your browser does not support the video tag.
</video>
import cv2
import numpy as np
import svgwrite
def find_and_vectorize_edges(image_path, K):
# Шаг 1: Уменьшение количества цветов
img = cv2.imread(image_path)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
Z = img.reshape((-1, 3))
Z = np.float32(Z)
name: Update README with Structured Directory Listings
on:
push:
branches:
- main # Adjust if your default branch has a different name
jobs:
update-readme:
runs-on: ubuntu-latest
@creotiv
creotiv / db.sql
Created November 24, 2023 14:51
Postgresql Deadlock example using Pgx.Batch
CREATE DATABASE testdb;
CREATE TABLE items (
id SERIAL PRIMARY KEY,
name TEXT,
quantity INT
);
INSERT INTO items (name, quantity) VALUES ('Item1', 10);
INSERT INTO items (name, quantity) VALUES ('Item2', 20);
@creotiv
creotiv / gist:6b49c67f1aa9cf8ca4bd10c2d77a3fbe
Created October 5, 2023 14:02
Invite all linkedin page
javascript:els = document.getElementsByClassName("invitee-picker-connections-result-item--can-invite");for (let i=0;i<els.length;i++){ els[i].click(); };
@creotiv
creotiv / bilateral_slice.py
Created February 10, 2022 11:45
bilateral_slice for TorchScript
import torch
import numpy as np
def lerp_weight(x, xs):
"""Linear interpolation weight from a sample at x to xs.
Returns the linear interpolation weight of a "query point" at coordinate `x`
with respect to a "sample" at coordinate `xs`.
The integer coordinates `x` are at pixel centers.
The floating point coordinates `xs` are at pixel edges.
(OpenGL convention).
year GDP_Finland GDP_Norway GDP_Sweden
2015 234.440 385.802 505.104
2016 240.608 368.827 515.655
2017 255.017 398.394 541.019
2018 275.580 437.000 555.455
2019 268.782 405.510 533.880