Skip to content

Instantly share code, notes, and snippets.

@dl6nm
dl6nm / sign-git-commits.md
Created November 4, 2022 06:51
Sign your Git commits with GPG key

Sign your Git commits

After you add your public key to your account, you can sign individual commits manually, or configure Git to default to signed commits.

Sign individual Git commits manually:

  1. Add -S flag to any commit you want to sign:

    git commit -S -m "My commit message"

  2. Enter the passphrase of your GPG key when asked.

@dl6nm
dl6nm / git-commit-message-conventions.md
Last active May 3, 2022 12:06
Git Commit Message Conventions - Conventional Commits

Git commit message conventions

Format of the commit message

[revert: ]<type>[(<scope>)]: <subject>
    |      |        |           |
    |      |        |           +--- very short description of the change
    |      |        |                (use imerative, parent tense: 'change' not 'changed')
    |      |        |

| | +--------------- optional: specifying place of the commit change

@dl6nm
dl6nm / conftest.py
Created October 15, 2020 09:40
pytest helper class with static method (function) in conftest.py
import pytest
class Helpers:
@staticmethod
def help_me():
return "no"
@pytest.fixture
@dl6nm
dl6nm / how-to-update-all-python-packages.md
Last active March 13, 2024 11:09
Hot to update all Python packages with pip
@dl6nm
dl6nm / config
Created July 23, 2020 06:51
Set user credentials in .git/config
# Add the following lines to your .git/config to set other credentials than the default ones used in [Fork Git Client](http://fork.dev/)
[credential "https://github.com/username/repository.git"]
helper = manager
username = username
useHttpPath = true
@dl6nm
dl6nm / grafana_telegram_bot.md
Created July 1, 2020 09:05 — forked from ilap/grafana_telegram_bot.md
Grafana Telegram Alert

Config Telegrambot for grafana's alerts.

1. Create bot

Open Telegram and search for @BotFather user and message them the following:

You
/newbot 

BotFather
@dl6nm
dl6nm / add_to_clipboard.py
Created February 10, 2020 09:40
Add text from Python to the Windows clipboard
import os
def addToClipBoard(text):
command = 'echo ' + text.strip() + '| clip'
os.system(command)
#example
addToClipBoard('Hello')
@dl6nm
dl6nm / .gcloudignore
Last active May 14, 2020 13:05
Configuration templates for Google App Engine Python 3 standard environment with CI/CD .gitlab-ci.yml
# https://cloud.google.com/sdk/gcloud/reference/topic/gcloudignore
#
# This file specifies files that are *not* uploaded to Google Cloud Platform
# using gcloud. It follows the same syntax as .gitignore, with the addition of
# "#!include" directives (which insert the entries of the given .gitignore-style
# file at that point).
#
# For more information, run:
# $ gcloud topic gcloudignore
#
@dl6nm
dl6nm / Grafana-TelegramBot-HowTo.md
Last active December 13, 2023 16:21 — forked from subzeta/gist:26cd1a1f1526411862b3a3a0b4422d3d
How to create a Grafana bot for Telegram

Set up a Telegram Bot

  1. Go to Grafana > Alerting > Notification channels > New channel.
  2. Type: Telegram. It will ask you for a Bot API Token and a Chat ID.
  3. Open a chat with BotFather on Telegram.
  4. Type /newbot
  5. Type your bots name. e.g. Grafana Bot
  6. Type your bots username. e.g. a_new_grafana_bot
  7. You get your Bot API Token. Paste it on Grafana.
  8. Before making getUpdates (in the next step) you should add your bot into your telegram client and run /start. Thus you start chatting with the bot and this room is assigned chat id. (Thanks to @KES777)
@dl6nm
dl6nm / console.py
Created May 31, 2019 10:17
Open a console window with current working directory
"""Open a console window with current working directory"""
import os
import platform
if platform.system() == 'Windows':
os.system('powershell -Command "Start-Process cmd -Verb RunAs -ArgumentList "/k", "cd", "{}""'.format(os.getcwd()))