Skip to content

Instantly share code, notes, and snippets.

@seefalert
seefalert / script_code_exec
Last active September 30, 2024 08:28
Тестовый скрипт для проверки вашего кода. Поместите тестовые файлы в папку "tests", а ваш код в файл "my_code.py". Запустите скрипт для выполнения тестов и проверки результатов.
import os
import pathlib
import subprocess
import sys
import time
def load_test_file(file_path):
with open(file_path, encoding='utf-8') as file:
return file.read().strip().splitlines()
@seefalert
seefalert / script_input_data.py
Last active September 11, 2025 09:17
Этот код - тестовый скрипт для проверки вашего кода. Убедитесь, что у вас есть папка "tests" с тестовыми файлами и ответами. Также у вас должен быть файл "my_code.py" с кодом, который нужно протестировать. Запустите скрипт, и он выполнит тесты, выведет результаты и сообщит, успешно ли пройдены все тесты.
import os
import pathlib
import time
import psutil
import subprocess
import sys
def load_test_file(file_path):
with open(file_path, encoding='utf-8') as file:
@CharlesGodwin
CharlesGodwin / How to use ssh-copy-id.md
Last active February 11, 2026 12:25
Windows 10/11 scripts to support ssh-copy-id which is missing in Windows OpenSSH

The Windows version of OpenSSH client doesn't include a ssh-copy-id command. I don't know why. If it does one day, then this gist can be ignored.

  • This script is written in PowerShell as the legacy program cmd.exe is not flexible enough for the required options.
  • Download the file ssh-copy-id.ps1 to your Windows PC, or copy and paste its contents to a file of the same name.
  • Run the script passing your linux account ssh information (for example powershell .\ssh-copy-id.ps1 pi@raspberrypi.local). If you use a non-standard port add the parameter -port=nnnn. This should work with any Linux platform.
  • Run the command for each linux account you connect with. You will be prompted for your Linux host password. If you have more than 1 account on any machine, you must do this for each account.

If the script won't run, then run this command once

Set-ExecutionPolicy RemoteSigned CurrentUser

@arrowinaknee
arrowinaknee / office_unlocker.pyw
Last active May 11, 2025 13:47
Снимает защиту от редактирования с файлов MS Word (.docx) и MS Excel (.xlsx)
import os
import shutil
import tempfile
import re
import sys
import tkinter as tk
from tkinter import filedialog
from tkinter import messagebox
@doitian
doitian / registries.conf
Last active April 29, 2026 11:46
[Configure Docker Hub mirror in /etc/containers/registries.conf] #docker #podman #proxy
unqualified-search-registries = ['docker.io']
[[registry]]
prefix = "docker.io"
location = "docker.io"
[[registry.mirror]]
prefix = "docker.io"
# This will set the docker registry mirror of a chinese university.
# DON'T use it unless you have a network connection issue and you trust the mirror provider.
@witmin
witmin / ffmpeg-mp4-to-animated-webp.md
Last active April 14, 2026 12:55
Convert MP4 file to animated WebP in ffmpeg

Convert MP4 file to animated WEBP file in ffmpeg CLI

1. Install ffmpeg CLI through homebrew

In terminal.app, install ffmpeg through homebrew

brew install ffmpeg

Validate the installation:

@s3rj1k
s3rj1k / HowTo
Last active January 3, 2026 03:07
Ubuntu 20.04.3 AutoInstall
# For recent versions of Ubuntu:
- https://www.pugetsystems.com/labs/hpc/ubuntu-22-04-server-autoinstall-iso/
# Docs:
- https://wiki.ubuntu.com/FoundationsTeam/AutomatedServerInstalls
- https://wiki.ubuntu.com/FoundationsTeam/AutomatedServerInstalls/ConfigReference
- https://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html
- https://discourse.ubuntu.com/t/please-test-autoinstalls-for-20-04/15250/53
# Download ISO Installer:
@rpunt
rpunt / mktemp.ps1
Created February 15, 2020 16:52
I've wanted mktemp in powershell forever, so... fine.
function mktemp {
param (
[Parameter(mandatory=$false)]$Extension
)
$randomfile = [System.IO.Path]::GetRandomFileName()
if ($Extension) {
$randomfile = [System.IO.Path]::ChangeExtension($randomfile, $Extension)
}
return Microsoft.PowerShell.Management\Join-Path ([System.IO.Path]::GetTempPath()) "$randomfile"
}
@gmolveau
gmolveau / uuid_user.py
Last active January 17, 2025 02:56
sqlalchemy uuid for sqlite
########################
# UUID for SQLite hack #
########################
from sqlalchemy.types import TypeDecorator, CHAR
from sqlalchemy.dialects.postgresql import UUID
import uuid
class GUID(TypeDecorator):
@b4tman
b4tman / time_calc.py
Last active April 10, 2020 12:59
Калькулятор для вычисления выражений со значениями указанными в форме времени. Например "(12:05 - 11:30) / 2".
# -*- coding: utf-8 -*-
"""
simple calculator for time
based on fourFn.py (pyparsing module examlple)
"""
from pyparsing import Literal,CaselessLiteral,Word,Combine,Optional,\
ZeroOrMore,Forward,nums,alphas
import sys, operator