Skip to content

Instantly share code, notes, and snippets.

# GitHub Action that will run prettier on the whole repo and commit the changes to the PR.
name: Prettier
on:
pull_request:
branches: [main]
jobs:
prettier:
runs-on: ubuntu-latest
import asyncio
async def task(seconds: int=5):
"""Sleep for some time."""
await asyncio.sleep(seconds)
return f"slept {seconds} seconds!"
async def multi_task(sleeps_to_sleep: list[int]):
"""Start coroutines from a list of inputs."""
all_the_tasks = [task(sleep_time) for sleep_time in sleeps_to_sleep]
@JeodC
JeodC / TUC-Steam-Guide.md
Last active July 9, 2024 23:28
A guide to setting up Command & Conquer: The Ultimate Collection for Steam - Dated March 13th 2024

Command & Conquer: The Ultimate Collection (Steam Guide)

Author: Jeod

Contributors:

  • TerrorTowers
  • hxdr0n0s
  • Unstoppable
  • Agent
@yzdbg
yzdbg / auto-dr.md
Last active November 3, 2023 17:11

Automating Daily Reports, because fuck it, really...

Each day at our company, developers are required to document their activities, painstakingly jotting down their daily work and future plans. A monotonous chore that I just really dislike.

So now, there's a scribe for that :

auto-dr-

Code

@Julynx
Julynx / 15_python_tips.md
Last active June 24, 2024 11:05
15 Python Tips To Take Your Code To The Next Level!
import requests
import pynetbox
from termcolor import colored
from nornir import InitNornir
from nornir_utils.plugins.functions import print_result
from nornir_napalm.plugins.tasks import napalm_get
from nornir.core.filter import F
# NetBox Layer 3 switches (Base Inventory Group Defined in the config file below)
@up1
up1 / 1.txt
Last active June 28, 2024 18:24
NATS JetStream + Go
$docker-compose up
[+] Running 1/0
⠿ Container nat-js-nat-js-1 Created 0.0s
Attaching to nat-js-nat-js-1
nat-js-nat-js-1 | [1] 2022/07/06 11:32:04.859286 [INF] Starting nats-server
nat-js-nat-js-1 | [1] 2022/07/06 11:32:04.859416 [INF] Version: 2.8.4
nat-js-nat-js-1 | [1] 2022/07/06 11:32:04.859428 [INF] Git: [66524ed]
nat-js-nat-js-1 | [1] 2022/07/06 11:32:04.859442 [INF] Name: NBYAJSZUVNQHW4VUQZC2JDJX4QPECWSQTNJSXZAYKLL3IGTOFXART7FG
nat-js-nat-js-1 | [1] 2022/07/06 11:32:04.859460 [INF] Node: a7Zbpbhh
# -*- coding: utf-8 -*-
# Copyright 2020 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
flatten a complex object to dot bracket notation
"""
from __future__ import absolute_import, division, print_function
# roles/template_test/filter_plugins/eth_builder.py
# -*- coding: utf-8 -*-
# Copyright 2020 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
sample use of dataclass in filter plugin
@tyler-8
tyler-8 / netbox_validator_unique_vm_names.py
Last active July 4, 2022 14:59
Enforce case-insensitive unique VM names.
from extras.validators import CustomValidator
from virtualization.models import VirtualMachine
class UniqueVirtualMachineNamesCasefold(CustomValidator):
"""Enforce case-insensitive unique VM names.
Your configuration.py file would contain something like this:
CUSTOM_VALIDATORS = {