Skip to content

Instantly share code, notes, and snippets.

@tkf
tkf / gist:9633166
Created Mar 19, 2014
dash and deferred
View gist:9633166
(require 'dash)
(require 'deferred)
(-> (deferred:next (lambda () 1))
(deferred:nextc (lambda (x) (+ x 1)))
(deferred:nextc (lambda (x) (+ x 1)))
(deferred:nextc 'print))
;; (require 'ari)
View gist:155160f6dca716db37ca
def constant(cls):
cls.__repr__ = cls.__reduce__ = lambda self: self.__class__.__name__
return cls()
@constant
class MyConstant(object):
pass
View x
makeSearchCommand({
name: "citeulike-search",
url: "http://www.citeulike.org/search/all?q={QUERY}",
icon: "/favicon.ico",
description: "Searches CiteUlike for your keywords.",
});
View x
//http://itoshi.tv/d/?date=20080901#p02
makeSearchCommand({
name: "oald",
url: "http://www.oup.com/oald-bin/web_getald7index1a.pl?search_word={QUERY}",
icon: "/favicon.ico",
description: "Searches OALD for your keywords.",
});
//http://itoshi.tv/d/?date=20080901#p03
makeSearchCommand({
name: "pubmed",
View x
CmdUtils.CreateCommand({
name: "insert-formula",
takes: {"expression in LaTeX": noun_arb_text},
homepage: "http://arataka.wordpress.com",
author: {name: "Takafumi Arakaki", homepage: "http://arataka.wordpress.com"},
license: "MPL",
preview: function( pblock, what ) {
var base = "https://secure.s21g.com/formula/formulae/preview_with_auth";
View gist:119216
#ifdef NUMPY_DEBUG
static void *NumPyDebug_CheckAndGetPtr(PyArrayObject *aobj,
char *name, int ndim, int *ind)
{
int i;
void *dptr = PyArray_DATA(aobj);
PyGILState_STATE gstate;
if(ndim != PyArray_NDIM(aobj)){
/* specified number of dimentions is not same of its of array */
View lorenz_attractor.py
import scipy
from scipy.integrate import odeint
sin=scipy.sin
cos=scipy.cos
def dydt(y,t0, dl, bt, ro):
return scipy.array([
dl * (y[1] - y[0]),
y[0] * (ro - y[2]) - y[1],
y[0] * y[1] - bt * y[2]
View nmfa.py
# -*- coding: utf-8 -*-
import numpy
import pylab
dstr = """\
----------\
---####---\
--######--\
-##----##-\
-##----##-\
@tkf
tkf / Makefile
Created Aug 23, 2009
Makefile for rst2latexmath
View Makefile
TOOLSROOT=../tools
rst2latex=python ${TOOLSROOT}/rst2latex.py
rst2latexmath=python ${TOOLSROOT}/rst2latexmath.py
rst2mathml=python ${TOOLSROOT}/rst2mathml.py
###
.PHONY: allpdf
allpdf: $(shell find . -name "*.txt" \
| sed -e 's/txt/pdf/' -e 's/.*/_build\/latexmath\/&/')
View color-office2007-foo.plt.txt
set style line 1 lt 1 lc rgbcolor "#4f81bd"
set style line 2 lt 1 lc rgbcolor "#c0504d"
set style line 3 lt 1 lc rgbcolor "#9bbb59"
set style line 4 lt 1 lc rgbcolor "#8064a2"
set style line 5 lt 1 lc rgbcolor "#4bacc6"
set style line 6 lt 1 lc rgbcolor "#f79646"
set style line 7 lt 1 lc rgbcolor "#13256f"
set style line 8 lt 1 lc rgbcolor "#c65c0c"
set style line 9 lt 1 lc rgbcolor "#1e781e"
set style line 10 lt 1 lc rgbcolor "#ce38c7"