Skip to content

Instantly share code, notes, and snippets.

View aycanirican's full-sized avatar
💭
Lifelong learning

Aycan iRiCAN aycanirican

💭
Lifelong learning
View GitHub Profile
@aycanirican
aycanirican / gist:1887363
Created February 22, 2012 21:19
dragonflybsd v.s. linux - errno access.
aycan: ~$ uname -sm
Linux x86_64
aycan: ~$ cat t.c
#include <errno.h>
f() { return errno; }
aycan: ~$ gcc -c t.c -o t.o
aycan: ~$ objdump -r t.o
@aycanirican
aycanirican / gist:1878613
Created February 21, 2012 20:15
errno in dragonflybsd
% cat t.c
#include <errno.h>
f() { return errno; }
% gcc -c -Wall -Wextra -pedantic t.c
t.c:2: warning: return type defaults to 'int'
% objdump -h t.o
t.o: file format elf64-x86-64
@aycanirican
aycanirican / gist:1870827
Created February 20, 2012 19:15
autoconf fails...dfly demonstration...
% cat configure.ac
AC_INIT([dflytest1], [0.1], [iricanaycan@gmail.com], [dflytest1])
AC_CHECK_TYPES([long long])
# execute "autoconf" and then "./configure", see config.log
@aycanirican
aycanirican / gist:1870743
Created February 20, 2012 19:01
autoconf generates bad test code...dfly3.1
configure:8124: checking for long long
configure:8124: /usr/bin/gcc -c -g -O2 -fno-stack-protector conftest.c >&5
configure:8124: $? = 0
configure:8124: /usr/bin/gcc -c -g -O2 -fno-stack-protector conftest.c >&5
conftest.c: In function 'main':
conftest.c:82: error: expected expression before ')' token
configure:8124: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "The Glorious Glasgow Haskell Compilation System"
@aycanirican
aycanirican / gist:1768136
Created February 8, 2012 10:48
ghc-7.4.1 on dragonflybsd failed.
"inplace/bin/ghc-stage1" -optc-Wall -optc-Wextra -optc-Wstrict-prototypes -optc-Wmissing-prototypes -optc-Wmissing-declarations -optc-Winline -optc-Waggregate-return -optc-Wpointer-arith -optc-Wmissing-noreturn -optc-Wnested-externs -optc-Wredundant-decls -optc-Iincludes -optc-Irts -optc-Irts/dist/build -optc-DCOMPILING_RTS -optc-fno-strict-aliasing -optc-fno-common -optc-fomit-frame-pointer -optc-DRtsWay=\"rts_v\" -H32m -O -Iincludes -Irts -Irts/dist/build -DCOMPILING_RTS -package-name rts -dcmm-lint -i -irts -irts/dist/build -irts/dist/build/autogen -Irts/dist/build -Irts/dist/build/autogen -optc-O2 -c rts/posix/TTY.c -o rts/dist/build/posix/TTY.o
rts/posix/Signals.c: In function 'stg_sig_install':
rts/posix/Signals.c:365:0:
error: 'SA_RESETHAND' undeclared (first use in this function)
rts/posix/Signals.c:365:0:
error: (Each undeclared identifier is reported only once
rts/posix/Signals.c:365:0:
@aycanirican
aycanirican / gist:1740098
Created February 4, 2012 20:55
dragonflybsd pkgsrc: esound-0.2.41 build failed.
===> Checking for vulnerabilities in esound-0.2.41
===> Building for esound-0.2.41
/usr/pkg/bin/bmake all-recursive
Making all in docs
/bin/sh ./libtool --tag=CC --mode=link cc -I/usr/include -I/usr/pkg/include
-I/usr/pkg/include -Wall -L/usr/lib -Wl,-R/usr/lib -L/usr/pkg/lib -Wl,-R/usr
/pkg/lib -o esd esd.o clients.o filter.o mix.o players.o proto.o samples.o l
ibesd.la -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -laudiofile -Wl,-R/usr/pkg/lib -L/usr
/pkg/lib -laudiofile
libtool: link: cc -I/usr/pkgsrc/audio/esound/work/.buildlink/include -Wall -Wl,-
@aycanirican
aycanirican / manyN and manyNtoM
Created November 8, 2010 10:05
attoparsec additions
-- | Match a parser at least @N@ times.
manyN :: Int -> Parser a -> Parser [a]
manyN n p
| n <= 0 = return []
| otherwise = (++) <$> count n p <*> many p
{-# INLINE manyN #-}
-- | Match a parser at least @N@ times, but no more than @M@ times.
manyNtoM :: Int -> Int -> Parser a -> Parser [a]
manyNtoM n m p
#!/bin/sh
# Parameters
HOST="localhost"
USER="user"
PASS="pass"
DB="database"
DDIR="/home/username/dbbackup"
D=`date +%Y%m%d`
DUMP="mysqldump -h $HOST -u $USER -p $PASS $DB"
{-# LANGUAGE TypeFamilies #-}
module JS.Syntax where
import qualified JS.Ann as A
type Expr a = A.Fix (Expression a)
type LVal a = A.Fix (LValue a)
type Stmt a = A.Fix (Statement a)
-- | Js Syntax
{-# LANGUAGE TypeFamilies #-}
module JS.Ann where
-- | annotated fixpoint combinator
data FixA (a ∷ (* → *) → (* → *))
(f ∷ (* → *))
= InA { outa ∷ a f (FixA a f) }
| InF { outf ∷ f (FixA a f) }