Skip to content

Instantly share code, notes, and snippets.

from PIL import Image
im = Image.open("indata.png")
pix = im.load()
pixel_values = list(im.getdata())
counts = {}
(xmax,ymax) = im.size
/**
* Copyright 2015 Andreas Löf
*
* Compilation: gcc -o keyboardtest -lSDL2 keyboardtest.c
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
@aginor
aginor / sdlbug.c
Last active August 29, 2015 14:27
#include <stdio.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#define WIDTH 800
#define HEIGHT 600
#define IMG_PATH "blinky.png"
int main (int argc, char *argv[]) {
@aginor
aginor / AMD-fglrx-3.17-3.19.patch
Last active August 29, 2015 14:09
Patch AMD/ATI catalyst/fglrx 14.301.1001 / 14.9 or 14.501.1003 /14.12 driver to work with linux 3.17.x to 3.19.x kernels (tested on Fedora 20)
--- a/common/lib/modules/fglrx/build_mod/firegl_public.c 2014-11-29 09:02:10.000000000 +1300
+++ b/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-04-18 22:31:06.673656387 +1200
@@ -4816,8 +4816,13 @@
{
unsigned long orig_level;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
orig_level = __get_cpu_var(kasExecutionLevel);
__get_cpu_var(kasExecutionLevel) = level;
+#else
@aginor
aginor / ScriptFromFile.java
Created September 25, 2012 03:27
Added the load functionality to the java javascript scripting engine and deal with
/*
Copyright (C) 2012 Andreas Löf
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of