Skip to content

Instantly share code, notes, and snippets.

;; -*- mode: emacs-lisp; lexical-binding: t -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Layer configuration:
This function should only modify configuration layer settings."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
;; `+distribution'. For now available distributions are `spacemacs-base'
@xiaolzha
xiaolzha / reader_state_monads.hs
Last active October 9, 2015 07:19
Combine reader monad and state monad
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad.State.Strict
import Data.Text
import qualified Data.HashMap.Strict as M
import Control.Monad
import Control.Monad.Reader
import Prelude hiding (unwords)
@xiaolzha
xiaolzha / gist:3987283
Created October 31, 2012 14:20
dnsmasq
interface=wlan0
dhcp-range=net:wlan0,192.168.0.100,192.168.0.150,255.255.255.0,1440m
dhcp-option=wlan0,3,192.168.0.1
dhcp-option=wlan0,6,208.67.222.222,208.67.220.220
@xiaolzha
xiaolzha / gist:3986556
Created October 31, 2012 11:29
ipforward cmd
#!/bin/bash
# broadcasting interface
BROADCAST="wlan0"
# receiving interface broadcast is connected to
RECEIVE="eth0"
if [[ $1 == "-0" || $1 == "--start" ]]
then
@xiaolzha
xiaolzha / gist:3986550
Created October 31, 2012 11:28
hostapd.conf
##### hostapd configuration file ##############################################
# Empty lines and lines starting with # are ignored
# AP netdevice name (without 'ap' postfix, i.e., wlan0 uses wlan0ap for
# management frames); ath0 for madwifi
interface=wlan0
# In case of madwifi, atheros, and nl80211 driver interfaces, an additional
# configuration parameter, bridge, may be used to notify hostapd if the
# interface is included in a bridge. This parameter is not used with Host AP
@xiaolzha
xiaolzha / recursion_demo.py
Created May 1, 2012 07:42 — forked from tiye/recursion_demo.py
recursion of ESC
#change to Python 3.x and fixed a bug
import types
cursor = '\t'
def recur(arr, cursorList, result):
if arr == []:
return (result , cursorList)
head = arr[0]
@xiaolzha
xiaolzha / MongoDB.hs
Created April 24, 2012 06:57 — forked from mightybyte/MongoDB.hs
Snap.Snaplet.Auth.Backends.MongoDB
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
module Snap.Snaplet.Auth.Backends.MongoDB
( initMongoAuth
) where
------------------------------------------------------------------------------
import Control.Arrow