Skip to content

Instantly share code, notes, and snippets.

View frafra's full-sized avatar

Francesco Frassinelli frafra

View GitHub Profile
@frafra
frafra / disable-video-output.sh
Last active August 29, 2015 14:18
Disable ghosts video outputs on Linux
#!/bin/bash -e
#
# How to run this script:
# $ (source <(curl https://gist.githubusercontent.com/frafra/babfe4c32478923687ea/raw))
DIR=/sys/class/drm
REGEX="(card[0-9]+-(.+))"
OUTPUTS=($(for f in $DIR/*
do [[ $f =~ $REGEX ]] && echo ${BASH_REMATCH[1]} || true
done))
@frafra
frafra / seren-zeroconf.sh
Created May 15, 2015 10:47
Seren autocalling local hosts using zeroconf/avahi
#!/usr/bin/bash
service="_seren._udp"
# Select a random host
host=$(avahi-browse -d local $service -tpr | grep ";$service;" | grep -e '^=;' | sort -R | head -n1)
avahi-publish -s "Seren for $(hostname)" $service 8110 &
pid=$!
if [ -z "$service" ]
@frafra
frafra / keybase.md
Last active January 17, 2018 22:15

Keybase proof

I hereby claim:

  • I am frafra on github.
  • I am frafra (https://keybase.io/frafra) on keybase.
  • I have a public key ASD1qB8afeWaO_4u5Wd4Ug5EIYYyt17plvfPIfK3BMeo9go

To claim this, I am signing this object:

/*
* Copyright (c) 2015, Marco Motta.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
#!/usr/bin/python3
# https://fedoraproject.org/wiki/Packaging:Guidelines#File_and_Directory_Ownership
# Made by Frafra
import collections
import rpm
def depchain_check(pkg, pkgs):
ts = rpm.TransactionSet()
ts.addErase(pkg)
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import xml.etree.ElementTree as ET
def getProperties(entry, ns):
for app_property in entry.findall('apps:property', ns):
name = app_property.attrib['name']
if name in ('forwardTo', 'shouldTrash'):
yield name
@frafra
frafra / fedora-itwiki.md
Last active July 21, 2016 23:59
Stato delle pagine della categoria Italiano sul wiki di Fedora Project
#!/usr/bin/python3
#
# Copyright (C) 2016 - Francesco Frassinelli
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@frafra
frafra / giochino_matematico.py
Created November 16, 2016 22:32
Giochino matematico
#!/usr/bin/python3
import itertools
import operator
seq = [8, 8, 7, 6]
target = 10
ops = [
operator.add,
operator.sub,
@frafra
frafra / mbox2html.py
Last active February 17, 2021 16:34
Mailbox to HTML conversion using Python 3 + Jinja2 in less than 100 lines (including GPLv3 license)
#!/usr/bin/env python3
#
# Copyright (C) 2016 - Francesco Frassinelli
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,