Skip to content

Instantly share code, notes, and snippets.

View funrep's full-sized avatar

Karl-Oskar Rikås funrep

View GitHub Profile
-- file: ch04/InteractWith.hs
-- Save this in a source file, e.g. Interact.hs
import System.Environment (getArgs)
interactWith function inputFile outputFile = do
input <- readFile inputFile
writeFile outputFile (function input)
main = mainWith myFunction
lastButOne :: [a] -> a
lastButOne xs =
if xs == [] then "Empty list :P"
if (length xs) == 1 then "You need more items in your list :P"
else last (init xs)
lastButOne :: [a] -> a
lastButOne xs
| xs == [] = "Sorry, empy list!"
| length xs == 1 = "Sorry, too short list!"
| otherwise = last (init xs)
(gdb) bt
#0 WINS_Init () at libs/l_net/l_net_berkley.c:176
#1 0x000000000058cfc6 in Net_Setup () at libs/l_net/l_net.c:330
#2 0x00000000005735c7 in CWatchBSP::SetupListening (this=this@entry=0x949580)
at radiant/watchbsp.cpp:503
#3 0x0000000000573664 in CWatchBSP::DoEBeginStep (this=this@entry=0x949580)
at radiant/watchbsp.cpp:514
#4 0x0000000000573a24 in CWatchBSP::DoMonitoringLoop (this=0x949580, pCmd=pCmd@entry=
0x164c160, sBSPName=<optimized out>, sBSPName@entry=0x1690780 "mcts1")
at radiant/watchbsp.cpp:783
tracepath www.xonotic-gaming.org
1: h85-30-59-72.static.se.alltele.net 0.095ms pmtu 1500
1: h85-30-56-1.static.se.alltele.net 1.610ms
1: h85-30-56-1.static.se.alltele.net 1.120ms
2: 10.11.35.177 2.765ms
3: 10.11.0.2 1.449ms
4: h87-241-80-1.static.se.alltele.net 1.911ms
5: v2021-0-te-3-2.cr2.sth1.se.alltele.net 12.263ms
6: no reply
7: level3.sto01.atlas.cogentco.com 13.087ms
@funrep
funrep / gist:3912901
Created October 18, 2012 16:17
GIT GUIDE FOR HUTTY! XD
first copy paste this in the terminal:
git clone https://github.com/hutty/ps-xonotic.git && cd ps-xonotic && git remote add upstream https://github.com/klrr/ps-xonotic.git && git fetch upstream && mkdir maps textures demos other && git add maps textures other
then add your files and such, also use "git add" for each one and then do:
git commit -m "trololol" && git push origin master
then go to https://github.com/klrr/ps-xonotic and click the pull-request button ;)
@funrep
funrep / gist:3912885
Created October 18, 2012 16:13
for hutty v.2
git add #your files && git commit -m "trololol" && git push origin master
@funrep
funrep / gist:3912864
Created October 18, 2012 16:11
for hutty :P
git clone https://github.com/hutty/ps-xonotic.git && cd ps-xonotic && git remote add upstream https://github.com/klrr/ps-xonotic.git && git fetch upstream && mkdir maps textures demos other && git add maps textures other
reverseString :: [a,b,c] -> [c,b,a]
reverseString [] error "empty string or list"
reverseString [a,b,c] = [c,b,a]
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import System.IO
main = do
xmproc <- spawnPipe "/usr/bin/xmobar /home/klr/.xmobarrc"