Skip to content

Instantly share code, notes, and snippets.

##
## Put me in ~/.irssi/scripts, and then execute the following in irssi:
##
## /load perl
## /script load notify
##
use strict;
use Irssi;
use vars qw($VERSION %IRSSI);
package nl.ncim.alc.models
import aj.slick.auth._
trait EndpointComponent { this: ActiveSlick => {
import jdbcDriver.simple._
case class Endpoint(
id: Option[Int],
mac_address: String
@ajrouvoet
ajrouvoet / -
Created September 16, 2014 13:49
import blogimplicits._
class BlogCtrl(db: Database) extends RestFullCtrl(Blogs, db) {
def parseId(s: String) = s.toInt
override val deserializer: PartialFunction[JValue, Blog] = {
case jobj:JObject => (jobj ~ ("author_id", 1))
.extract[Blog](defaultFormats, implicitly[Manifest[Blog]])
}
}
case class Node {
val connections: ListBuffer[Connection] = new ListBuffer[Connection]
}
case class Connection(
from: Node,
val to: Node,
val cost: Int,
private val directed: Boolean = true
) {
from rest_framework import routers, serializers, viewsets
from django.conf.urls import url, include
from core.views import *
class BatchRouter(routers.DefaultRouter):
routes = [
routers.Route(
url=r'^{prefix}{trailing_slash}$',
mapping={
'post': 'batch_create',
AssertionError at /api/1.0/product
Expected view ProductViewSet to be called with a URL keyword argument named "pk". Fix your URL conf, or set the `.lookup_field` attribute on the view correctly.
Request Method: OPTIONS
Request URL: http://localhost:8000/api/1.0/product
Django Version: 1.7
Exception Type: AssertionError
Exception Expected view ProductViewSet to be called with a URL keyword argument named "pk". Fix your URL conf, or set the `.lookup_field` attribute on the view correctly.
@ajrouvoet
ajrouvoet / gist:55e1750a01e991443cb6
Created February 10, 2015 15:51
Should be simple
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#define GPIO_BASE 0x20200000
extern void halt();
volatile unsigned int* gpio_fs4 = (unsigned int*)(GPIO_BASE+0x10);
volatile unsigned int* gpio_set_1 = (unsigned int*)(GPIO_BASE+0x20);
src/kernel.o: file format elf32-littlearm
Disassembly of section .text:
00000000 <kernel_main>:
0: e3a0083f mov r0, #4128768 ; 0x3f0000
4: e59f2040 ldr r2, [pc, #64] ; 4c <__delay_22+0xc>
8: e592c000 ldr ip, [r2]
Xft.antialias: true
Xft.rgba: rgb
Xft.hinting: true
Xft.autohint: true
Xft.hintstyle: hintfull
_∉_ : ∀ {n m} {A : Set n} → A → Vec A m → Set n
a ∉ v = ¬ (a ∈ v)
postulate take' : ∀ {n m} {A : Set n} → (i : Fin m) → Vec A m → Vec A (toℕ i)
-- take' i v = ?
postulate indexof : ∀ {n m a} {A : Set n}
→ (v : Vec A m) → (p : A → Set)
→ Dec (∃ λ i → p (lookup i v) × a ∉ (take' i v))