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 / 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 / renderlinkarray.js
Created December 16, 2020 21:01
serverside js from 2006
function renderLinkArray(linkArray) {
// rendering the array
kc.pl("<ul>");
for (var i = 0; i < linkArray.length; i++) {
cssClass = linkArray[i].completed ? "check" : "uncheck";
kc.pl('<li class="' + cssClass + '">');
kc.pl("<strong>" + linkArray[i].header + "</strong>");
kc.pl("<br/>");
if (linkArray[i].url.length > 0) {
@cybear
cybear / Why you should learn gh actions.md
Last active April 30, 2020 13:21
Frontenders: This is why you should learn Github Actions

Intro / pitch

  • My code broke the live site. Why didn't it do what I intended for it to do? How did it get all the way to production?

You're probably a frontend developer like me.

In this article I will try to convince you that you should learn to automate some actions for your repo.

Feedback cycles

@cybear
cybear / hire-me.md
Last active June 6, 2019 08:53
Hire me!

Hire me - Raise your frontend to a whole new level

I'm looking for a new gig (contractor / consultant).

Location: Malmö or Lund

Start: August

Some examples of what I can do:

@cybear
cybear / placeholder.svg.js
Created May 6, 2019 18:36
SVG image placeholder with correct dimensions and background color
const prefix = "data:image/svg+xml,";
export default props =>
prefix +
encodeURI(`
<svg
xmlns='http://www.w3.org/2000/svg'
viewBox='0 0 ${props.width} ${props.height}'>
<rect
height='100%'
@cybear
cybear / dl.sh
Created March 22, 2019 19:53
dl.sh
#!/bin/bash
while read path
do
mkdir -p "$path"
svtplay-dl -MAts -o "$path/" "https://www.svtplay.se/$path" &
sleep 15
done < $1
@cybear
cybear / html5_color_clock.html
Created February 27, 2011 15:48
Colour Clock in "HTML5"
<link rel="shortcut icon" type="image/x-icon">
<style>
title{position:absolute;font:8em/8em Arial;top:50%;left:50%;height:1em;margin:-4em 0 0 -2em;text-shadow: 1px 1px 1px #000}
head,title{display:block}
p{opacity:.7}
</style>
<script>
function j(a,b){return Array(++b).join(a)}
function tick(){
var D=new Date,h=D.getHours(),m=D.getMinutes(),s=D.getSeconds(),
@cybear
cybear / dl.sh
Last active October 9, 2017 10:20
SVT Play download all episodes of all shows
#!/bin/bash
while read path
do
mkdir -p "$path"
svtplay-dl -MAts -o "$path/" "https://www.svtplay.se/$path" &
done < $1
@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) {