This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# | |
# Show camera on the sense hat. | |
# | |
# Grab a 96x64 image and then average down to 8x8 for the sense hat | |
# | |
import io | |
import time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Jessie -> Stretch | |
================= | |
$ sudo apt-get update | |
$ sudo apt-get upgrade | |
$ sudo apt-get dist-upgrade | |
$ sudo sed -i /deb/s/jessie/stretch/g /etc/apt/sources.list | |
$ sudo sed -i /deb/s/jessie/stretch/g /etc/apt/sources.list.d/*.list | |
$ sudo apt-get update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="apple-mobile-web-app-capable" content="yes" /> | |
<style> | |
html,body { | |
height:100%; | |
} | |
body { | |
display: table; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fenv_t fe; | |
if (fegetenv(&fe) != 0) { | |
// error | |
} | |
#if defined __arm__ | |
fe.__fpscr |= __fpscr_trap_divbyzero; | |
#elif defined __i386__ | |
fe.__control &= ~FE_DIVBYZERO; | |
fe.__mxcsr &= ~_MM_MASK_DIV_ZERO; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Used in Mac OS X Teminal.app (bash) | |
ping -c 3 255.255.255.255 | grep from | awk '{ print "ping -c 1 -q " $4; }' | sed 's/://' | sort -u | bash > /dev/null ; arp -a | grep ac:ca | sed 's/^.*(//' | sed 's/).*//' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/time.h> | |
#define START_TIMER \ | |
struct timeval _tpStart; \ | |
struct timeval _tpEnd; \ | |
gettimeofday(&_tpStart, NULL) | |
#define STOP_TIMER \ | |
gettimeofday(&_tpEnd, NULL); \ | |
std::cout << "Time: " << (_tpEnd.tv_sec-_tpStart.tv_sec)+(_tpEnd.tv_usec/1000000.0-_tpStart.tv_usec/1000000.0) << "s" << std::endl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* vvector.h | |
* | |
* FUNCTION: | |
* This file contains a number of utilities useful for handling | |
* 3D vectors | |
* | |
* HISTORY: | |
* Written by Linas Vepstas, August 1991 | |
* Added 2D code, March 1993 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* main.cpp | |
* | |
* Created on: 08.12.2012 | |
* Author: sk | |
*/ | |
#include <iostream> | |
#include <windows.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
/* ---------------------------------------------------------------------- | |
This part declare all structs from the "the-structs.def" file | |
*/ | |
#define STRUCT_BEGIN(_name) struct _name { | |
#define STRUCT_END(_name) }; | |
#define STRUCT_FIELD(_type, _name) _type _name; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CGImageRef image = uiimage.CGImage; | |
NSUInteger width = CGImageGetWidth(image); | |
NSUInteger height = CGImageGetHeight(image); | |
// Setup 1x1 pixel context to draw into | |
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); | |
unsigned char rawData[4]; | |
int bytesPerPixel = 4; | |
int bytesPerRow = bytesPerPixel; | |
NSUInteger bitsPerComponent = 8; |