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 / jsonpretty.c
Last active Oct 5, 2015
Stupid JSON prettifier
View jsonpretty.c
/*
* Stupid JSON prettifier.
*
* Compile:
* $ cc -o j jsonpretty.c -ljansson
*
* Usage:
* $ ./j < <file>
* $ cat <file> | ./j
*
@ghedo
ghedo / ffi_raw_file.pl
Last active Oct 4, 2015
FFI::Raw and stdio's FILE
View ffi_raw_file.pl
#!/usr/bin/perl
use strict;
use warnings;
use FFI::Raw;
use IO::Handle;
my $fopen = FFI::Raw -> new(
'libc.so.6', 'fopen',
@ghedo
ghedo / sprunge
Created Mar 11, 2012
Paste stuff to sprunge.us
View sprunge
#!/bin/sh -e
# Usage: sprunge < <file>
# Paste stuff to sprunge.us
if [ -t 0 ]; then
echo "Usage: sprunge < some_file.txt"
else
curl -sF 'sprunge=<-' http://sprunge.us < /dev/stdin
fi
@ghedo
ghedo / bpipe
Created Mar 10, 2012
Pipe stuff to the browser
View bpipe
#!/bin/sh -e
# Usage: bpipe [-h|--html]
# Pipe stuff to the browser
if [ -t 0 ]; then
echo "Usage: echo '<h1>some stuff</h1>' | bpipe"
else
opt=`getopt -o h --long html -n bpipe -- "$@"`
eval set -- "$opt"
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; }')
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/
View wav_info.c
/*
* WAVE file info reader.
*
* Compile:
* $ cc -o wav_info wav_info.c
*
* Usage:
* $ ./wav_info <file>
*
* Examples:
@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 / 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>
@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{
You can’t perform that action at this time.