Skip to content

Instantly share code, notes, and snippets.

View ihoru's full-sized avatar
🧘‍♂️

Igor Polyakov ihoru

🧘‍♂️
View GitHub Profile
@ihoru
ihoru / main_test.go
Last active November 18, 2024 07:00
Go 1.22 change: each iteration of the loop creates new variables
package main_test
import (
"testing"
)
// Compare running:
// go1.21 test -bench=. main_test.go
// goos: linux
package main
import (
"slices"
"testing"
)
// go test -bench=. main_test.go
const (
@ihoru
ihoru / pytz.py
Last active September 23, 2024 08:46
import pytz
import zoneinfo
from datetime import datetime, date, time, timezone
dt=datetime.combine(date.today(),time(12,0))
tzs='UTC', 'Europe/Moscow', 'Asia/Calcutta', 'Asia/Bangkok', 'Asia/Kuala_Lumpur', 'Asia/Tokyo',
print(f"{dt=}")
print(f"{dt.replace(tzinfo=timezone.utc)}")
print(f"{dt.astimezone(timezone.utc)}")
print(f"{dt.astimezone()}")
for tz in tzs:
@ihoru
ihoru / ricoh_theta_v_format_data.py
Last active December 31, 2019 05:55
Ricoh Theta V forcibly format data
#!/usr/bin/python3
"""
Sometimes, while using Google Street View application (for Android) and Ricoh Theta V 360 camera
some videos are not shown in application, but they actually still exist and take place in memory card.
As memory card is not external and limited by ~20Gb, it's critically important always to have as much space available
as possible.
!!!This script DO NOT request confirmation to delete files!!!
Every time you start it, it will make a request to the camera's web service to use API.
@ihoru
ihoru / pre-commit
Last active October 23, 2015 12:03
USERNAME=i.polyakov; - меняешь на свой шаблон после TODO, который хочешь никогда не закоммитить случайно (недоработки в коде) файл кладется в папке проекта в .git/hooks/pre-commit
#!/bin/bash
USERNAME=i.polyakov;
git diff --cached --name-only | while read FILE;
do
if [[ "$FILE" =~ ^.+\.(php)$ ]];
then
if [[ -f $FILE ]];
then