Skip to content

Instantly share code, notes, and snippets.

View MarchLiu's full-sized avatar

Mars Liu MarchLiu

View GitHub Profile
@alpeware
alpeware / Dockerfile
Created November 21, 2017 09:48
JAQ - Clojure on Google App Engine Java8 Beta Standard Environment [WORK IN PROGRESS]
###
# Main container
#
# (C) 2016, Alpeware
###
ARG BASE_IMAGE
FROM "${BASE_IMAGE}"
ARG USER
@TerrorJack
TerrorJack / gist:95a964c649c325c8bf87
Last active August 29, 2015 14:22
A minimal PEG parsing library.
import Control.Applicative
import Control.Monad.State
import Data.Char
import Data.Function
type Parser = StateT String Maybe
parse :: Parser a -> String -> Maybe (a,String)
parse = runStateT
@14427
14427 / hkt.rs
Last active February 7, 2024 10:18
Higher-kinded type trait
use std::rc::Rc;
trait HKT<U> {
type C; // Current type
type T; // Type with C swapped with U
}
macro_rules! derive_hkt {
($t:ident) => {
impl<T, U> HKT<U> for $t<T> {
#![feature(default_type_params)]
trait FnBox<A,R = ()> {
fn call_box(self: Box<Self>, arg: A) -> R;
}
impl<A,R,F> FnBox<A,R> for F
where F : FnOnce(A) -> R
{
fn call_box(self: Box<F>, arg: A) -> R {
@redinger
redinger / Emacs.md
Created November 26, 2011 03:22
Setting up Emacs daemon on OS X

Setting up Emacs daemon on OS X

Tired of waiting for emacs to start on OS X? This step by step guide will teach you how to install the latest version of emacs and configure it to start in the background (daemon mode) and use emacsclient as your main editor.

Install Cocoa Emacs

Download the latest pretest version of [Emacs for Mac OS X]: http://emacsformacosx.com/builds

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.0</real>
<key>Green Component</key>
<real>0.0</real>
@rcampbell
rcampbell / s3.clj
Created May 11, 2011 10:14
Storing and retrieving Clojure data structures as GZIP compressed JSON in Amazon S3
(ns aws.s3
(:refer-clojure :exclude [get])
(:use [clojure.walk :only (keywordize-keys stringify-keys)]
[clojure.contrib.def :only (defonce-)]
[clojure.contrib.json :only (read-json write-json)])
(:import [java.io PrintWriter InputStreamReader ByteArrayInputStream ByteArrayOutputStream]
[java.util.zip GZIPInputStream GZIPOutputStream]
[com.google.common.base Charsets]
[com.amazonaws.services.s3 AmazonS3Client]
[com.amazonaws.services.s3.model Region CreateBucketRequest ObjectMetadata
@ijt
ijt / http_get.go
Last active August 23, 2021 12:37
Example of using http.Get in go (golang)
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
)