Skip to content

Instantly share code, notes, and snippets.

View objarni's full-sized avatar

Olof Bjarnason objarni

View GitHub Profile
@objarni
objarni / adv_tech.md
Last active May 21, 2016 10:23
adv tech overview

![Overview image][overview]

Components in the adv project

The architecture is based on message passing via websockets.

On the Raspberry PI, three different TCP servers are running:

  1. A web-server, for serving the static web content index.html and client.js.
Loosely ordered by necessity to me
==================================
ColorSublime (to browse online schemes)
Schemr (to quickly switch scheme using Alt+F5)
Themr (to install and switch theme)
SublimeLinter
SublimeLinter-flake8 (obs! kräver att flake8 pip package är tillgängligt vid subl-start)
SublimeAStyleFormatter (to properly format C++ code)
Color Highlighter (to visually see #RRGGBB colors in web code)
@objarni
objarni / Install Gulp.txt
Last active January 16, 2023 13:30
Installing gulp in Windows
1. Install nodejs. https://nodejs.org/en/
2. Check npm (node package manager) is installed via command prompt:
$ npm
3. Install gulp:
$ npm install gulp --global
4. In relevant project folder, create 'gulpfile.js':
# coding: utf-8
def ask(s):
print("Duck: " + s)
input("You: ")
print("")
def rubberduck():
print("""
,-.
@objarni
objarni / slumpnamn.html
Created September 30, 2015 11:11
Slumpa ut ett "produktnamn" utifrån listor av strängar
<html>
<header>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<body>
<h1 id='name'></h1>
<button onClick='window.location.reload()'>
Nytt
</button>
@objarni
objarni / book.py
Last active August 29, 2015 14:26
Boka/avboka dator på enklaste sätt - genom att visa som bokad eller ej bokad!
#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk
import gobject
BOOKING_MINUTES = 60
@objarni
objarni / pytddmon_reengineered.py
Last active August 29, 2015 14:23
Sketch of pytddmon re-engineered to a FSM architecture
import Queue
import logging
logging.basicConfig(
format='%(funcName)s: %(message)s',
level=logging.DEBUG
)
class MachineRunner(object):
def __init__(self):
class MachineRunner(object):
"""Simple quantuum programming inspired finite state machine runner"""
def add_machine(self, machine):
self.signal_queue = Queue.Queue() # good for concurrent/threade op!
self.machines.append(machine)
def tick(self):
while self.signal_queue.has_items():
sig = self.signal_queue.pop()
@objarni
objarni / jquery_ajax.html
Last active August 29, 2015 14:21
jQuery+Ajax-exempel
<h1>jQuery demo</h1>
<div id="theDiv">
Detta är en liten text.
</div>
<input id="theButton" type="button" value="Klicka mig!" />
<script type="text/javascript">
$(document).ready(function () {
@objarni
objarni / cutup.py
Created March 11, 2015 20:23
Skära upp Eins bild i bitar
import Image
block = 7
img = Image.open('cutup.png')
w, h = img.size
print 'Image (w,h)=(%d,%d)' % (w,h)
ws, hs = w/float(block), h/float(block)
print 'Sub image (w,h)=(%d,%d)' % (ws, hs)