Skip to content

Instantly share code, notes, and snippets.

View sio's full-sized avatar

Vitaly Potyarkin sio

View GitHub Profile
@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 / 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 / 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 / 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 <[email protected]>
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 ------------
@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
#
#/bin/sh
#
# Find case mismatches in for Load function calls in current directory
#
LOAD_STRINGS=$(ls *.pq|sed -e 's:\.pq$:":' -e 's:^:":')
echo "$LOAD_STRINGS"|while read LINE
do
@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 May 8, 2024 13:17
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