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
-- Problem 1 | |
myLast [] = error "empty list." | |
myLast [x] = x | |
myLast (x:xs) = myLast xs | |
-- Problem 2 | |
myButLast x = head . drop 1 . reverse $ x | |
-- Problem 3 | |
elementAt (x:xs) n = |
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
source ~/.zplug/init.zsh | |
zplug "zplug/zplug" | |
#zplug "zsh-users/zsh-history-substring-search" | |
#zplug "zsh-users/zsh-completions" | |
#zplug "zsh-users/zsh-syntax-highlighting" | |
# Prezto | |
zplug "modules/prompt", from:prezto | |
zstyle ':prezto:module:prompt' theme 'yen3' |
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
#include "gcc-plugin.h" | |
#include "plugin-version.h" | |
#include "tree.h" | |
#include "cgraph.h" | |
#include <string> | |
#include <vector> | |
#include <map> |
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 url("reset-fonts-grids.css"); | |
@import url("hk-pyg.css"); /* for syntax highlighting */ | |
html { background: #f9f9f9; color: black; } | |
body { margin: 10px; font-family: verdana; } | |
fieldset { border: 1px solid #ccc; padding: 1em; } | |
legend { font-weight: bold; margin-left: 1em; padding: 4px; } | |
h1, h2, h3, h4, h5, h6 { font-weight: bold; font-family: Georgia, serif; } | |
table, tr, td, th { border: none; } | |
hr { height: 1px; color: #aaa; background-color: #aaa; border: 0; margin: .2em 0 .2em 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
import io | |
class StringIteratorIO(io.TextIOBase): | |
def __init__(self, iter): | |
self._iter = iter | |
self._left = '' | |
def readable(self): | |
return True |
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
# Credit: https://github.com/hfaran/Tornado-JSON/blob/master/tornado_json/api_doc_gen.py | |
import re | |
import inspect | |
import types | |
import itertools | |
import tornado.web | |
from tornado.web import RequestHandler |
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
goldbach :: Int -> Maybe (Int, Int) | |
goldbach n = let ps = [(x, n-x) | x <- [2..(n `div` 2)], isPrime x, isPrime (n-x)] | |
in safeFst ps | |
where isPrime n = and (map (\x -> n `mod` x /= 0) [2..(n-1)]) | |
safeFst [] = Nothing | |
safeFst (x:xs) = Just 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
FROM ubuntu:18.04 | |
RUN sed -i 's/archive.ubuntu.com/tw.archive.ubuntu.com/g' /etc/apt/sources.list \ | |
&& rm /etc/dpkg/dpkg.cfg.d/excludes \ | |
&& apt update \ | |
&& dpkg -l | grep ^ii | cut -d' ' -f3 | xargs apt install -y --reinstall \ | |
&& apt install -y build-essential git man python cmake\ | |
&& git clone --recursive https://github.com/wsmoses/Tapir-Meta.git \ | |
&& cd /Tapir-Meta \ | |
&& ./build.sh release \ |
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/bin/env python | |
#-*- coding: utf8 -*- | |
from __future__ import print_function | |
from optparse import OptionParser | |
import zipfile | |
from sys import argv, exit | |
from subprocess import Popen, PIPE, check_output | |
import os.path |