Skip to content

Instantly share code, notes, and snippets.

View nazgee's full-sized avatar

Michal Stawinski nazgee

  • Poland, Wroclaw
View GitHub Profile
@nazgee
nazgee / main.cpp
Created April 16, 2012 07:52
linux file descriptors passing between processes
#include <errno.h>
#include <string.h>
#include <iostream>
#include <sys/types.h> /* See NOTES */
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
michal@e6540:~/workspace/liclipse/plagiat$ time python ./plagiat.py --lowercase --limitoutput 300 --limitinput 5500 --method ComparisonTokenSet
=====
data = pubmed_result.csv
limitinput = 5500
limitoutput = 300
method = ComparisonTokenSet
lowercase = True
=====
max number of combinations to check: 15122250
@nazgee
nazgee / notes.md
Created May 21, 2016 21:32 — forked from natevw/notes.md
Using Bus Blaster v4 with STM32F4x SWD

Using Bus Blaster v4 with STM32F4x SWD

For SWD (instead of normal JTAG) you need a different CPLD "buffer logic" image on the Bus Blaster, the KT-Link compatible ones seem like the recommended means.

# with buffer logic at https://github.com/dergraaf/busblaster_v4/blob/master/ktlink/ktlink.svf
# via http://dangerousprototypes.com/forum/viewtopic.php?f=37&t=5954 from https://github.com/mchck/mchck/wiki/Getting-Started#wiki-bus-blaster
curl -O https://github.com/dergraaf/busblaster_v4/raw/master/ktlink/ktlink.svf
openocd -f board/dp_busblaster_v3.cfg -c "adapter_khz 1000; init; svf /Users/natevw/Downloads/ktlink.svf; shutdown"
switch (format) {
// 32bpp
case GBM_FORMAT_ARGB8888:
case GBM_FORMAT_XRGB8888:
break;
default:
// unsupported...
goto error;
}
static struct gbm_bo *gbm_kms_bo_create(struct gbm_device *gbm,
uint32_t width, uint32_t height,
uint32_t format, uint32_t usage)
{
struct gbm_kms_device *dev = (struct gbm_kms_device*)gbm;
struct gbm_kms_bo *bo;
unsigned attr[] = {
KMS_BO_TYPE, KMS_BO_TYPE_SCANOUT_X8R8G8B8,
KMS_WIDTH, 0,
KMS_HEIGHT, 0,
@nazgee
nazgee / gist:7433663
Created November 12, 2013 16:16
code snippet to request test ads on "unknown" device
public static void addThisDeviceAsTestDevice(AdRequest pAdRequest) {
String android_id = Settings.Secure.getString(GameResources.ACTIVITY.getContentResolver(), Settings.Secure.ANDROID_ID);
String deviceId = md5(android_id).toUpperCase();
pAdRequest.addTestDevice(deviceId);
boolean isTestDevice = pAdRequest.isTestDevice(GameResources.ACTIVITY);
if (!isTestDevice) {
throw new RuntimeException("Failed to use test Ads :(");
}
@nazgee
nazgee / Positioner.java
Created May 7, 2013 13:07
Positioner class for andengine
package eu.nazgee.features.utils;
import org.andengine.entity.IEntity;
public class Positioner {
// ===========================================================
// Constants
// ===========================================================
// ===========================================================
@nazgee
nazgee / gist:4011043
Created November 4, 2012 09:25
GLES2 testing of debug draw
From 37ec12de2624870eca58cbf60860445e4c478de3 Mon Sep 17 00:00:00 2001
From: Michal Stawinski <michal.stawinski@gmail.com>
Date: Sun, 4 Nov 2012 09:20:21 +0100
Subject: [PATCH] Testing of degbugdraw on GLES2
---
project.properties | 1 +
.../examples/PhysicsRevoluteJointExample.java | 75 ++++++++++++++++++++
2 files changed, 76 insertions(+)
@nazgee
nazgee / gist:4011051
Created November 4, 2012 09:26
BROKEN-and-OLD GLES2 testing of debug draw
From bf83c5e8e3b656795c85d0c321e72917900937ad Mon Sep 17 00:00:00 2001
From: Michal Stawinski <michal.stawinski@gmail.com>
Date: Sun, 4 Nov 2012 09:20:21 +0100
Subject: [PATCH] Testing of OLD-and-BROKEN degbugdraw on GLES2
---
project.properties | 1 +
.../examples/PhysicsRevoluteJointExample.java | 75 ++++++++++++++++++++
2 files changed, 76 insertions(+)
@nazgee
nazgee / gist:4010904
Created November 4, 2012 09:22
GLES2-AnchorCenter testing of debug draw
From 237f2dd709e710fbe57413d847bd304f463a6a2a Mon Sep 17 00:00:00 2001
From: Michal Stawinski <michal.stawinski@gmail.com>
Date: Sun, 4 Nov 2012 09:20:21 +0100
Subject: [PATCH] Testing of degbugdraw
---
project.properties | 1 +
.../examples/PhysicsRevoluteJointExample.java | 75 ++++++++++++++++++++
2 files changed, 76 insertions(+)