Set static IP on the network for the server. Enable L2TP VPN. Port forward TCP 1723, UDP 500, UDP 1701, UDP 4500.
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
module Shorthash where | |
import Data.Digest.Pure.MD5 (md5) | |
import qualified Data.ByteString.Base64 as B64 | |
import qualified Data.Serialize as B | |
import qualified Data.Text.Lazy as L | |
import qualified Data.Text.Lazy.Encoding as T | |
import qualified Data.ByteString as BS |
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
{-# LANGUAGE NoMonomorphismRestriction, OverloadedStrings #-} | |
module Backend.Redis (connect, get, set, R.Connection) where | |
import Control.Monad.IO.Class | |
import qualified Database.Redis as R | |
import Control.Applicative | |
import qualified Data.Text.Lazy as L | |
import qualified Data.Text.Lazy.Encoding as L | |
import qualified Data.Text.Encoding as T |
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 Network.CGI | |
import System.IO | |
import Data.List | |
main :: IO () | |
main = runCGI (handleErrors cgiMain) | |
cgiMain = do | |
uri <- getInputs | |
let urjson = map (\(x, y) -> "\"" ++ x ++ "\": \"" ++ y ++ "\"") uri |
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
newtype ActionM a = AM { runAM :: ErrorT ActionError (ReaderT ActionEnv (StateT Response IO)) a } | |
deriving ( Monad, MonadIO, Functor | |
, MonadReader ActionEnv, MonadState Response, MonadError ActionError) | |
-- backend | |
get :: B.Connection -> L.Text -> ActionM (Maybe L.Text) | |
get b k = do | |
let code = ensureUrl k | |
val <- B.get b (c_of code) | |
case val of |
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
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://google.com"]]; | |
[self.webView loadRequest:request]; | |
bool __block inRac = false; | |
[RACObserve(self, webView.scrollView.contentSize) | |
subscribeNext:^(id x) { | |
if (!inRac) { | |
inRac = true; | |
self.webView.scrollView.contentSize = CGSizeMake(self.webView.frame.size.width, self.webView.scrollView.contentSize.height); | |
inRac = false; |
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
main = do | |
let xs = [0..1024] | |
print $ foldl (\x y -> length y + x) 0 $ lsubs xs | |
lsubs [] = [] | |
lsubs (x:xs) = (foldr (\y ys -> (x, y) : ys) [] xs) : lsubs xs |
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
-- for people too lazy to read the chmod man page | |
import Graphics.Input as Input | |
import Window | |
scene : (Int, Int) -> Element -> [Element] -> Element | |
scene (w, h) strInput strVal = flow down | |
[ container w 100 topLeft strInput, | |
container w (h - 100) topLeft (case strVal of | |
[] -> plainText "wtf" | |
xs -> flow down (map (width 200) xs))] |
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
{-#LANGUAGE GADTs, EmptyDataDecls, DataKinds, KindSignatures #-} | |
-- kind | |
data ListCont = Empty | NonEmpty | |
data SafeList a (b :: ListCont) where | |
Nil :: SafeList a Empty | |
Cons:: a -> SafeList a b -> SafeList a NonEmpty | |
safeHead :: SafeList a NonEmpty -> a |
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
module Main where | |
import System.IO | |
import System.Exit | |
import System.Process | |
import System.Environment | |
main :: IO () | |
main = do | |
args <- getArgs |