Skip to content

Instantly share code, notes, and snippets.

View aperezdc's full-sized avatar
🛋️
Couch-potatoing

Adrian Perez aperezdc

🛋️
Couch-potatoing
View GitHub Profile
@aperezdc
aperezdc / unwindtest.c
Created October 17, 2017 15:18
Example on how to dump stack trace on SIGUSR2, useful if program gets stuck
/*
* unwindtest.c
* Copyright (C) 2017 Adrian Perez <aperez@igalia.com>
*
* Distributed under terms of the MIT license.
*/
#define _GNU_SOURCE
#include <ucontext.h>
#include <dlfcn.h>
@aperezdc
aperezdc / .autoenv.zsh
Created August 24, 2017 12:07
Autoenv snippet for WebKit source trees
#
# Place this in the root directory of a WebKit source tree.
#
# This needs the following Zsh plug-ins:
#
# https://github.com/Tarrasch/zsh-autoenv
# https://github.com/aperezdc/virtualz
#
autostash WEBKIT_TOP_LEVEL="${0:A:h}"
@aperezdc
aperezdc / PKGBUILD.tartan-git.sh
Created August 22, 2017 18:36
Arch Linux PKGBUILD for Tartan
# Maintainer: TingPing <tingping@tingping.se>
pkgname='tartan-git'
pkgver=0.3.0.r14.g5d9a499
pkgrel=1
pkgdesc='Clang analysis plugin for GLib and GNOME'
url='https://www.freedesktop.org/software/tartan/'
arch=('i686' 'x86_64')
provides=('tartan')
conflicts=('tartan')
license=('GPL3')
@aperezdc
aperezdc / jhenv.sh
Created March 3, 2017 13:02
Run a shell (or a command) using an alternate prefix, inspired by JHBuild
#! /bin/bash
# vim: set ts=4 sw=4 noet
#
# jhenv
# Copyright (C) 2017 Adrian Perez <aperez@igalia.com>
#
# Distributed under terms of the MIT license.
#
set -e
@aperezdc
aperezdc / buildroot-config-wpe
Last active July 29, 2019 19:51
Buildroot configuration to build WPE with WebRTC enabled
#
# Automatically generated file; DO NOT EDIT.
# Buildroot 2017.02-rc1-12213-gb8bb78c99 Configuration
#
BR2_HAVE_DOT_CONFIG=y
BR2_HOST_GCC_AT_LEAST_4_5=y
BR2_HOST_GCC_AT_LEAST_4_6=y
BR2_HOST_GCC_AT_LEAST_4_7=y
BR2_HOST_GCC_AT_LEAST_4_8=y
BR2_HOST_GCC_AT_LEAST_4_9=y
@aperezdc
aperezdc / .autoenv.zsh
Created November 2, 2016 17:22
Autoenv scripts to prepare an Android build environment in a directory
# Needs "curl", "sha1sum", some basic shell tools,
# plus the following Zsh plugins installed:
#
# https://github.com/Tarrasch/zsh-autoenv
# https://github.com/aperezdc/virtualz
#
# Drop this file into a new directory as .autoenv.zsh
# and enter it to have a virtualenv configured to use
# for building Android, and the "repo" tool installed
# and ready to be used. Bonus: ccache is configured.

Keybase proof

I hereby claim:

  • I am aperezdc on github.
  • I am aperezdc (https://keybase.io/aperezdc) on keybase.
  • I have a public key ASBkif_OHqrzpx3d7P1K378eO_uN2reqFz2jRmGL3LKgZAo

To claim this, I am signing this object:

@aperezdc
aperezdc / switch-labels-goto.c
Created September 4, 2015 11:13
Jump to label inside a switch statement in C
/*
* Silly example demonstrating that it is valid to jump
* to arbitrary labels inside "switch" statements using
* "goto" in C.
*/
bool is_not_small_power_of_two (int value)
{
if (value < 0) {
/* It is legal to jump into a switch */
@aperezdc
aperezdc / hipack-webservice.html
Created July 24, 2015 06:55
Simple HiPack conversion web service
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>HiPack Web Service Test</title>
<script type="text/javascript">
function convertHiPack() {
var req = new XMLHttpRequest();
req.onload = function () {
if (req.readyState == 4) {
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 Adrian Perez <aperez@igalia.com>
#
# Distributed under terms of the MIT license.
import bottle
import hipack, yaml, json