Skip to content

Instantly share code, notes, and snippets.

@alepez
alepez / gentoo-arm-chroot-cross-build.md
Created September 27, 2017 14:19
gentoo arm chroot cross build

Install qemu in host

Add this to make.conf:

QEMU_SOFTMMU_TARGETS="arm"
QEMU_USER_TARGETS="arm"

Add this to package.use:

@alepez
alepez / install-peak-drivers-linux.md
Last active September 29, 2017 15:54
Install Peak driver in Linux

Attenzione!

Non installare i driver scaricabili dal sito peak, ma usare quelli nel kernel vanilla.

Il driver giusto è peak_usb:

modprobe peak_usb
@alepez
alepez / android-sdcard-cid.java
Created September 26, 2017 11:44
android sdcard cid
try {
BufferedReader input = new BufferedReader(new FileReader("/sys/block/mmcblk1/device/cid"));
String sd_cid = input.readLine();
Log.i(TAG, "cid:");
Log.i(TAG, sd_cid);
} catch (Exception e) {
Log.e(TAG, "Can not read SD-card cid");
}
/*
* Example 1: exits on SIGINT
*/
#include <iostream>
#include <signal.h>
#include <unistd.h>
bool continueRunning = true;
void sighandler(int signum) {
@alepez
alepez / core-dump.md
Last active June 7, 2017 08:53
core dump

Sistema per salvare lo stato dell'applicazione al momento del crash, per poter debuggare anche dopo il crash.

Possiamo anche usare gdb da x86 per debuggare un'applicazione che girava su arm.

Dal sistema in cui gira applicazione:

Per mettere al massimo il limite della dimensione disponibile per i core dump:

ulimit -c unlimited
@alepez
alepez / 0001-fix-missing-boost-array.patch
Created May 31, 2017 07:12
fix missing boost::array
From 10328d6d369a2218832315162741bd04d35fe85d Mon Sep 17 00:00:00 2001
From: Alessandro Pezzato <alessandro.pezzato@gmail.com>
Date: Wed, 31 May 2017 09:06:03 +0200
Subject: [PATCH] fix missing boost::array
---
include/crow/websocket.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/crow/websocket.h b/include/crow/websocket.h
@alepez
alepez / beep.cpp
Created May 8, 2017 14:50
openal beep with volume
#include <AL/alut.h> // OpenAl
#include <cmath>
#include <iostream>
#include <thread>
using namespace std;
void init_al() {
const char* defname = alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
ALCdevice* dev = alcOpenDevice(defname);
@alepez
alepez / beep.cpp
Last active May 29, 2017 14:02
openal beep
#include <cmath>
#include <iostream>
#include <thread>
using namespace std;
#include <AL/alut.h> // OpenAl
void init_al()
{
@alepez
alepez / eh-receiver.js
Last active April 10, 2017 13:56
EventHub Receiver
const EventHubClient = require('azure-event-hubs').Client;
const Promise = require('bluebird');
const connectionString = '__OBFUSCATED__';
const eventHubPath = 'foo';
const client = EventHubClient.fromConnectionString(connectionString, eventHubPath);
var printError = function(err) {
console.error(err.message);
@alepez
alepez / test-utf8-length.js
Created April 4, 2017 12:05
test utf8 length
(new TextEncoder('utf-8').encode('è'))