Skip to content

Instantly share code, notes, and snippets.

@tkf
tkf / gist:9633166
Created March 19, 2014 00:32
dash and deferred
(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)
def constant(cls):
cls.__repr__ = cls.__reduce__ = lambda self: self.__class__.__name__
return cls()
@constant
class MyConstant(object):
pass
makeSearchCommand({
name: "citeulike-search",
url: "http://www.citeulike.org/search/all?q={QUERY}",
icon: "/favicon.ico",
description: "Searches CiteUlike for your keywords.",
});
@tkf
tkf / x
Created May 16, 2009 10:07
//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",
@tkf
tkf / x
Created May 16, 2009 11:14
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";
#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 */
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]
# -*- coding: utf-8 -*-
import numpy
import pylab
dstr = """\
----------\
---####---\
--######--\
-##----##-\
-##----##-\
@tkf
tkf / Makefile
Created August 23, 2009 07:31
Makefile for rst2latexmath
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\/&/')
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"