Skip to content

Instantly share code, notes, and snippets.

@daevski
daevski / python-logging-config.py
Created November 11, 2022 17:47
My favorite Python logging configuration
from sys import stdout as sys_stdout
import time
import logging
# Outputs to CONSOLE and FILE; see "handlers" portion of config.
# Filename: 2022-11-11_12-37.log
# Contents: [2022-11-11] [12:32] INFO: set completion-ignore-case On
timestamp = time.strftime("%Y-%m-%d_%H-%M")
@daevski
daevski / keybase.md
Created July 28, 2021 02:45
Keybase.io GitHub Proof

Keybase proof

I hereby claim:

  • I am daevski on github.
  • I am daevski (https://keybase.io/daevski) on keybase.
  • I have a public key ASAUr4aIoX-0c0n1Ok9VFxDn64N3LkXB7fdFEd97ELmOego

To claim this, I am signing this object:

@daevski
daevski / ssh-push-public-key.sh
Created February 5, 2021 05:37
Copy a public key to multiple servers, authenticating with an existing private key.
#!/bin/bash
# Use this script to replace a public key on multiple servers.
# Note that the path to the authorized_keys file is not a varible at the moment, so if you change 'me' variable, you may also want to change that path to "/home/${me}/.ssh/authorized_keys". I would but I don't want to escape anymore quotes tonight...
me=dmckee
key_path=$HOME/.ssh/current_private_key
pub_path=$HOME/.ssh/new.pub
declare -a hosts=(
"myserver1.domain.com"
@daevski
daevski / ssh config multiple accounts, same domain
Last active March 18, 2020 03:17
An example ssh config file using multiple accounts for the same domain.
# Comments:
# This config file allows for the dynamic selection of ssh keys based on the domain name matching the 'Host' line.
#
# The following examples are the urls configured within git remotes (`git remote -v`)
# Example using domain 'github_personal' : git@github_personal:daevski/Project.git
# Example using domain 'github_work' : git@github_work:Organization/Project.git
Host github_work
HostName github.com
User git
@daevski
daevski / configuration_validation.yaml
Created October 22, 2019 23:44
Example python-cerberus validation of configuration file, both in yaml syntax
---
enabled:
required: True
type: boolean
empty: False
website_url:
required: True
type: string
empty: False