Skip to content

Instantly share code, notes, and snippets.

View cmicali's full-sized avatar

Chris Micali cmicali

View GitHub Profile
/**
* Replaces the DropWizard exception mappers with our own mappers that return exceptions in JSON format
* @param environment
*/
private void configureExceptionMappers(Environment environment) {
ResourceConfig jrConfig = environment.jersey().getResourceConfig();
Set<Object> dwSingletons = jrConfig.getSingletons();
List<ExceptionMapper> singletonsToRemove = new ArrayList<>();
package com.sagedevices.platform.jersey.core;
import com.sagedevices.platform.api.util.StringUtil;
public class RequestId {
public static final String HEADER_NAME_ORIGIN = "X-Origin-Request-Id";
public static final String HEADER_NAME_LOCAL = "X-Local-Request-Id";
public static final String MDC_NAME_LOCAL = "LocalRequestId";
@cmicali
cmicali / pom.xml
Last active August 29, 2015 13:56
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<name>Dropwizard Test</name>
<groupId>com.sagedevices.dropwizard</groupId>
<artifactId>dropwizard-test</artifactId>
public class CurrentUserLoggingFilter implements Filter {
public static final String MDC_CURRENT_ACCOUNT_ID_KEY = "CurrentAccountId";
@Context
HttpContext context;
@Override
public void init(FilterConfig filterConfig) throws ServletException { /* unused */ }
@cmicali
cmicali / gist:6984888
Last active December 25, 2015 13:39
PRU SPI Example
#define NOP MOV r0, r0, r0
#define SPI_TX r8.w0
#define SPI1_SCLK R30.t7
#define SPI1_MOSI R30.t14
#define SPI1_MISO R31.t15
#define SPI1_CS0 R30.t0
#define SPI1_CS1 R30.t1
#define SPI1_CS SPI1_CS0
# Example wpa_supplicant build time configuration
#
# This file lists the configuration options that are used when building the
# hostapd binary. All lines starting with # are ignored. Configuration option
# lines must be commented out complete, if they are not to be included, i.e.,
# just setting VARIABLE=n is not disabling that variable.
#
# This file is included in Makefile, so variables like CFLAGS and LIBS can also
# be modified from here. In most cases, these lines should use += in order not
# to override previous values of the variables.
diff -ru original/core/rtw_mp.c new/core/rtw_mp.c
--- original/core/rtw_mp.c 2012-07-30 13:51:05.000000000 +0100
+++ new/core/rtw_mp.c 2013-04-27 01:03:54.803246633 +0100
@@ -1140,8 +1140,7 @@
_rtw_memset(ptr, payload, pkt_end - ptr);
//3 6. start thread
- pmp_priv->tx.PktTxThread = kernel_thread(mp_xmit_packet_thread, pmp_priv, CLONE_FS|CLONE_FILES);
- if(pmp_priv->tx.PktTxThread < 0)
+ if(!start_kthread(&pmp_priv->tx.PktTxThread, mp_xmit_packet_thread, pmp_priv, "8192cu-mp-xmit"))
#!/bin/bash -e
if [ -f "dist/kernel.tar.gz" ]
then
scp dist/kernel.tar.gz root@BeagleBoneBlack2:/home/root/kernel.tar.gz
ssh root@BeagleBoneBlack2 'tar xovfz ~/kernel.tar.gz -C /; sync;'
else
echo "You must run build.sh first"
#!/bin/bash -e
# Note: You need to have these packages installed (assuming Ubuntu 12.10)
# apt-get install build-essential gcc-arm-linux-gnueabi git lzop u-boot-tools
# Build the kernel
make -j 8 CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm uImage dtbs modules
rm -rf dist
mkdir dist
diff -ru original/core/rtw_mp.c new/core/rtw_mp.c
--- original/core/rtw_mp.c 2012-07-30 13:51:05.000000000 +0100
+++ new/core/rtw_mp.c 2013-04-27 01:03:54.803246633 +0100
@@ -1140,8 +1140,7 @@
_rtw_memset(ptr, payload, pkt_end - ptr);
//3 6. start thread
- pmp_priv->tx.PktTxThread = kernel_thread(mp_xmit_packet_thread, pmp_priv, CLONE_FS|CLONE_FILES);
- if(pmp_priv->tx.PktTxThread < 0)
+ if(!start_kthread(&pmp_priv->tx.PktTxThread, mp_xmit_packet_thread, pmp_priv, "8192cu-mp-xmit"))