Skip to content

Instantly share code, notes, and snippets.

View nvbn's full-sized avatar

Vladimir Iakovlev nvbn

View GitHub Profile
@nvbn
nvbn / indicator.ino
Last active August 29, 2015 14:02
stellaris led indicator
#define LEDS 32
#define ROWS 8
#define IMG 64
#define COLORS 3
#define BLACK 1
#define RED 2
#define GREEN 3
#define BLUE 5
@nvbn
nvbn / order_migrations.py
Created July 29, 2014 00:14
order south migration
from argparse import ArgumentParser
from contextlib import contextmanager
from subprocess import Popen, PIPE
import sys
import os
import re
def git(*args):
resp = Popen(['git'] + list(args), stdout=PIPE, stderr=PIPE)
Jul 30 02:17:51 nvbn-desktop kernel: [ 353.332498] ata6.00: exception Emask 0x10 SAct 0x0 SErr 0x90202 action 0xe frozen
Jul 30 02:17:51 nvbn-desktop kernel: [ 353.332511] ata6.00: irq_stat 0x00400000, PHY RDY changed
Jul 30 02:17:51 nvbn-desktop kernel: [ 353.332521] ata6: SError: { RecovComm Persist PHYRdyChg 10B8B }
Jul 30 02:17:51 nvbn-desktop kernel: [ 353.332527] ata6.00: failed command: FLUSH CACHE
Jul 30 02:17:51 nvbn-desktop kernel: [ 353.332541] ata6.00: cmd e7/00:00:00:00:00/00:00:00:00:00/a0 tag 1
Jul 30 02:17:51 nvbn-desktop kernel: [ 353.332541] res 40/00:04:e8:8e:df/00:00:0a:00:00/40 Emask 0x10 (ATA bus error)
Jul 30 02:17:51 nvbn-desktop kernel: [ 353.332548] ata6.00: status: { DRDY }
Jul 30 02:17:51 nvbn-desktop kernel: [ 353.332558] ata6: hard resetting link
Jul 30 02:17:52 nvbn-desktop kernel: [ 354.955509] ata6: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
Jul 30 02:17:52 nvbn-desktop kernel: [ 354.963561] ata6.00: configured for UDMA/133
@nvbn
nvbn / main.py
Last active August 29, 2015 14:11
pyboard uasyncio CPS example
from uasyncio.core import get_event_loop
from ssd1306 import get_display
from ultrasonic import get_ultrasonic
from utils import get_gyro, alts
def main():
display = get_display(pinout={'sda': 'Y10',
'scl': 'Y9'},
height=64,
(ns bf.core)
(defn bf>
[[stack current]]
(let [new-current (inc current)]
[(if (>= new-current (count stack))
(conj stack 0)
stack)
new-current]))
@nvbn
nvbn / python_collections_sucks.py
Last active August 29, 2015 14:20
python_collections_sucks.py
# python 3:
In [1]: a = {'x': 10, 'y': 50}
In [2]: b = {'a': 5, 'c': 12}
In [3]: a.keys() + b.keys()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-5b3174d08fb5> in <module>()
----> 1 a.keys() + b.keys()
@nvbn
nvbn / core.clj
Created May 24, 2015 21:11
svg-image-example
(ns svg-image-example.core
(:require [om.core :as om :include-macros true]
[om.dom :as dom]))
(defn image
[{:keys [href x y width height]} _]
(reify
om/IRender
(render [_]
(let [html (str "<image x='" x "' y='" y "'"
@nvbn
nvbn / profile.py
Created June 19, 2015 14:02
wwconfig
from .base import BaseConfig
class Config(BaseConfig):
DEBUG = True
ASSETS_DEBUG = True
CSRF_ENABLED = False
FALLBACK_TO_PRODUCTION_IMAGES = True
SERVER_NAME = 'localhost:5000'
@nvbn
nvbn / core.cljs
Created June 23, 2015 15:14
rerenderer samples
(ns ^:figwheel-always rerenderer.examples.core
(:require-macros [cljs.core.async.macros :refer [go-loop go]])
(:require [cljs.core.async :refer [chan <! timeout]]
[rerenderer.examples.bird :as b]
[rerenderer.core :as r :include-macros true]
[rerenderer.browser :refer [browser]]))
(enable-console-print!)
(defn rotating-rectangle
@nvbn
nvbn / core.cljs
Created August 11, 2015 12:23
Shadow Script examples
(ns ^:figwheel-always rerenderer.examples.core
(:require [rerenderer.core :as r :include-macros true]
[rerenderer.browser :refer [interprete]]))
(enable-console-print!)
(def scene (.. js/window -location -hash))
(defn render!
[canvas-id]