This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
; Implementations and examples are inspired by Matt Might's blog posts: | |
; http://matt.might.net/articles/programming-with-continuations--exceptions-backtracking-search-threads-generators-coroutines/ | |
; Note I didn't just copy the code. I implemented it independently, so it looks a lot different from Matt's code. | |
(define (current-continuation) | |
(call/cc (lambda (k) | |
(k k)))) | |
(define (exception) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Simple calculator to calculate the remaining number of days that I can stay in the schengen zone | |
""" | |
from datetime import datetime, timedelta | |
dates = [ | |
"2019-06-28", "2019-07-27", | |
"2019-09-02", "2019-10-05", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* Added by OPAM. *) | |
let () = | |
try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH") | |
with Not_found -> () | |
;; | |
#use "topfind";; | |
#thread;; | |
#camlp4o;; | |
#require "core.top";; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To 侯: | |
我把 | |
And we present a system that's capable of | |
integrating transfer function design results | |
from a group of experts to facilitate the | |
design process of novice users by providing | |
useful interactions that enable flexible | |
navigation in the transfer function feature | |
space and effective visual suggestion. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(let ((a 1)) | |
(define (f x) | |
(define b (+ a x)) | |
(define a 5) | |
(+ a b)) | |
(f 10)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/guile -s | |
!# | |
; Scheme(guile) implementation for http://weibo.com/1822142792/Abqbesr1n?mod=weibotime | |
; include guile pattern matching module | |
(use-modules (ice-9 match)) | |
; transform a list of words to list of lines, with length of line not exceeding line-len | |
(define (words->lines words line-len) | |
(cond ((null? words) '()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var assert = require("assert"), | |
ms = require("ms"); | |
function LimitedAccessObject(opts) { | |
var initial = { | |
times:1, | |
costed:0, | |
autoRefresh:false, | |
refreshInterval:0 | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2013 Jike Inc. All Rights Reserved. | |
# Author: liwei@jike.com | |
from gevent import monkey | |
monkey.patch_all() | |
from gevent.pool import Pool | |
import time | |
from weibo_offline_base.ttypes import PlatForm | |
from hbase_rabbitMQ_interface import HbaseRabbitMQ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A demo for redis transation's strong exception guarantee. | |
""" | |
import logging | |
import redis | |
client = redis.StrictRedis(host="127.0.0.1", | |
port=6379, | |
db=1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import redis | |
client = redis.StrictRedis() | |
client.flushdb() | |
def incr(pipe): | |
value = pipe.get('key') | |
value = int(value) + 1 | |
pipe.multi() | |
pipe.set('key', value) |
NewerOlder