Skip to content

Instantly share code, notes, and snippets.

View cybear's full-sized avatar

Björn Söderqvist cybear

  • Greenfield AB
  • Malmo, Sweden
View GitHub Profile
@cybear
cybear / gist:bdf357186de14d44cd97
Created May 14, 2014 07:30
Demodag hilite demoing people
Array.prototype.slice.call (document.querySelectorAll('tr'),0)
.filter(function(el){
var c = el.querySelector('.class_7');
return c&&c.innerText;
})
.map(function(el){
el.setAttribute('style','background:#fff');
return el;
});
@cybear
cybear / raspberry_pi_optimization.md
Last active January 27, 2023 22:17
I read up a little on performance optimization for the Raspberry Pi, and gathered the links before they disappear from my short term memory.

Raspberry Pi general optimization

  • Use a class 10 SD card for best speed. The USB bus can't come much higher than 30MB/s so you don't have to buy any extremely fast ones though. Not all cards are compatible, check the compatibility list: http://elinux.org/RPi_SD_cards
  • Use the HardFloat version of Raspbian instead of the SoftFloat. HF has much faster floating point operations - however SF is required for running Java. So it's either Java or performance, like normal.
  • The official Raspbian image gives low network speeds: http://elinux.org/RPi_Performance#NIC
  • A graphics driver by Simon / teh_orph is using hardware acceleration for some instructions: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=63&t=28294 installation instructions: http://elinux.org/RPi_Xorg_rpi_Driver
  • The firmware can be upgraded which gives, among other things, better GPU performance.
@cybear
cybear / gist:4112833
Created November 19, 2012 18:52
nodejitsu error
info: Updating app x
info: Activating snapshot 0.0.3-4 for x
info: Starting app x
error: Error running command deploy
error: Nodejitsu Error (500): Internal Server Error
error: There was an error while attempting to deploy the app
error:
error: Rackspace Error (404): Item not found
error: Error output from Haibu:
error:
@cybear
cybear / loadimages.js
Created July 7, 2012 10:26
image loader
define(
function(){
"use strict";
return function(urls, success){
var imgs, counter=0;
function isEverythingDone(){
counter++;
console.log('Loaded '+counter+' of '+urls.length+': '+this.src+' '+this.width+'*'+this.height);
if(counter == urls.length) {
@cybear
cybear / gist:3010928
Created June 28, 2012 11:57
Some of my font hacks
@cybear
cybear / gist:2932726
Created June 14, 2012 20:24
PSP browser document.body attributes
aLink: string
attributes: object
background: string
bgColor: string
childNodes: object
className: string
clientHeight: number
clientWidth: number
dir: string
firstChild: object
@cybear
cybear / gist:2788461
Created May 25, 2012 14:35
curl results
curl -k -I https://raw.github.com/suhajdab/modl/master/devices.json
HTTP/1.1 200 OK
Server: nginx/1.0.13
Date: Fri, 25 May 2012 14:34:32 GMT
Content-Type: text/plain; charset=utf-8
Connection: keep-alive
Status: 200 OK
X-RateLimit-Limit: 100
X-Frame-Options: deny
X-RateLimit-Remaining: 100
@cybear
cybear / gist:2626657
Created May 7, 2012 08:28
Visual Studio products and descriptions
Visual Studio 11 Ultimate Beta is the comprehensive ALM offering for
organizations developing and operating highly scalable software
applications and services.
Visual Studio 11 Premium Beta offers an integrated ALM solution to
bring together stakeholders, users, and software development functions
to deliver compelling applications as a unified team.
Visual Studio 11 Professional Beta is a unified development experience
that enables developers to create multi-tier applications across the
@cybear
cybear / dbMiddleware.js
Created January 27, 2012 12:38
Database Middleware proof of concept
function dbMiddleware(req, res, next){
db.collection('people', function(err, collection){
if(!err){
collection.find().toArray(function(err, items){
if(!err){
req.db=items;
next();
} else next('Sad collection');
})
} else next('Sad DB');
@cybear
cybear / achievements.js
Created January 20, 2012 18:11
Achievements POC
var tools={
consonants:'BCDFGHJKLMNPQRSTVWXZ',
vowels:'AEIOUY'
};
var achievements=[
{
name:'Seven Stones',
description:'Laid all 7 tiles in one word',
fn:function(move){return (move.replace(/\s/g,'').length===7)}
},