This file contains hidden or 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
class RollingOutputBuffer | |
def initialize(max_lines = 10) | |
@max_lines = max_lines | |
@lines = [] | |
@last_printed = 0 | |
end | |
def <<(line) | |
@lines << line | |
shift if @lines.size > @max_lines |
This file contains hidden or 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
{"Baojun Tian":{"Baojun_Tian_1":{"works":["https://openalex.org/W2019946865","https://openalex.org/W2047378840","https://openalex.org/W2053935835","https://openalex.org/W2139918432","https://openalex.org/W2361050333","https://openalex.org/W2382782442","https://openalex.org/W2576565288","https://openalex.org/W4383333704","https://openalex.org/W4391429274","https://openalex.org/W4401416251"],"institutions":["Inner Mongolia University of Technology","Inner Mongolia University of Technology","Inner Mongolia University of Technology","Inner Mongolia University of Technology"],"subject":"Web service composition, Timed Colored Petri Net, Performance analysis, Computer Science, Software Engineering","titles":"The Performance Analysis of Web Service Composition Based on Timed Colored Petri Net; Formal Modeling and Verification for Web Service Composition; The research of formalizing UML diagram based on HCPNs; Formal modelling and validation for software process based on CPN; Programming thinking of STL based on C; Th |
This file contains hidden or 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
{"Adrien Nougarède":{"adrien-nougarede-1":{"works":["https://openalex.org/W2035075323","https://openalex.org/W2590552425","https://openalex.org/W2783142785","https://openalex.org/W2886260233","https://openalex.org/W2897249717","https://openalex.org/W3006173183","https://openalex.org/W3169142157","https://openalex.org/W3172197942","https://openalex.org/W3185390703","https://openalex.org/W3194982446","https://openalex.org/W4220927123","https://openalex.org/W4224240037","https://openalex.org/W4318245017","https://openalex.org/W4361234916","https://openalex.org/W4361234936","https://openalex.org/W4361235002","https://openalex.org/W4361235035","https://openalex.org/W4361235045","https://openalex.org/W4361235067","https://openalex.org/W4361235080","https://openalex.org/W4361235107","https://openalex.org/W4361235131","https://openalex.org/W4361235154","https://openalex.org/W4361235155","https://openalex.org/W4361235169","https://openalex.org/W4361235183","https://openalex.org/W4361235203","https://openalex.org/W4361 |
This file contains hidden or 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/bin/env python3 | |
import sys | |
import time | |
n = 5 | |
if len(sys.argv) > 1: | |
n = int(sys.argv[1]) | |
# Save the cursor position |
This file contains hidden or 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 { parse } from 'node-html-parser'; | |
const parseRound = (clueRoot, responseRoot) => { | |
const categories: Array<string> = clueRoot.querySelectorAll('td.category_name').map(c => c.rawText); | |
const clues = clueRoot.querySelectorAll('td.clue'); | |
let result: Object<string, object> = {}; | |
categories.forEach(category => { | |
result[category] = []; | |
}) |
This file contains hidden or 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
letters =: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' | |
allWords =: > (#~ (5&=@>@(# each))) }: each cutLF fread 'scrabble.txt' | |
NB. Letters are scored by their frequency's nearness to 50% | |
NB. and duplicates are counted once, since they provide less information. | |
bestWord =: monad define | |
freqs =. (#y) %~ <: #/.~ letters , ,y | |
scores =. ((1 = freqs) * %10) + 0.5 - | 0.5 - freqs | |
score =. [: +/ {&scores@(letters&i.)@~. | |
{. y \: > score"1 y | |
) |
This file contains hidden or 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
require 'nokogiri' | |
require 'json' | |
require 'net/http' | |
require 'cgi' | |
def sanitize(text) | |
CGI.unescapeHTML(Nokogiri::HTML(text).xpath('//text()').to_s) | |
end | |
query_str = URI.escape("{query}") |
This file contains hidden or 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
module Knights where | |
import Control.Monad (guard) | |
import Data.Tree | |
type Point = (Int, Int) | |
prune :: Int -> Tree a -> Tree a | |
prune n _ | n < 1 = error "Can't prune to height < 1" | |
prune 1 (Node x _) = Node x [] |
This file contains hidden or 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
module Element where | |
import Data.List (isPrefixOf, (\\), intercalate) | |
import Control.Monad (guard) | |
import Data.Char (toLower) | |
elements :: [(String, String)] | |
elements = | |
[ ("Ac", "Actinium") | |
, ("Ag", "Silver") |
This file contains hidden or 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
{-# LANGUAGE DeriveFunctor, FlexibleInstances, UndecidableInstances #-} | |
{- | |
A fun exercise: read lambda calculus expressions and convert them to | |
pointfree form in the SKI-calculus (see http://www.madore.org/~david/programs/unlambda/#lambda_elim). | |
Parsing (and output via Show) are written using the conventions at | |
the link above: | |
* Lambda-abstraction is written "^v.E" (equivalent to Haskell "\v -> E") | |
* Application is written "`lr" (equivalent to "l r") | |
Also, note that the conversion function gives binding priority to the |
NewerOlder