This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Set the directory where your MP3 files are located | |
input_dir="." | |
# Set the desired output bitrate (in bits per second) | |
output_bitrate="192k" # Adjust this value as needed | |
# Loop through each MP3 file in the directory | |
for file in "$input_dir"/*.mp3; do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
import pytz | |
tz_ny = pytz.timezone('America/New_York') | |
dt_aware_dst_active = tz_ny.localize(datetime.datetime(2023, 5, 1, 12, 0)) | |
dt_aware_dst_inactive = tz_ny.localize(datetime.datetime(2023, 12, 1, 12, 0)) | |
print("Original DST Active Offset (America/New_York):", dt_aware_dst_active.dst()) | |
print("Original DST Active (America/New_York):", dt_aware_dst_active) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Cache downloaded file | |
id: cache-some-file | |
uses: actions/cache@v3 | |
with: | |
path: some-file | |
key: ${{ runner.os }}-downloaded-file-${{ hashFiles('some-file') }} | |
- name: Fetch smctl MSI | |
if: steps.cache-some-file.outputs.cache-hit != 'true' | |
shell: pwsh | |
run: | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import time | |
class DatadogLogIterator: | |
_MAX_LIMIT = 1_000 | |
_FETCH_LIMIT = _MAX_LIMIT | |
def __init__(self, query, start, end, api_key, app_key): | |
self._cursor = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import httpx | |
import time | |
async def do_work_async(): | |
http = httpx.AsyncClient() | |
while True: | |
resp = await http.get('https://httpbin.org/status/202') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import functools | |
import signal | |
import sys | |
import time | |
async def worker(shutdown_event): | |
try: | |
while True: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import aiobotocore.session | |
import aiobotocore.config | |
async def example(): | |
# Equivalent to boto3.client('s3', config=botocore.client.Config(**kwargs)) | |
# See also for available options: | |
# * https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ============================================================================= | |
# Copyright 2022 by Rafid Al-Humaimidi. All rights reserved. | |
# Licensed via Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) | |
# | |
# Forked from: https://github.com/rafidka/boto3async | |
# ============================================================================= | |
"""Adds simple async wrappers around boto3 client methods. | |
This module adds async methods to the stock boto3 clients. The async versions of |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
redis-server --save "" --appendonly no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://stackoverflow.com/a/30029855/21784 | |
listening() { | |
if [ $# -eq 0 ]; then | |
sudo lsof -iTCP -sTCP:LISTEN -n -P | |
elif [ $# -eq 1 ]; then | |
sudo lsof -iTCP -sTCP:LISTEN -n -P | grep -i --color $1 | |
else | |
echo "Usage: listening [pattern]" | |
fi | |
} |
NewerOlder