Skip to content

Instantly share code, notes, and snippets.

View sio's full-sized avatar

Vitaly Potyarkin sio

View GitHub Profile
@sio
sio / venv_temp.bat
Created September 19, 2017 08:45
Set up temporary Python virtual environment on Windows
@echo off
REM This script sets up Python virtual environment in temporary directory
REM and runs a new cmd session within. When that cmd session ends, the script
REM deletes virtual environment.
REM
REM Copyright 2017 Vitaly Potyarkin
REM
REM Licensed under the Apache License, Version 2.0
REM http://www.apache.org/licenses/LICENSE-2.0
@sio
sio / minttycolor.py
Last active March 16, 2023 15:33
Helper functions for creating Mintty color scheme with Python
"""
Manipulate color schemes for mintty
For simplicity, support only "value = r, g, b" format with decimal values
Copyright 2017 Vitaly Potyarkin
Licensed under the Apache License, Version 2.0
http://www.apache.org/licenses/LICENSE-2.0
@echo off
set PY=python
call "C:\Users\Public\.LocalData\Python\WPy64-3770\scripts\env_for_icons.bat"
cd "C:\Users\Public\.prj"
set PYTHONIOENCODING=utf-8
set PYTHONUTF8=1
cmd.exe /k
@sio
sio / Makefile
Last active January 27, 2022 21:21
Files used in Makefile.venv demo (https://asciinema.org/a/279646)
hello: venv
$(VENV)/python hello.py
include Makefile.venv
Makefile.venv:
curl \
-o Makefile.fetched \
-L "https://github.com/sio/Makefile.venv/raw/v2019.11.06/Makefile.venv"
echo "d32b54ae7cb0e99ec75cff9c4ef78c7050bc0c351f834464674fe4aa328ca370 *Makefile.fetched" \
| sha256sum --check - \
@sio
sio / git-projects.sh
Created September 7, 2017 17:40
Manage multiple Git projects at once (check status, view logs...)
#!/bin/bash
set -e
#
# Execute the same git command in all project directories.
#
# Extra command line arguments are passed to git.
# If no arguments are specified, `git status` is assumed.
#
# File `projects.txt` has to contain paths to all project
@sio
sio / zombie.Dockerfile
Created February 17, 2020 14:22
Environment with dysfunctional PID 1 that does not reap zombies
# Environment with dysfunctional PID 1 that does not reap zombies
#
# One zombie process in created automatically upon interactive invocation.
# Use `ps -ef` to see it
FROM python:slim-buster
RUN apt-get update && apt-get -y install procps psmisc
RUN echo "bash -c 'sleep 1 & disown'" > /create-zombie.bash
CMD ["python", "-c", "import pty; pty.spawn(['bash', '--init-file', '/create-zombie.bash'])"]
@sio
sio / rate_limiter.py
Last active October 22, 2019 07:21
Rate limit access to sensitive resources | Development moved to https://github.com/sio/scrapehelper
'''
Rate limit access to sensitive resources
'''
# Copyright 2019 Vitaly Potyarkin
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
@sio
sio / loader.bas
Created October 15, 2019 11:55
SAP GUI Scripting Sample
Attribute VB_Name = "SapScripting"
Option Explicit
Public Function SAP_GetSession(sName As String) As Object
'
' Get existing SAP session by system name
'
Dim SapApplication As Object
Dim SapGuiAuto As Object
Dim SapConnection As Object
Dim SapSession As Object
From 907f368360ae8514e7d4652b999a00a3cf9c6741 Mon Sep 17 00:00:00 2001
From: Vitaly Potyarkin <sio.wtf@gmail.com>
Date: Fri, 14 Jun 2019 14:49:26 +0300
Subject: [PATCH] Lift 1024 open files limit (switch to curl polling API)
Backported from https://github.com/transmission/transmission/pull/893
---
CMakeLists.txt | 2 +-
configure.ac | 2 +-
libtransmission/fdlimit.c | 22 ------------