Skip to content

Instantly share code, notes, and snippets.

kvm -cdrom opticalimage.iso -boot d -m 4096 -drive file=/dev/sdx,format=raw
echo -n "$1" | xxd -plain | tr -d '\n' | sed 's/\(..\)/%\1/g'
while ! rsync --partial --progress -avz -e ssh "user@server:/path/folder.to.copy" "/to.local.path"; do sleep 5; done
type $env:USERPROFILE\.ssh\id_rsa.pub | ssh $args[0] "cat >> .ssh/authorized_keys"
@eugrus
eugrus / create a bin environment with package managers for and by a simple user in the home directory.sh
Last active May 26, 2023 00:37
create a bin environment with package managers for and by a simple user in his home directory
mkdir ~/bin
mkdir ~/.local
mkdir ~/.local/bin
git clone https://github.com/Homebrew/brew homebrew
eval "$(homebrew/bin/brew shellenv)"
brew update --force --quiet
chmod -R go-w "$(brew --prefix)/share/zsh"
echo 'export PATH=$PATH:$HOME/bin:$HOME/.local/bin:$HOME/homebrew/bin' >> ~/.bashrc
source ~/.bashrc
curl https://bootstrap.pypa.io/get-pip.py | python3 - --user
@eugrus
eugrus / dispatcher.c
Last active May 26, 2023 21:45
цикл с быстрой и медленной частями тела
#include <stdio.h>
int main() {
int count = 0;
while (1) {
printf("fast\n");
if (count == 49) {
count = 0;
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\runas]
@="Take Ownership"
"NoWorkingDirectory"=""
[HKEY_CLASSES_ROOT\*\shell\runas\command]
@="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
@eugrus
eugrus / .lighttpd.conf
Last active June 16, 2023 15:09
Wikimedia Toolserver config for Bash based CGI and appropriate headers
cgi.assign += ( ".sh" => "/bin/bash" )
setenv.add-response-header += ( "Content-Type" => "text/html; charset=utf-8" )
$HTTP["url"] =~ "\.sh$" { setenv.add-response-header = ( "Content-Type" => "text/plain; charset=utf-8" ) }
@eugrus
eugrus / sortoutbluredimages.py
Last active June 21, 2023 22:46
Sorts out blurry images in the current dir prepending an underscore to their names
import os
import cv2
def is_image_blurry(image):
# Для анализа конвертируем изображение в оттенки серого
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
# Вычисляем оценку размытости изображения с использованием оператора Лапласа
# Оператор Лапласа выделяет границы объектов на изображении
# Далее вычисляется дисперсия значений пикселей на полученном изображении
@eugrus
eugrus / scorebluriness.py
Last active June 21, 2023 22:48
Renames images in the current dir prepending their blurriness score to the file names
import os
import cv2
def is_image_blurry(image):
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
blur_score = cv2.Laplacian(gray, cv2.CV_64F).var()
return blur_score
def rename_images_with_blur_score(folder_path):
for filename in os.listdir(folder_path):