Skip to content

Instantly share code, notes, and snippets.

@swenzel
swenzel / live_plot.py
Last active Sep 2, 2015
Live spike raster plot for PyNEST
View live_plot.py
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Version 2, December 2004
#
# Copyright (C) 2015 Swen Wenzel <swenzel@uos.de>
#
# Everyone is permitted to copy and distribute verbatim or modified
# copies of this license document, and changing it is allowed as long
# as the name is changed.
#
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@rednaxelafx
rednaxelafx / Notes.md
Created Nov 17, 2011
java.lang.InternalError: a fault occurred in a recent unsafe memory access operation in compiled Java code
View Notes.md

Error message:

2011-11-17 09:32:51,715 [ajp-0.0.0.0-8009-3] ERROR com.alibaba.citrus.webx.impl.WebxRootControllerImpl - Error occurred while process request /
java.lang.InternalError: a fault occurred in a recent unsafe memory access operation in compiled Java code
        at java.nio.Bits.swap(Bits.java:27) ~[na:1.6.0_17]
        at java.nio.Bits.swap(Bits.java:37) ~[na:1.6.0_17]
        at java.nio.DirectByteBuffer.getInt(DirectByteBuffer.java:614) ~[na:1.6.0_17]
        at java.nio.DirectByteBuffer.getInt(DirectByteBuffer.java:624) ~[na:1.6.0_17]
        at com.taobao.common.nmap.Nmap.next2(Nmap.java:135) ~[common-nbeanutils-1.2.0.jar:na]
@paradigmatic
paradigmatic / FASTA.scala
Created Aug 23, 2012
FASTA parser in Scala
View FASTA.scala
import scala.util.parsing.combinator._
object FASTA {
case class Entry( description: String, sequence: String )
def fromFile( fn: String ): List[Entry] = {
val lines = io.Source.fromFile(fn).getLines.mkString("\n")
fromString( lines )
}
View clojure_is_for_aristotelians.md

Clojure is for Aristotelians

I was reading ["Clojure is for Type B Personalities"][2] and it sparked some thoughts I had about the intersection of western philosophy and programming.

One could say Mathematics is an extension of Epistemology. And all theory about computability are an extension of mathematics. I reckon how one thinks about computability and how one writes computable functions are a reflection of a person's natural epistemological tendencies. This is going to be just as unscientific as ["Clojure is for Type B Personalities"][2], but hopefully another

@mountainstorm
mountainstorm / export-group.py
Created Dec 24, 2013
Blender python export script; allows you to render out a scene but with everything not in the chosen group as transparent. Useful if you want to create sprites or use bits of a scene as 2d layers.
View export-group.py
# coding: utf-8
# Copyright (c) 2013 Mountainstorm
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
View AgdaBasics.agda
module AgdaBasics where
apply : (A : Set)(B : A Set) ((x : A) B x) (a : A) B a
apply A B f a = f a
_∘_ : {A : Set}{B : A Set}{C : (x : A) B x Set}
(f : {x : A}(y : B x) C x y)(g : (x : A) B x)
(x : A) C x (g x)
(f ∘ g) x = f (g x)
View HBase-Client-API.scala
package com.chetan.poc.hbase
/**
* Created by chetan on 24/1/17.
*/
import org.apache.spark._
import org.apache.hadoop.hbase.{CellUtil, HBaseConfiguration, TableName}
import org.apache.hadoop.hbase.mapreduce.TableInputFormat
import org.apache.hadoop.hbase.util.Bytes
import org.apache.hadoop.hbase.client._
@MLnick
MLnick / StreamingHLL.scala
Last active Dec 7, 2019
Spark Streaming meets Algebird's HyperLogLog Monoid
View StreamingHLL.scala
import spark.streaming.StreamingContext._
import spark.streaming.{Seconds, StreamingContext}
import spark.SparkContext._
import spark.storage.StorageLevel
import spark.streaming.examples.twitter.TwitterInputDStream
import com.twitter.algebird.HyperLogLog._
import com.twitter.algebird._
/**
* Example of using HyperLogLog monoid from Twitter's Algebird together with Spark Streaming's
@jkbradley
jkbradley / LDA_SparkDocs
Created Mar 24, 2015
LDA Example: Modeling topics in the Spark documentation
View LDA_SparkDocs
/*
This example uses Scala. Please see the MLlib documentation for a Java example.
Try running this code in the Spark shell. It may produce different topics each time (since LDA includes some randomization), but it should give topics similar to those listed above.
This example is paired with a blog post on LDA in Spark: http://databricks.com/blog
Spark: http://spark.apache.org/
*/
import scala.collection.mutable