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
cargo install --list | grep : | awk '{print $1}' | xargs cargo install |
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 java.util.*; | |
import java.util.stream.Collectors; | |
class DistNum { | |
public Integer distance; | |
public Integer num; | |
public DistNum(Integer distance, Integer num) { | |
this.distance = distance; | |
this.num = num; |
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
// http://okmij.org/ftp/tagless-final/JFP.pdf | |
// Self is not HKT so cannot enforce term types | |
trait Symantics { | |
fn int(v: i64) -> Self; | |
fn bool(v: bool) -> Self; | |
// Cannot enforce that add takes int | |
fn add(x: Self, y: Self) -> Self; | |
// Cannot enforce that leq takes int and returns bool |
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 and2 = (x, y) => { | |
if (Boolean(x)) { | |
return Boolean(y) | |
} else { | |
return false | |
} | |
} | |
let or2 = (x, y) => { | |
if (Boolean(x)) { |
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 items = Zotero.getActiveZoteroPane().getSelectedItems(); | |
for (let item of items) { | |
//return item | |
let d = item.getField("libraryCatalog").trim() | |
let p = item.getField("url").trim() | |
//return { d, p } | |
//return p.startsWith("https") | |
if (!p.startsWith("https")) { | |
let u = "https://" + d + p | |
//return u |
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
play_chord [60, 64, 68] | |
sleep 0.5 | |
play_chord [60, 64, 68] | |
sleep 0.5 | |
play_chord [64, 68, 71] | |
sleep 1.5 | |
play_chord [60, 64, 68] | |
sleep 0.5 | |
play_chord [60, 64, 68] | |
sleep 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
-- https://paiza.jp/poh/enkoi-ending/ed57428d | |
-- しゃくとり法 | |
import Data.List | |
main = do | |
t:_ <- map read . words <$> getLine | |
interact $ show . solve t . map read . lines | |
solve :: Int -> [Int] -> Int | |
solve t xs = maximum $ solve' t xs |
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 | |
(define (merge-sort l) | |
(cond | |
[(null? (cdr l)) l] | |
[else (let-values | |
([(l1 l2) (split-in-half l)]) | |
(merge (merge-sort l1) (merge-sort l2)))])) | |
(define (split-in-half l) |
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
-- https://paiza.jp/works/mondai/skillcheck_sample/diff_str?language_uid=haskell | |
{-# LANGUAGE OverloadedStrings #-} | |
import Prelude hiding (getLine, putStrLn) | |
import Data.Text (Text, pack, unpack) | |
import Data.Text.IO (getLine, putStrLn) | |
import Control.Applicative (liftA2) | |
diffStr :: Text -> Text -> Text |
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 tactic.norm_num | |
import data.real.basic | |
import analysis.normed_space.basic | |
open normed_field | |
def lim_inf (f : ℝ → ℝ) (L : ℝ) := | |
∀ ε > 0, ∃ N > (0 : ℝ), | |
∀ x, x > N → ∥f x - L∥ < ε |
NewerOlder