View sense-camera.py
#!/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 |
View raspberrypi-tips.txt
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 |
View cd.html
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="apple-mobile-web-app-capable" content="yes" /> | |
<style> | |
html,body { | |
height:100%; | |
} | |
body { | |
display: table; |
View enable_sigfpe.m
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; |
View get-telldus-ip.sh
# 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/).*//' |
View quick-n-dirty-timer.h
#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 |
View vvector.h
/* | |
* 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 |
View gist:4241968
/* | |
* main.cpp | |
* | |
* Created on: 08.12.2012 | |
* Author: sk | |
*/ | |
#include <iostream> | |
#include <windows.h> |
View test.c
#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; |
View get_pixel_values.m
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; |
NewerOlder