Skip to content

Instantly share code, notes, and snippets.

View dhilst's full-sized avatar
😻

Daniel Hilst dhilst

😻
View GitHub Profile
@dhilst
dhilst / termcolors.h
Created July 13, 2016 21:05
Terminal colors
#ifndef _TERMCOLORS_H
#define _TERMCOLORS_H
#define _RED "\x1b[31m"
#define _GREEN "\x1b[32m"
#define _YELLOW "\x1b[33m"
#define _BLUE "\x1b[34m"
#define _MAGENTA "\x1b[35m"
#define _CYAN "\x1b[36m"
#define _RESET "\x1b[0m"
NOTE: Preparing runqueue
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
ERROR: Error executing a python function in /home/geckos/yocto/yocto-daisy/sources/meta-csi-utils/recipes-csicore/libpharosstack-c/libpharosstack-c_1.0.0.bb:
The stack trace of python calls that resulted in this exception/failure was:
File: 'emit_pkgdata', lineno: 136, function: <module>
0132:
0133: bb.utils.unlockfile(lf)
0134:
@dhilst
dhilst / Makefile
Last active August 4, 2016 19:45
mcp2210.ko: device tree settting up
obj-m := nrf24.o
all:
$(MAKE) -C $(KERNEL_SRC) M=$(PWD)
clean:
$(MAKE) -C $(KERNEL_SRC) M=$(PWD) clean
@dhilst
dhilst / glade-preview.c
Created September 17, 2016 19:11
Glade (GTK2) preview
/* borrowed from http://blog.borovsak.si/2009/09/glade3-tutorial-2-constructing.html
* Compilation: ${CC:-cc} ${CFLAGS} ${LDFLAGS} -o glade-preview glade-preview.c $(pkg-config --cflags gtk+-2.0 --libs gtk+-2.0)
*/
#include <gtk/gtk.h>
int main(int argc, char **argv)
{
GtkBuilder *builder;
GtkWidget *window;
GError *error = NULL;
@dhilst
dhilst / utils.c
Last active November 4, 2016 17:29
/*
* The MIT License (MIT)
*
* Copyright (c) <year> <copyright holders>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
public class HelloJNIWorld {
static {
System.loadLibrary("hellonativeworld");
}
static native void helloWorld();
public static void main(String[] args) {
helloWorld();
}
@dhilst
dhilst / gtk-button-helloworld.c
Created September 30, 2016 04:37
gtk-button-helloworld.c
/*
gcc -Wall -o gtk-button-helloworld gtk-button-helloworld.c $(pkg-config --libs --cflags gtk+-2.0)
*/
#include <gtk/gtk.h>
static void button_callback(GtkButton *button, gpointer user_data)
{
g_print(user_data);
}
@dhilst
dhilst / Callback.java
Created October 3, 2016 01:45
JNI Callback
interface CallbackInterface {
public void callback();
}
public class Callback {
static native void nativeCallJavaMethod(CallbackInterface cb);
public static void main(String []args) {
System.loadLibrary("callback");
@dhilst
dhilst / Makefile
Last active October 18, 2016 01:05
Java 2 C++ class maping
JAVA_HOME = /usr/lib/jvm/java-1.8.0-openjdk-amd64
CXXFLAGS += -Wall
CXXFLAGS += -I. -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
all: libpeople_jni.so
clean:
rm People.class libpeople_jni.so People.h
@dhilst
dhilst / Makefile
Created October 7, 2016 21:33
RegisterNatives JNI example
JAVA_HOME = /usr/lib/jvm/java-7-openjdk
CXXFLAGS += -Wall
CXXFLAGS += -I. -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
all: libregisternatives.so RegisterNativesExample.class
clean:
rm RegisterNativesExample.class libregisternatives.so