Skip to content

Instantly share code, notes, and snippets.

View thotypous's full-sized avatar

Paulo Matias thotypous

View GitHub Profile
@thotypous
thotypous / rtai_3.9.265.gd99c55e.diff
Created October 11, 2015 18:42
RTAI patch with random fixes for amd64
diff --git a/./base/math/Makefile.kbuild.orig b/./base/math/Makefile.kbuild
index d87d924..110a5b9 100644
--- a/./base/math/Makefile.kbuild.orig
+++ b/./base/math/Makefile.kbuild
@@ -7,8 +7,10 @@ EXTRA_CFLAGS += -I$(rtai_srctree)/base/include \
-D_IEEE_LIBM \
-D_ISOC99_SOURCE \
-D_SVID_SOURCE \
+ -D__USE_SVID \
$(rtai_extraopt) \
@thotypous
thotypous / avx_math_test.c
Last active October 11, 2015 13:13
Some AVX-optimized math primitives which might be used to implement SVM with RBF kernel
#include <stdio.h>
#include <immintrin.h>
enum { VecSize = 20 };
#define VEC4(x) { (x), (x), (x), (x) }
#define DBGF4(x) printf("%.10e\n%.10e\n%.10e\n%.10e\n", x[0], x[1], x[2], x[3])
// based on http://stackoverflow.com/a/22454638
static inline double dot_double4(double *a, double *b) {
@thotypous
thotypous / EchoModule.bsv
Last active August 29, 2015 14:20
Simple Avalon MM module for testing IRQ latency, implemented in Bluespec
import AvalonSlave::*;
import InterruptSender::*;
typedef 2 AvalonAddrSize;
typedef 32 AvalonDataSize;
interface EchoModule;
(* prefix="" *)
interface InterruptSenderWires irqWires;
(* prefix="" *)
@thotypous
thotypous / myauth_login.py
Created January 8, 2015 03:14
MyAuth Login Daemon
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# This used to be useful in a time when Altamira-Brazil had only Wireless ISPs
# which were connected to the Internet through VSAT links. The only WISP at
# the time which was stable enough for a small commercial link used to employ
# as its authentication method a captive portal from a product named MyAuth,
# which they acquired from a third party. This was a script to keep it always
# logged in.
#
@thotypous
thotypous / koboflquery.lua
Last active December 22, 2015 03:49
last_FL_duty query testing for Kobo Aura HD with kernel 2.6.35.3
local ffi = require("ffi")
local C = ffi.C
ffi.cdef[[
static const int O_RDONLY = 0;
static const int SEEK_SET = 0;
int open(const char *, int, ...);
int close(int);
long int lseek(int, long int, int) __attribute__((__nothrow__, __leaf__));
int read(int, void *, unsigned int);
]]
@thotypous
thotypous / memread.lua
Created September 1, 2013 02:18
LuaJIT script to read Linux kernel memory in ARM architecture using /dev/mem
local ffi = require("ffi")
local C = ffi.C
ffi.cdef[[
static const int O_RDONLY = 0;
static const int SEEK_SET = 0;
int open(const char *, int, ...);
int close(int);
long int lseek(int, long int, int) __attribute__((__nothrow__, __leaf__));
int read(int, void *, unsigned int);
]]
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/input.h>
#include <mach/hardware.h>
#include <mach/gpio.h>
#include <mach/iomux-mx50.h>
#include <asm/uaccess.h>
//
// SSH & SSL muxer - mux those restrictive proxies
//
// mux_interval
// |
// |\ |
// | \|
// ssl_port -----| \
// | |
// | |---- mux_port
--- aiccu/common/ayiya.c.orig 2007-01-09 20:45:09.000000000 -0200
+++ aiccu/common/ayiya.c 2010-06-01 15:53:30.054314793 -0300
@@ -29,11 +29,19 @@
sha1_byte ayiya_hash[SHA1_DIGEST_LENGTH]; /* SHA1 Hash of the shared secret. */
TLSSOCKET ayiya_socket = NULL;
+static struct TIC_Tunnel *gTunnel = NULL;
+#ifndef _WIN32
+static pthread_t writer_thread = 0;
+#else
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="2"
inherit pax-utils
MY_P="${P/_/-}"