Skip to content

Instantly share code, notes, and snippets.

@larme
larme / wrap-json.clj
Created September 15, 2012 19:20
A modified version of wrap-json for handling content-type like: "application/json; charset=UTF-8"
(defn wrap-json [handler]
(fn [req]
(let [content-type (get-in req [:headers "content-type"])
neue (if (and content-type
(some #{"application/json"}
(string/split content-type #";")))
(update-in req [:params] assoc :json
(json/parse-string (slurp (:body req))
true))
@larme
larme / gist:9079789cdb1f2fb72b34
Last active August 29, 2015 14:20
Install lupa on Mac if you cannot install it using package manager like macports or homebrew

Install lupa on Mac if you cannot install it using package manager like macports or homebrew

We use lua 5.1's source codes as a replacement of luajit's source codes.

  1. virtualvenv venv and switch to the virtual enviornment
  2. pip install cython
  3. git clone https://github.com/scoder/lupa.git
  4. cd lupa/, copy lua 5.1 source tarball here and tar zxf it.
  5. go to lua-5.1.5/src then make macosx
  6. Back to lupa's root directory, open setup.py, change the following lines:
ruleSets:
- name: Potatso Config
rules:
- DOMAIN-MATCH,aka,Proxy
- DOMAIN-SUFFIX,edu.cn,DIRECT
- DOMAIN-SUFFIX,cn,DIRECT
- DOMAIN-MATCH,-cn,DIRECT
- DOMAIN-MATCH,360buy,DIRECT
- DOMAIN-MATCH,alipay,DIRECT
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@larme
larme / min-char-rnn.py
Created August 18, 2016 13:24 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@larme
larme / cl-udpip.lisp
Created March 15, 2017 12:11 — forked from shortsightedsid/cl-udpip.lisp
Short guide to UDP/IP Client/Server programming in Common Lisp using usockets
; Short guide to UDP/IP Client/Server programming in Common Lisp using usockets
;
; The main reason for this guide is because there are very few examples that
; explain how to get started with socket programming with Common Lisp that I
; could understand.
; After working on a short example on TCP, I found the
; need for a UDP tutorial. So, here goes.
; As usual, we will use quicklisp to load usocket.
@larme
larme / myweechat.md
Created October 23, 2017 06:26 — forked from pascalpoitras/config.md
My always up-to-date WeeChat configuration (weechat-dev)

WeeChat Screenshot

Enable mouse support

/mouse enable

Encrypted password in sec.conf

Keybase proof

I hereby claim:

  • I am larme on github.
  • I am larme (https://keybase.io/larme) on keybase.
  • I have a public key ASBsH1JDmGatNkAdxbU6BhOOfSm3xM_REByyK6oK0RzQzAo

To claim this, I am signing this object: