Skip to content

Instantly share code, notes, and snippets.

defmodule BitString.Example do
import BitString
defbitstring data_frame do
_ :: 1
stream_id :: 31
flags :: 8
length :: 24
_ :: 1
_ :: 7
defmodule NumbersInput do
def start do
IO.stream(:stdio, :line)
|> Stream.flat_map(&tokenize/1)
|> Stream.take_while(&(&1 > -1))
end
defp tokenize(line) do
line
|> String.split(" ")
@cogmission
cogmission / QuickTest.py
Last active July 28, 2016 15:53
Example Use of Raw HTM Algorithms
'''
Created on Feb 8, 2015
@author: David Ray
'''
import numpy as np
from nupic.encoders.scalar import ScalarEncoder as ScalarEncoder
from nupic.algorithms.CLAClassifier import CLAClassifier as CLAClassifier
defmodule HammingBench do
use Benchfella
use Bitwise
@n Stream.repeatedly(fn -> Enum.random [0, 1] end)
|> Enum.take(100_000)
|> Enum.join
|> String.to_integer(2)
bench "CharlesO" do
@rb2
rb2 / markdown.syntax
Last active November 18, 2020 23:04
mcedit Markdown syntax
# Markdown syntax highlight config for MC (MidnigntCommander)
# (not full, but usable)
#
# https://gist.github.com/rb2/1f6b23ea5ea848c75a8c
#
# Authors:
# Ruslan Brest, http://rb.labtodo.com, 2013
#
# Usage:
#
# Natural Language Toolkit: WordNet
#
# Copyright (C) 2001-2013 NLTK Project
# Author: Steven Bethard <Steven.Bethard@colorado.edu>
# Steven Bird <stevenbird1@gmail.com>
# Edward Loper <edloper@gradient.cis.upenn.edu>
# Nitin Madnani <nmadnani@ets.org>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
from __future__ import print_function, unicode_literals
@joyrexus
joyrexus / README.md
Created January 5, 2015 18:24
js zip function
@neilgee
neilgee / sidr-init-content.js
Last active December 2, 2021 03:20
Sidr in WordPress
jQuery(document).ready(function($) {
$('#nav-toggle').sidr({
name: 'sidr-right',
side: 'right',
source: '#menu-short, .search-form, .site-title'
});
});
@BinaryMuse
BinaryMuse / README.md
Last active April 20, 2022 21:45
Elixir Map/HashDict Performance on Erlang OTP R17 vs R18
class BiDict(object):
'''
Maps both directions: key->value and value->key
Requires both keys and values are unique. If you pass duplication,
then key/value be overwritten and you get not what expected.
'''
origin = {} # counters the {key->key} case
bidict = {}