Instantly share code, notes, and snippets.

:shipit:
🔥 This is fine 🔥

Alessandro Ghedini ghedo

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am ghedo on github.
  • I am ghedo (https://keybase.io/ghedo) on keybase.
  • I have a public key whose fingerprint is A4F4 55C3 414B 1056 3FCC 9244 AFA5 1BD6 CDE5 73CB

To claim this, I am signing this object:

@ghedo
ghedo / 60fps.py
Last active Jul 3, 2018
VapourSynth script to convert videos to 60fps (with mpv)
View 60fps.py
# Usage: mpv --vf=vapoursynth=60fps.py --hwdec=no <file>
import vapoursynth as vs
core = vs.get_core()
src_fps = 24
dst_fps = 60
clip = core.std.AssumeFPS(video_in, fpsnum=src_fps)
super = core.mv.Super(clip, pel=2)
@ghedo
ghedo / systemd-start-and-wait.go
Last active May 4, 2018
Start a systemd unit and wait until it stops
View systemd-start-and-wait.go
package main
import "log"
import "os"
import "github.com/docopt/docopt-go"
import "github.com/godbus/dbus"
const target string = "org.freedesktop.systemd1";
const object string = "/org/freedesktop/systemd1";
@ghedo
ghedo / ATSHA204.cpp
Last active Dec 4, 2017
Arduino library for the ATSHA204 authentication chip
View ATSHA204.cpp
/*
* Arduino library for the ATSHA204 authentication chip.
*
* The ATSHA204 is a tiny and low-power authentication chip. This library
* implements a simple interface to access most of the chip functionality from
* an Arduino.
*
* Note that only the Single-Wire Interface (SWI) is currently supported.
*
* FEATURES:
@ghedo
ghedo / MMA8452Q.cpp
Last active Aug 11, 2018
Arduino library for the MMA8452Q three-axis accelerometer
View MMA8452Q.cpp
/*
* Arduino library for the MMA8452Q three-axis accelerometer.
*
* The MMA8452Q is a tiny and low-power three-axis accelerometer. This
* library implements a simple interface to access most of the chip
* functionality from an Arduino.
*
* FEATURES:
* + Normal and fast raw axes values reading
* + Scale configuration (allowed 2g, 4g and 8g scales)
@ghedo
ghedo / bipipe.c
Created Aug 13, 2013
Bidirectional pipe
View bipipe.c
/*
* Bidirectional pipe
*
* Compile:
* $ cc -o bipipe bipipe.c
*
* Examples:
*
* * Unix domain socket chat over SSH:
*
@ghedo
ghedo / sleepd.c
Last active Aug 1, 2017
Execute a command after some time of inactivity
View sleepd.c
/*
* Execute a command after some time of inactivity
*
* Compile:
* $ cc -o sleepd sleepd.c
*
* Usage:
* $ ./sleepd -t 600 -c "slock"
*
* NOTE: to run this as a normal (non-root) user you may need to change
@ghedo
ghedo / mouse_wrap.c
Last active Aug 1, 2017
Wrap mouse pointer at screen edges
View mouse_wrap.c
/*
* Wrap mouse pointer at screen edges.
*
* Compile:
* $ cc -o mousewrap mouse_wrap.c -lX11 -lXi
*
* Usage:
* $ ./mwrap
*
* Copyright (C) 2012 Alessandro Ghedini <alessandro@ghedini.me>
@ghedo
ghedo / gist_backup.pl
Last active Nov 8, 2016
Clone all the gists of a GitHub user
View gist_backup.pl
#!/usr/bin/perl
# Usage: gist_backup.pl <user>
# Clone all the gists of a GitHub user
use strict;
use warnings;
use Git::Raw;
use Pithub::Gists;
@ghedo
ghedo / wr
Last active Oct 26, 2015
Translate a word using wordreference.com
View wr
#!/usr/bin/perl
# Usage: wr <term> [<dict>]
# Translate a word using wordreference.com
use strict;
use warnings;
use feature qw(say);