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
# Configuration file for runtime kernel parameters. | |
# See sysctl.conf(5) for more information. | |
# See also http://www.nateware.com/linux-network-tuning-for-2013.html for | |
# an explanation about some of these parameters, and instructions for | |
# a few other tweaks outside this file. | |
# | |
# See also: https://gist.github.com/kgriffs/4027835 | |
# | |
# Assumes a beefy machine with lots of network bandwidth |
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
function string:contains(sub) | |
return self:find(sub, 1, true) ~= nil | |
end | |
function string:startswith(start) | |
return self:sub(1, #start) == start | |
end | |
function string:endswith(ending) |
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
#!/usr/bin/env bash | |
/Applications/VLC.app/Contents/MacOS/VLC -I rc "$@" |
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
# ============================================================================= | |
# 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
import re | |
# RFC 4122 states that the characters should be output as lowercase, but | |
# that input is case-insensitive. When validating input strings, | |
# include re.I or re.IGNORECASE per below: | |
def _create_pattern(version): | |
return re.compile( | |
( | |
'[a-f0-9]{8}-' + |
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
# Grant Jenks' LRU Cache with TTL for Python | |
# | |
# https://stackoverflow.com/questions/31771286/python-in-memory-cache-with-time-to-live/71634221#71634221 | |
from functools import lru_cache, wraps | |
from time import monotonic | |
def lru_cache_with_ttl(maxsize=128, typed=False, ttl=60): | |
"""Least-recently used cache with time-to-live (ttl) limit.""" |
NewerOlder