Skip to content

Instantly share code, notes, and snippets.

View ramnes's full-sized avatar

Guillaume Gelin ramnes

View GitHub Profile
@ramnes
ramnes / confused.gif
Last active March 20, 2024 18:40
How did this gif end up here?
confused.gif
@ramnes
ramnes / chrome-flags.conf
Created July 13, 2022 15:30
My ~/.local/chrome-flags.conf (enables hardware acceleration for Chrome on Linux)
--ignore-gpu-blocklist
--enable-gpu-rasterization
--enable-zero-copy
--enable-features=VaapiVideoDecoder
--disable-features=UseChromeOSDirectVideoDecoder
--use-gl=desktop
@ramnes
ramnes / meteor_id.py
Last active January 6, 2023 14:11
Create an id such as the ones Meteor creates... in Python!
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
"""
@ramnes
ramnes / qovery_restrict_deployments.py
Created March 29, 2022 14:01
Restrict the deployment of Qovery applications to changes in their root path
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(
#!/bin/bash
# Collect DBUS_SESSION_BUS_ADDRESS from running process
function set_dbus_adress
{
USER=$1
PROCESS=$2
PID=`pgrep -o -u $USER $PROCESS`
ENVIRON=/proc/$PID/environ
@ramnes
ramnes / center_window.py
Created February 5, 2021 22:16
Qtile hook to center all floating windows, until more sensible defaults or a better solution are available
@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
@ramnes
ramnes / etded
Created February 16, 2015 14:59
#!/bin/sh
DAEMON="/home/et/etded"
DAEMON_OPT="+set net_port 27960 +set fs_game etpro +exec server"
DAEMON_USER="et"
DAEMON_NAME="etded.x86"
DAEMON_DESC="Wolfenstein Enemy Territory server"
PATH="/sbin:/bin:/usr/sbin:/usr/bin"
@ramnes
ramnes / fallback.py
Last active January 4, 2021 12:09
Qtile hook to fallback to the first group with windows available when the last window of a group is killed
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)
@ramnes
ramnes / dump.sh
Created December 8, 2020 08:59
Dump any device media content with gphoto2
#!/bin/bash
date=$(date --rfc-3339=date)
mkdir "dump-$date"
cd "dump-$date"
gphoto2 --auto-detect
gphoto2 --get-all-files --skip-existing
cd -
@ramnes
ramnes / route53_trailing_dot.py
Last active June 26, 2020 06:58
Add a trailing dot to all CNAME, MX, NS and PTR records, in all zones, on Route 53
from copy import deepcopy
from pprint import pprint
import boto3
client = boto3.client('route53')
def get_values(record):
values = record.get("ResourceRecords")