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 random | |
UNMISTAKABLE_CHARS = '23456789ABCDEFGHJKLMNPQRSTWXYZabcdefghijkmnopqrstuvwxyz' | |
def meteor_id(chars_count=17, prefix=""): | |
"""Create an id such as the ones Meteor creates | |
Reference implementation: https://github.com/meteor/meteor/blob/3a2867fc15/packages/random/AbstractRandomGenerator.js | |
""" |
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
--ignore-gpu-blocklist | |
--enable-gpu-rasterization | |
--enable-zero-copy | |
--enable-features=VaapiVideoDecoder | |
--disable-features=UseChromeOSDirectVideoDecoder | |
--use-gl=desktop |
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 json | |
import os.path | |
import httpx | |
context_path = os.path.expanduser("~/.qovery/context.json") | |
with open(context_path) as context_file: | |
context = json.load(context_file) | |
client = httpx.Client( |
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
@hook.subscribe.float_change | |
def center_window(): | |
client = qtile.current_window | |
if not client.floating: | |
return | |
screen_rect = qtile.current_screen.get_rect() | |
center_x = screen_rect.x + screen_rect.width / 2 | |
center_y = screen_rect.y + screen_rect.height / 2 |
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
from libqtile import qtile | |
@hook.subscribe.client_killed | |
def fallback(window): | |
if window.group.windows != {window}: | |
return | |
for group in qtile.groups: | |
if group.windows: | |
qtile.current_screen.toggle_group(group) |
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 | |
date=$(date --rfc-3339=date) | |
mkdir "dump-$date" | |
cd "dump-$date" | |
gphoto2 --auto-detect | |
gphoto2 --get-all-files --skip-existing | |
cd - |
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
from copy import deepcopy | |
from pprint import pprint | |
import boto3 | |
client = boto3.client('route53') | |
def get_values(record): | |
values = record.get("ResourceRecords") |
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 inspect | |
import json | |
import os.path | |
from pytest import fixture | |
def load_fixture(filepath): | |
with open(filepath) as file: | |
return json.load(file) |
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 json | |
def flatten(o): | |
"""Flatten dicts and lists, recursively, JSON-style | |
It's a generator that yields key-value pairs. | |
Example: | |
>>> dict(flatten({"a": [{"b": 1}, [2, 3], 4, {"c.d": 5, True: 6}]})) |
NewerOlder