Skip to content

Instantly share code, notes, and snippets.

View xalien10's full-sized avatar

Mahmudul Hasan xalien10

View GitHub Profile
@MatheusPoliCamilo
MatheusPoliCamilo / ssh.md
Last active May 3, 2024 03:49 — forked from EdnilsonRobert/ssh.md
Multiple SSH keys for GitHub and GitLab

Multiple SSH keys for GitHub and GitLab

1. Generate SSH keys

ssh-keygen -t ed25519 -C "user@email.com" -f ~/.ssh/id_rsa_github
ssh-keygen -t ed25519 -C "user@email.com" -f ~/.ssh/id_rsa_gitlab

2. Copy keys to GitHub and GitLab

@gh640
gh640 / send_message_on_google_chat.py
Last active February 10, 2024 04:52
Sample: Send a message on Google Chat group with Python `requests`
"""A sample to send message on Google Chat group with Python requests.
Prerequisites:
- Google API v1
- A webhook URL taken
- Python 3
- Requests (last tested with 2.31.0)
Usage:
@dinvlad
dinvlad / cloudrun.jinja
Created September 6, 2019 15:51
Create Cloud Run Service through Deployment Manager
{% set PROJECT = env['project'] %}
{% set REGION = properties['region'] | default('us-east1') %}
{% set PARENT = 'projects/' + PROJECT + '/locations/' + REGION %}
{% set PREFIX = env['deployment'] %}
{% set CLOUDRUN_TYPE_PROVIDER = PREFIX + '-provider' %}
{% set CLOUDRUN_SERVICE_TYPE = PROJECT + '/' + CLOUDRUN_TYPE_PROVIDER + ':projects.locations.services' %}
@hzlmn
hzlmn / testcase_assert_not_raises.py
Created October 23, 2018 10:11
Python unittest: Testing an exception is not raised
import unittest
from contextlib import contextmanager
class TestCase(unittes.TestCase):
@contextmanager
def assertNotRaises(self, exc_type):
try:
yield None
@bradmontgomery
bradmontgomery / example.py
Created August 16, 2016 16:57
Example of setting a choices value for django ArrayField
# Here's your list of choices that would be displayed in a drop-down
# element on the web. It needs to be a tuple, and we define this
# as a variable just for readability/convenience.
#
# This example has 3 choices, each of which consists of two parts:
# 1. the thing that get strored in your database
# 2. the thing that you see in a dropdown list
LABEL_CHOICES = (
('this gets stored in your database', 'This item is what you see in the drop-down'),
('django', 'Django'),