Skip to content

Instantly share code, notes, and snippets.

@linse
linse / DotBracketToTikz.lhs
Created April 30, 2012 03:51
Convert RNA secondary structure (in dot-bracket notation) to forest in pgf/tikz using Haskell
Data for dot-bracket notation (a.k.a. Vienna notation)
> type Viennachar = Char
> type RNAchar = Char
Data for tree structure
> data Tree a = N a (Forest a) deriving (Show,Eq,Ord)
> type Forest a = [Tree a]
@linse
linse / LoL_sbcl.md
Created June 22, 2012 21:16
Land of Lisp using SBCL instead of CLISP

The CLISP specialty is used when producing a png from the dot file in Chapter 7.

brew install graphviz

which dot -> /usr/local/bin/dot

(defun dot->png (fname thunk)

(with-open-file (standard-output

@linse
linse / Maven Test Output
Created July 28, 2012 20:51
Gibberbot testing problem
mvn -X test -Dandroid.sdk.path="path/to/my/sdk"
Apache Maven 3.0.3 (r1075438; 2011-02-28 12:31:09-0500)
Maven home: /usr/share/maven
Java version: 1.6.0_29, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.7.2", arch: "x86_64", family: "mac"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /usr/share/maven/conf/settings.xml
@linse
linse / time.md
Created September 17, 2012 15:02
Some facts about time

The Unix time command

man time is a good start - on Linux you get the GNU time version.

Note: some shells (e.g.,bash(1)) have a built-in time command that provides less functionality than the command described here. To access the real command, you may need to specify its pathname (something like /usr/bin/time).

GNU time

A call of /usr/bin/time gives a lot of information:

/usr/bin/time ls > /dev/null
@linse
linse / gist:4004161
Created November 2, 2012 20:37
"syntax error near unexpected token" when executing ./configure
The ``syntax error near unexpected token`` means a m4 macro (for me: PKG_CHECK_MODULES) could not be expanded.
This can be a problem of autotoos / aclocal on OSX using homebrew. The tool aclocal is very oldschool and uses m4 macros. These .m4 macros for aclocal are expected to be in ``/usr/share/aclocal``, but homebrew puts them in ``/usr/local/share/aclocal`` without telling aclocal so.
Solution is adding a line ``/usr/local/share/aclocal`` in a ``/usr/share/aclocal/dirlist`` file.
@linse
linse / sierpinski.hs
Created February 23, 2014 06:07
Print the Sierpinski and Pascal triangle in Haskell
instance Num a => Num [a] where -- (1)
(f:fs) + (g:gs) = f+g : fs+gs -- (2)
fs + [] = fs -- (3a)
[] + gs = gs -- (3b)
(f:fs) * (g:gs) = f*g : [f]*gs + fs*(g:gs) -- (4)
_ * _ = [] -- (5)
abs = undefined -- I can't think of a sensible definition
@linse
linse / svn2git.sh
Last active August 29, 2015 13:56
SVN to Git, publish up to specific version
# http://www.sailmaker.co.uk/blog/2013/05/05/migrating-from-svn-to-git-preserving-branches-and-tags-3/
# svn 2 git transformation, with prefix to avoid ambiguity and no metadata to avoid ugly commit messages
git svn -A ../MC-Fold/authors-transform.txt clone --prefix=svn/ --no-metadata -s http://svn.bioinfo.iric.ca/MC-Fold/
cd MC-Fold/
# transform svn branches into local git branches
git branch -r
for branch in `git branch -r | grep -v "svn/tags/" | sed 's/svn\///'`; do
git branch $branch refs/remotes/svn/$branch;
-- this is very simple and also ambiguous, e.g. the open structure will be constructed multiple times
s :: Integer -> [String]
s 2 = [".."]
s 1 = ["."]
s n = (map inbrackets $ s (n-2)) ++ (map adddot $ s (n-1) ) ++ (concatMap branches (splits n))
where
inbrackets a = "("++a++")"
adddot a = '.':a
branches (a,b) = [a'++b' | a' <- s a, b' <- s b ]
@linse
linse / keybase.md
Created April 28, 2014 15:54
keybase.md

Keybase proof

I hereby claim:

  • I am linse on github.
  • I am linse (https://keybase.io/linse) on keybase.
  • I have a public key whose fingerprint is 5148 4174 C54D A514 3342 77BA 2334 6873 8FF9 BABA

To claim this, I am signing this object:

@linse
linse / Makefile
Created May 21, 2014 17:15
Recursive make and make clean
SUBDIRS = src doc whatever
.PHONY: all clean
all clean:
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir -f Makefile $@; \
done