Skip to content

Instantly share code, notes, and snippets.

Avatar

Minsheng Liu notcome

  • XNZG
  • Hangzhou, China
View GitHub Profile
@notcome
notcome / CrashQueue.cpp
Last active Aug 1, 2017
A simple threading pool backed parallel computing class
View CrashQueue.cpp
#include <iostream>
#include <atomic>
#include <vector>
#include <thread>
#include <functional>
#include <condition_variable>
#include <mutex>
#include <random>
#include <algorithm>
#include <tuple>
@notcome
notcome / transition.html
Created Jun 30, 2017
Slideshow effects with CSS transitions.
View transition.html
<!DOCTYPE html>
<html>
<head>
<title>Transition</title>
<style type="text/css">
#container {
width: 512px;
margin: auto;
height: 512px;
overflow: hidden;
@notcome
notcome / LH.hs
Created May 19, 2017
Liquid Haskell issues
View LH.hs
{-@ LIQUID "--exact-data-con" @-}
{-@ LIQUID "--higherorder" @-}
{-@ LIQUID "--totality" @-}
{-@ LIQUID "--automatic-instances=liquidinstances" @-}
module A where
import qualified Prelude
import Prelude (Char, Int, Bool (..))
import Language.Haskell.Liquid.ProofCombinators
@notcome
notcome / Lib.hs
Created May 5, 2017
Play with FFI in Haskell
View Lib.hs
{-# LANGUAGE CPP, ForeignFunctionInterface #-}
module Lib where
import Data.Word
import Foreign
import Foreign.C.Types
import Foreign.C.Error
import Foreign.C.String
View mmap1.cpp
#include <sys/types.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include <iostream>
int main() {
int fd = open("./test_file", O_RDWR);
@notcome
notcome / runlatex.hs
Created Feb 28, 2017
Haskell as script via Turtle, an example
View runlatex.hs
#!/usr/bin/env stack
-- stack --install-ghc runghc --package turtle
{-# LANGUAGE OverloadedStrings #-}
import Turtle
main = do
containerArg <- format (fp%":/latex") <$> pwd
userArgs <- arguments
@notcome
notcome / Dockerfile
Created Jan 28, 2017
Docker/minsheng/latex: first version
View Dockerfile
FROM debian:sid
MAINTAINER Minsheng Liu <lambda@liu.ms>
RUN apt-get update && apt-get install -y --no-install-recommends \
asymptote \
biber \
chktex \
cm-super \
context \
dvidvi \
@notcome
notcome / battery.css
Last active Jan 4, 2017
Time Battery: show the time left for the current day, in the form of remaining percentage of a battery.
View battery.css
body {
background-color: #1A1A1A;
font-family: -webkit-system-font, sans-serif;
}
main {
width: 300px;
margin-top: calc(40vh - 82px);
margin-left: auto;
@notcome
notcome / POJ1093.Swift
Created Jan 1, 2017
An example of how to employ modern syntactic sugars in writing ACM ICPC code.
View POJ1093.Swift
// POJ 1093
// This problem asks us to justify monospaced texts with a given width.
// For details, see http://poj.org/problem?id=1093.
let email = "Writing e-mails is fun, and with this program, they even look nice."
let width = 25
let words = email.characters.split(separator: " ").map { String($0) }
let metrics: [Int] = words.map { $0.characters.count }
@notcome
notcome / JavaScript.swift
Created Oct 21, 2016
What if we write web app in Swift
View JavaScript.swift
//: Playground - noun: a place where people can play
import Cocoa
var str = "Hello, playground"
class Node {}
class NodeList {}
enum MutationRecord {