Skip to content

Instantly share code, notes, and snippets.

View osminogin's full-sized avatar
🇷🇺
Working from home

Vladimir Osintsev osminogin

🇷🇺
Working from home
View GitHub Profile
@rhettinger
rhettinger / mymax10e.py
Created November 18, 2021 01:50
Type annotated pure python implementation of the builtin max() function
'Emulate max() as fully as possible in pure Python.'
# https://stackoverflow.com/questions/69997857/implementation-of-max-function-in-python/69997876#69997876
# https://github.com/python/mypy/issues/7231
from typing import TypeVar, Any, Iterator, Iterable, Optional
from typing import Union, Protocol, Callable, cast, Tuple, overload
class SupportsGT(Protocol):
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 18, 2024 09:22
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@jmvrbanac
jmvrbanac / gunicorn_options.yml
Last active August 26, 2023 18:13
Capture Client Certificate CN from Gunicorn
bind: 0.0.0.0:8000
workers: 1
worker_class: "example.worker:CustomWorker"
timeout: 30
ca_certs: ca.crt
certfile: server.crt
keyfile: server.key
cert_reqs: 2
do_handshake_on_connect: true
@ei-grad
ei-grad / output.txt
Created October 28, 2016 16:48
Python multiprocessing.Queue sucks
zmq: 2.904726
queue: 12.812472
@rjz
rjz / ngrok_hostname.sh
Created August 9, 2016 16:20
Get ngrok hostname from command line
#!/bin/sh
# ngrok's web interface is HTML, but configuration is bootstrapped as a JSON
# string. We can hack out the forwarded hostname by extracting the next
# `*.ngrok.io` string from the JSON
#
# Brittle as all get out--YMMV. If you're still reading, usage is:
#
# $ ./ngrok_hostname.sh <proto> <addr>
#
@magnetikonline
magnetikonline / README.md
Last active November 25, 2023 13:59
Nginx & PHP-FPM systemd services.

Nginx & PHP-FPM systemd services

A basic set of systemd units for starting Nginx and PHP-FPM daemons on system startup.

  • Ensures Nginx web server has started before the PHP-FPM process.
  • Nginx pid file placed at /run/nginx.pid.
  • PHP-FPM pid file placed at /run/php7/php-fpm.pid, PHP7 PHP-FPM config at /etc/php7.
  • Based on usage with Ubuntu 16.04LTS / 18.04LTS.

Unit files are placed in /etc/systemd/system and enabled with:

@PurpleBooth
PurpleBooth / README-Template.md
Last active May 17, 2024 09:42
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active May 13, 2024 23:23
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@hofmannsven
hofmannsven / README.md
Last active May 3, 2024 15:30
Git CLI Cheatsheet
@osminogin
osminogin / downgrade-php53.sh
Created April 29, 2011 04:53
Shell script to automatic downgrade PHP 5.3 to PHP 5.2 in Debian and Ubuntu.
#!/bin/sh
#
# Copyright (c) 2011, Vladimir Osintsev
#
# Trying to make a universal script that will be suitable on Debian
# and Ubuntu systems (supporting several versions). This script generates
# necessary configuration files in /etc/apt and perform PHP downgrade
# Get distribution and release name