Skip to content

Instantly share code, notes, and snippets.

View artem-bez's full-sized avatar

Artem Bezsmertnyi artem-bez

  • Stockholm, Sweden
View GitHub Profile

Keybase proof

I hereby claim:

  • I am mrdeathless on github.
  • I am mrdeathless (https://keybase.io/mrdeathless) on keybase.
  • I have a public key ASCgwN_99zjP0PtSgVcxdnF64QsQbUliK5-UyUorxIVgZAo

To claim this, I am signing this object:

@artem-bez
artem-bez / renamehook.py
Created September 8, 2019 10:50 — forked from dutc/renamehook.py
simple import hook for renaming modules
from importlib import import_module
from sys import modules
from warnings import warn
from datetime import date, timedelta
from collections import namedtuple
class RenameHook:
def __init__(self, registry):
self.registry = registry
@artem-bez
artem-bez / console_stdout.txt
Created February 2, 2017 15:57
curl and httpie send body on DELETE request
~/% curl --version
curl 7.51.0 (x86_64-apple-darwin16.0) libcurl/7.51.0 SecureTransport zlib/1.2.8
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz UnixSockets
~/% curl -vvv -X DELETE -d '{ "some": "json" }' http://httpbin.org/delete
* Trying 23.22.14.18...
* TCP_NODELAY set
* Connected to httpbin.org (23.22.14.18) port 80 (#0)
> DELETE /delete HTTP/1.1
> Host: httpbin.org
@artem-bez
artem-bez / .gitmessage
Last active March 28, 2016 10:25
A template for git commit messages which reminds you preferred formatting and contents.
# 50-character subject line
#
# 72-character wrapped longer description. This should answer:
#
# * Why was this change necessary?
# * How does it address the problem?
# * Are there any side effects?
#
@artem-bez
artem-bez / top_lvl_error_handler.sh
Created August 20, 2015 12:21
snippet demonstrates an error loging function and using `trap` builtin to invoke the function on exit due to error condition
# Copyright (c): Hilario J. Montoliu <hmontoliu@gmail.com>
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version. See http://www.gnu.org/copyleft/gpl.html for
# the full text of the license.
# Taken from http://stackoverflow.com/questions/6928946/mysterious-lineno-in-bash-trap-err
set -o errtrace
@artem-bez
artem-bez / programmers_day.ics
Last active August 21, 2020 17:47
iCalendar file that describes when to celebrate the Programmers' Day. Celebration happens annually on 256th day of the year. You can import this file into a calendar application that doesn't provide direct means to specify such recurrence rule. For example, Google Calendar is one of such apps.
BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTART;VALUE=DATE:20020913
DTEND;VALUE=DATE:20020913
RRULE:FREQ=YEARLY;INTERVAL=1;BYYEARDAY=256
DESCRIPTION:https://en.wikipedia.org/wiki/Programmers%27_Day
LOCATION:
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:Programmers' Day
@artem-bez
artem-bez / sysadmin_day.ics
Last active May 2, 2017 03:12
iCalendar file that describes when to celebrate the SysAdmin Appreciation Day. Celebration happens annually on the last Friday of July. You can import this file into a calendar application that doesn't provide direct means to specify such recurrence rule. For example, Google Calendar is one of such apps.
BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTART;VALUE=DATE:20000728
DTEND;VALUE=DATE:20000728
RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=7;BYDAY=-1FR
DESCRIPTION:https://en.wikipedia.org/wiki/System_Administrator_Appreciation_Day http://sysadminday.com/
LOCATION:
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:SysAdmin Appreciation Day
@artem-bez
artem-bez / reqirements_questions.md
Last active March 16, 2021 16:11
requirements
@artem-bez
artem-bez / pst.sh
Last active October 29, 2015 08:20
Local pastebin service to quickly share some code snippet with other people on your network. To share what is in your clipboard use $ pst.sh [lang]
#!/bin/bash
set -o nounset
set -o errexit
TMP_DIR_PREFIX='pst'
TMP_FILE_SUFFIX='.html'
TMPDIR=${TMPDIR:-'/tmp'}
DEFAULT_LEXER='python' # change this to your preferred language
DEFAULT_PORT='8000'
@artem-bez
artem-bez / .pythonrc
Last active January 2, 2016 12:19
Add auto-completion and a stored history file of commands to vanilla Python interactive interpreter.
# Add auto-completion and a stored history file of commands to vanilla Python
# interactive interpreter. Requires Python 2.0+, readline. Autocomplete is
# bound to the Esc key by default (you can change it - see readline docs).
#
# Store the file in $HOME/.pystartup, and set an environment variable to point
# to it: "export PYTHONSTARTUP=$HOME/.pystartup" in bash.
def init():
init_tab_completion()