Skip to content

Instantly share code, notes, and snippets.

:shipit:
🔥 This is fine 🔥

Alessandro Ghedini ghedo

Block or report user

Report or block ghedo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ghedo
ghedo / sound_playback.c
Last active Feb 24, 2019
Simple sound playback using ALSA API and libasound
View sound_playback.c
/*
* Simple sound playback using ALSA API and libasound.
*
* Compile:
* $ cc -o play sound_playback.c -lasound
*
* Usage:
* $ ./play <sample_rate> <channels> <seconds> < <file>
*
* Examples:
@ghedo
ghedo / index.html
Last active Feb 14, 2019
Lightweight tooltip plugin for jQuery (http://bl.ocks.org/955408)
View index.html
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="microTip.js"></script>
<title>microTip.js - Extremely lightweight tooltip plugin for jQuery</title>
<style>
p#microtip{
View wav_info.c
/*
* WAVE file info reader.
*
* Compile:
* $ cc -o wav_info wav_info.c
*
* Usage:
* $ ./wav_info <file>
*
* Examples:
View Makefile
ASM=nasm
ISO=genisoimage -input-charset utf-8 -boot-load-size 4 -no-emul-boot -r
all: boot.iso
boot.bin: boot.asm
$(ASM) -o boot.bin boot.asm
boot.iso: boot.bin
mkdir iso/
@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 / 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:
View Makefile
# Copyright (C) 2011 Alessandro Ghedini <alessandro@ghedini.me>
# Updated 2012 by Mike Perry to extract syscall table addresses
# Updated 2014 by Francis Brosnan Blázquez to check for ia32 support
obj-m += noptrace2.o
KERNEL_VER=$(shell uname -r)
SCT := $(shell grep " sys_call_table" /boot/System.map-$(KERNEL_VER) | awk '{ print $$1; }')
SCT32 := $(shell grep "ia32_sys_call_table" /boot/System.map-$(KERNEL_VER) | awk '{ print $$1; }')
@ghedo
ghedo / movie_time.c
Last active Aug 1, 2017
Utility to hide the mouse cursor and prevent screen blanking (http://blog.ghedini.me/post/2050358022/screensaver-inhibitor)
View movie_time.c
/*
* Utility to hide the mouse cursor and prevent screen blanking.
*
* Compile:
* $ cc -o movietime movie_time.c -lX11
*
* Usage:
* $ ./movietime
*
* Copyright (C) 2010 Alessandro Ghedini <alessandro@ghedini.me>
You can’t perform that action at this time.