Skip to content

Instantly share code, notes, and snippets.

View mstuttgart's full-sized avatar
🏠
Working from home

Michell Stuttgart mstuttgart

🏠
Working from home
View GitHub Profile
@mstuttgart
mstuttgart / README.md
Created June 6, 2024 14:47 — forked from darrenpmeyer/README.md
Automatically start a single instance of ssh-agent for all terminal sessions to share (bash)

Installation

  1. mkdir -p ~/.config && touch ~/.config/ssh-agent.pid
  2. Paste the contents of ssh-agent-manage.sh into your .bashrc or .bash_profile or similar
  3. killall -9 ssh-agent
  4. Start a new terminal session (note: old sessions will not see ssh-agent, only new ones)

Details

This snippet, when included in .bashrc, will ensure that your session has a working ssh-agent with all your ssh keys loaded into it. It does this without creating separate ssh-agent processes by:

@mstuttgart
mstuttgart / vagrant.md
Created May 29, 2024 20:31
Copy public key to .ssh/authorized_keys inside Vagrant vm

Copy public key to .ssh/authorized_keys inside Vagrant vm:

Vagrant.configure("2") do |config|
  config.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "~/.ssh/authorized_keys"
  config.ssh.private_key_path = ["~/.vagrant.d/insecure_private_key", "~/.ssh/id_rsa"]
  config.ssh.insert_key = false
end
``
@mstuttgart
mstuttgart / Makefile
Created May 23, 2024 18:38 — forked from MarkWarneke/Makefile
Makefile for python code
# Makefile for python code
#
# > make help
#
# The following commands can be used.
#
# init: sets up environment and installs requirements
# install: Installs development requirments
# format: Formats the code with autopep8
# lint: Runs flake8 on src, exit if critical rules are broken
@mstuttgart
mstuttgart / minimal_ansible_playbook.py
Created May 23, 2024 12:13 — forked from nod/minimal_ansible_playbook.py
Minimal code to run an Ansible Playbook from within python and get stats back on success or fail
from ansible import playbook, callbacks
# uncomment the following to enable silent running on the playbook call
# this monkey-patches the display method on the callbacks module
# callbacks.display = lambda *a,**ka: None
# the meat of the meal. run a playbook on a path with a hosts file and ssh key
def run_playbook(playbook_path, hosts_path, key_file):
stats = callbacks.AggregateStats()
playbook_cb = callbacks.PlaybookCallbacks(verbose=0)
@mstuttgart
mstuttgart / postgresql.md
Created May 21, 2024 20:12
Arquivo de configuraço auxiliar do postgresql

Arquivo de configuração alternativo do postgresql. Sobressai sobre o /etc/postgresql/12/main/postgres.conf

sudo nvim /var/lib/postgresql/14/main/postgresql.auto.conf
@mstuttgart
mstuttgart / tutorial.py
Created May 14, 2024 12:41
Skip lines with Python Black formmater
def soma(a, b):
# ignora apenas a linha abaixo
soma = a + b # fmt: skip
return soma
# ignora todo o bloco de codigo a abaixo
# fmt: off
def subtracao(a, b):
sub = a - b
return sub
@mstuttgart
mstuttgart / linux-tips.md
Last active May 29, 2024 20:37
Linux tips

Linux tips

Remap CapsLock to Esc in ubuntu

The standard setxkbmap which is used to switch keyboard mappings actually has a standard option to replace the caps lock with escape.

setxkbmap -option caps:escape

To restore:

Note

Highlights information that users should take into account, even when skimming.

Tip

Optional information to help a user be more successful.

Important

Crucial information necessary for users to succeed.

[!WARNING]

@mstuttgart
mstuttgart / tutorial.md
Last active May 24, 2024 09:28
Instalação do requirements.txt do odoo 12 no Ubuntu 22.04

Instalar as libs separadamente (python 3.8)

pip install --no-binary lxml lxml==4.6.3
pip install --no-binary xmlsec xmlsec

Instalar as libs separadamente (python 3.10)

pip install --no-binary lxml==4.6.3 lxml==4.6.3 --force-reinstall
pip install --no-binary xmlsec==1.3.13 xmlsec==1.3.13