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
@ghedo
ghedo / Demo.c
Created March 29, 2011 20:11
Haiku demo app
#include "Demo.h"
#include <StringView.h>
#include <Window.h>
Demo::Demo(void) : BApplication("application/x-vnd.Demo") {
BRect rect(150, 150, 500, 500);
BWindow *win = new BWindow(
rect, "Demo",
B_TITLED_WINDOW,
@ghedo
ghedo / httpme
Created April 5, 2011 10:24
Serve static files from current working directory
#!/usr/bin/perl
# Usage: httpme
# Serve static files from current working directory
use Cwd;
use Plack::Runner;
use Plack::App::Directory;
my $runner = Plack::Runner -> new;
@ghedo
ghedo / index.html
Last active February 14, 2019 02:30
Lightweight tooltip plugin for jQuery (http://bl.ocks.org/955408)
<!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{
@ghedo
ghedo / movie_time.c
Last active July 2, 2021 12:56
Utility to hide the mouse cursor and prevent screen blanking (http://blog.ghedini.me/post/2050358022/screensaver-inhibitor)
/*
* 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 / sound_playback.c
Last active March 2, 2024 08:47
Simple sound playback using ALSA API and libasound
/*
* Simple sound playback using ALSA API and libasound.
*
* Compile:
* $ cc -o play sound_playback.c -lasound
*
* Usage:
* $ ./play <sample_rate> <channels> <seconds> < <file>
*
* Examples:
/*
* WAVE file info reader.
*
* Compile:
* $ cc -o wav_info wav_info.c
*
* Usage:
* $ ./wav_info <file>
*
* Examples:
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 / Makefile
Last active January 13, 2022 13:22
Kernel module to disable the ptrace() system call (http://blog.ghedini.me/post/10240771002/kernel-module-to-disable-ptrace)
# 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 / bpipe
Created March 10, 2012 14:59
Pipe stuff to the browser
#!/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"
@ghedo
ghedo / sprunge
Created March 11, 2012 16:21
Paste stuff to sprunge.us
#!/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