Skip to content

Instantly share code, notes, and snippets.

@ErikEvenson
ErikEvenson / Gruntfile.js
Created September 4, 2014 02:08
Gruntfile.js with generator-webapp and assemble
// Generated on 2014-09-03 using
// generator-webapp 0.5.0
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// If you want to recursively match all subfolders, use:
// 'test/spec/**/*.js'
@aravindavk
aravindavk / gist:2b4298eeb2d8f949224b
Created September 24, 2014 12:15
Use Shared lib created in Rust from Python
#!/usr/bin/env python
"""
Consumer example to use the shared object created in Rust.
Ref: http://blog.skylight.io/bending-the-curve-writing-safe-fast-native-gems-with-rust/
Rust program: points.rs
use std::num::pow;
pub struct Point { x: int, y: int }
struct Line { p1: Point, p2: Point }
@thypon
thypon / Extract Deps
Created April 24, 2015 23:56
Extract Deps in Ruby
#!/usr/bin/env ruby
require 'rubygems'
require 'gems'
require 'json'
class Package < Struct.new(:name, :language, :version, :hash, :source, :homepage, :depends)
end
class Dependencies < Struct.new(:hostmake, :make, :runtime)
"""
This is an example of how to use Hypothesis to test a classic combinatorial
optimisation problem without having a reference implementation to compare
against.
The problem we're going to look at is the knapsack packing problem: Given a
set of objects with value and weight, how can maximize the total value while
keeping the total weight under a certain amount.
You can solve this exactly as an integer linear programming without too much
@c-spencer
c-spencer / core.clj
Last active December 23, 2015 02:49
Simple demo of type construction from Datomic with core.typed and a little glue
(defn create-type
"Extract a type from provided field idents stored in Datomic database at uri."
[uri type-name overrides]
(let [c (d/connect uri)
d (d/db c)
datomic-type-map {:db.type/string 'String
:db.type/ref 'Any}
mt (dt/q> :- [EntityID]
'[:find ?e
:in $ ?t-name
@stuartsierra
stuartsierra / spellcheck.clj
Created July 9, 2013 01:47
Example implementation of Norvig's Spellchecker in Clojure, using core.async
;; Example implementation of Norvig's Spellchecker in Clojure,
;; using core.async
;;
;; There are probably some bugs in this.
;;
;; Original problem: https://github.com/ericnormand/spelling-jam
;; from Lambda Jam, Chicago, 2013: http://lambdajam.com/
;;
;; Clojure core.async introduction:
;; http://clojure.com/blog/2013/06/28/clojure-core-async-channels.html
This diff is a modified version of a diff written by Arnis Lapsa.
[ The original can be found here: https://gist.github.com/ArnisL/6156593 ]
This diff adds support to tmux for 24-bit color CSI SRG sequences. This
allows terminal based programs that take advantage of it (e.g., vim or
emacs with https://gist.github.com/choppsv1/73d51cedd3e8ec72e1c1 patch)
to display 16 million colors while running in tmux.
The primary change I made was to support ":" as a delimeter as well

CoreOS Workstation Notes

This is a summary of the system setup used for the demonstration on 2016-07-18.

Goals / Requirements

This was put together with the following intent:

  • It must build upon an unmodified CoreOS user space image.
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
@steveklabnik
steveklabnik / Entfremdung.md
Created August 3, 2014 18:15
alienation 101

Quick summary:

Alienation is one of the ways that capitalism sucks. It's a symptom that something's not right, not the underlying cause. Alienation is something that happens because of the way that capitalism is built.

In short, alienation is a separation between things that should be together. This separation causes tension.

Four ways that capitalism is alienating:

From your product of labor