Skip to content

Instantly share code, notes, and snippets.

@553224019
553224019 / abracadabra.html
Created February 12, 2020 06:40
yin yang guai qi
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>阴阳怪气</title>
</head>
<body>
<h1>阴阳怪气生成器</h1>
@553224019
553224019 / config.yaml
Created July 17, 2019 08:31
stack config
# This file contains default non-project-specific settings for 'stack', used
# in all projects. For more information about stack's configuration, see
# http://docs.haskellstack.org/en/stable/yaml_configuration/
# The following parameters are used by "stack new" to automatically fill fields
# in the cabal config. We recommend uncommenting them and filling them out if
# you intend to use 'stack new'.
# See https://docs.haskellstack.org/en/stable/yaml_configuration/#templates
setup-info: "http://mirrors.tuna.tsinghua.edu.cn/stackage/stack-setup.yaml"
urls:
@553224019
553224019 / Stopwatch.java
Created June 13, 2019 17:04
Simple stopwatch created using Swing
import javax.swing.*;
import java.awt.*;
public class Stopwatch extends JFrame {
public static void main(String[] s) {
JFrame j = new JFrame();
j.setVisible(true);
j.setSize(200, 300);
j.setResizable(false);
module Calculator (evaluate) where
import Text.ParserCombinators.Parsec
import Data.Either (fromRight)
-- evaluate
evaluate :: String -> Double
evaluate s = fromRight (error "Parse Error!") $ parse expr "" s
@553224019
553224019 / Hamming.hs
Created April 2, 2019 06:00
Comparison between two solutions to hamming numbers in Haskell
module Hamming (ham1, ham2) where
ham1 :: [Integer]
ham1 = 1 :
map (* 2) ham1 `merge`
map (* 3) ham1 `merge`
map (* 5) ham1
merge :: Ord a => [a] -> [a] -> [a]
merge [] l = l
@553224019
553224019 / Hamming.hs
Created April 2, 2019 05:58
Comparison between two solutions to hamming numbers in Haskell
module Hamming (ham1, ham2) where
ham1 :: [Integer]
ham1 = 1 :
map (* 2) ham1 `merge`
map (* 3) ham1 `merge`
map (* 5) ham1
merge :: Ord a => [a] -> [a] -> [a]
merge [] l = l
@553224019
553224019 / CTFSolution.hs
Created March 15, 2019 15:15
A Solution to The CTF Problem in 19/03/15
module Main where
initN :: (Integer, Integer)
initN = (2, 5)
primes :: [Integer]
primes = filter (\k -> null [ x | x <- [2..k - 1], k `mod` x == 0]) [3..73]
getNextN :: (Integer, Integer) -> Integer -> (Integer, Integer)
getNextN (n1, n2) m = case take 2 $ filter (f m) [n1, n2..] of
#lang scheme
(define (next-line-pascal line)
(let ([p (append line '(0))]
[q (append '(0) line)])
(map (lambda (m n) (+ m n)) p q)))
(define (pascal n)
(define lst (list (list 1)))
(for ([i (range n)])
@553224019
553224019 / SafePrintf.idr
Created March 14, 2019 12:12
A Simple Implementation of Type-Safe Printf in Idris
module SafePrintf
data Format =
FNum Format
| FStr Format
| Lit String Format
| End
-- String to Format
toFormat : List Char -> Format