Skip to content

Instantly share code, notes, and snippets.

View ghedo's full-sized avatar
:shipit:
🔥 This is fine 🔥

Alessandro Ghedini ghedo

:shipit:
🔥 This is fine 🔥
View GitHub Profile
package main
import "fmt"
import "net"
import "sync"
import "strings"
import "github.com/miekg/dns"
func handleRequest(w dns.ResponseWriter, r *dns.Msg) {

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 November 15, 2021 19:31
VapourSynth script to convert videos to 60fps (with mpv)
# 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 13:51
Start a systemd unit and wait until it stops
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 November 26, 2019 12:35
Arduino library for the ATSHA204 authentication chip
/*
* 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 August 11, 2018 16:57
Arduino library for the MMA8452Q three-axis accelerometer
/*
* 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 August 13, 2013 14:22
Bidirectional pipe
/*
* Bidirectional pipe
*
* Compile:
* $ cc -o bipipe bipipe.c
*
* Examples:
*
* * Unix domain socket chat over SSH:
*
@ghedo
ghedo / sleepd.c
Last active July 5, 2020 10:21
Execute a command after some time of inactivity
/*
* 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 July 2, 2021 11:58
Wrap mouse pointer at screen edges
/*
* 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 September 1, 2021 18:25
Clone all the gists of a GitHub user
#!/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;