Skip to content

Instantly share code, notes, and snippets.

View hdante's full-sized avatar

Henrique hdante

View GitHub Profile
@hdante
hdante / screenrecord-gnome.py
Last active April 18, 2020 13:31
Lossless screencast for Gnome Shell (supports wayland and X)
#!/usr/bin/env python3
from dbus import SessionBus, Interface
from os import getcwd, path
from sys import argv
BUS_NAME = 'org.gnome.Shell.Screencast'
PATH_NAME = '/org/gnome/Shell/Screencast'
INTERFACE_NAME = BUS_NAME
PIPELINE='x264enc pass=qual quantizer=0 speed-preset=ultrafast ! queue ! matroskamux'
@hdante
hdante / uefi_hidpi.c
Created November 26, 2017 06:06
systemd-boot small font HiDPI workaround
#include <efi.h>
#include <efilib.h>
#define SHELL_INTERFACE_PROTOCOL \
{ \
0x47c7b223, 0xc42a, 0x11d2, { 0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, \
0x3b } \
}
typedef struct _EFI_SHELL_ARG_INFO {
@hdante
hdante / replaygain.sh
Created November 5, 2017 01:25
Lossless EBU R128 audio normalization with Matroska tags
#!/bin/sh
set -e
mkvdir=$(mktemp -d)
gaindir=$(mktemp -d)
for i in "$@"; do
ffmpeg -v error -i "$i" -vn -c:a copy "$gaindir"/"$(basename "$i")".mkv
done
bs1770gain --track-tags -o "$mkvdir" -- "$gaindir"/*
@hdante
hdante / sch_eagle_plugin.cpp
Created October 30, 2016 20:05
EAGLE Plugin incomplete
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016 CERN
* Copyright (C) 2016 KiCad Developers, see change_log.txt for contributors.
*
* @author Wayne Stambaugh <stambaughw@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@hdante
hdante / cryptedit
Created January 1, 2015 15:49
cryptedit: transparently edit GPG encrypted text file
#!/usr/bin/env python
# cryptedit: transparently edit GPG encrypted text file
#
# usage:
# - create an encrypted text file:
# gpg -o text.gpg --symmetric text
# - edit it with cryptedit
# cryptedit text.gpg
.L4:
movdqa (%rcx,%rax), %xmm0
pcmpeqb (%rdx,%rax), %xmm0
addq $16, %rax
cmpq $4080, %rax
psubb %xmm0, %xmm1
movdqa %xmm1, %xmm0
jne .L4
#include <emmintrin.h>
#include <stdio.h>
#include <string.h>
int count(const __m128i *string1, const __m128i *string2, int size)
{
const int inner_count = 255;
int max_loop;
int i, j, r;
__m128i acc8, acc32, acc32hi, s1, s2, equal, partial, zero;