Skip to content

Instantly share code, notes, and snippets.

@copy
copy / RPN
Created December 6, 2014 15:36
evaluate(Expr) ->
eval(string:tokens(Expr, " ")).
eval(X) ->
lists:foldl(fun eval_single/2, [], X).
eval_single("+", [X, Y|Stack]) -> [X + Y|Stack];
eval_single("-", [X, Y|Stack]) -> [X - Y|Stack];
eval_single("*", [X, Y|Stack]) -> [X * Y|Stack];
eval_single("/", [X, Y|Stack]) -> [X div Y|Stack];
(ns http-loader.core
(:gen-class))
(require '[clj-http.client :as client])
;(require '[pl.danieljanus.tagsoup :as parser])
(require '[net.cgrand.enlive-html :as html])
(require '[net.cgrand.tagsoup :as parser])
(require '[clojurewerkz.urly.core :as url])
(defn grab [url]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int
main(void)
{
for (;;) {
void *x = malloc(4 * 1024);
if (x == NULL) {
function swap(arr, i, j)
{
var t = arr[i];
arr[i] = arr[j];
arr[j] = t;
}
function sorty(arr)
{
var end = arr.length - 1;
Iuppiter.decompress = function(sstart, slen, dstart)
{
slen = slen | 0;
var
src = 0,
dst = 0,
cpy = 0,
copymap = 0,
copymask = 1 << (NBBY - 1 | 0),
function Point(x, y)
{
this.x = x;
this.y = y;
}
Point.prototype.__hash__ = function()
{
return hash_int32array([this.x, this.y]);
};
@copy
copy / gist:3b35ac14461d77dea456
Last active October 9, 2015 13:29
Wolfram Alpha ipython client
"""
A Wolfram Alpha ipython client.
Installation:
1. Put this script into ~/.ipython/profile_default/startup/
2. pip install wolframalpha colorama
3. Get an API key from https://developer.wolframalpha.com/portal/myapps/ and put it into ~/.wolfram_key
Example:
In [1]: wa jacobisymbol[31,37]
module Timeline
type timestamp = nat
type timespan = x:nat{x>0}
type count = nat
type bucket 'a = {
time: timestamp;
content: 'a;
import urllib
import urllib2
import cookielib
import re
username = ''
password = ''
"use strict";
// Format
//
// 000 1 bit integer
// 001 4 bit integer
// 002 8 bit integer
// 003 16 bit integer
// 004 32 bit integer
// 005 32 bit float