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 Control.Monad (liftM) | |
import Numeric.LinearAlgebra (readMatrix, multiply, rank, cols, rows, fromBlocks) | |
main = do | |
putStrLn "Enter matrix A (in format \"1 2 3; 4 5 6; 7 8 9\")" | |
a <- getMatrix | |
putStrLn "Enter matrix B (in format \"1; 2; 3\")" |
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 Numeric.LinearAlgebra | |
import Control.Monad (replicateM) | |
import System.Random (randomIO) | |
import Graphics.Gnuplot.Simple (plotFunc) | |
-- Test 100 random lines for convexity. | |
main = replicateM 100 $ do | |
-- Two 5x5 symmetric positive definite matrices that determine the line. | |
a <- randomSnPD 5 | |
v <- randomSnPD 5 |
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 qualified Data.ByteString.Char8 as B | |
import System.Hardware.Serialport (SerialPort, recv) | |
recvLn :: SerialPort -> IO B.ByteString | |
recvLn s = do | |
-- Receive one byte at a time. | |
first <- recv s 1 | |
rest <- if first == B.singleton '\n' | |
then return $ B.empty | |
else recvLn s |
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
-- Imports for serial port | |
import qualified Data.ByteString.Char8 as B | |
import System.Hardware.Serialport | |
(openSerial, recv, closeSerial, defaultSerialSettings) | |
-- Imports for threading and stuff | |
import Control.Monad (void, forever, mapM_) | |
import Control.Concurrent (forkIO, killThread) | |
import Control.Concurrent.Chan | |
(Chan, newChan, dupChan, writeChan, getChanContents) |
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
-- http://hackage.haskell.org/package/atom | |
-- http://hackage.haskell.org/package/atom-msp430 | |
module Main where | |
import Data.Word | |
import Data.Bits | |
import Language.Atom.MSP430 | |
main = mspCompile "g2231" $ mspProgram { |
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
(defun python-find-python-command (&optional root) | |
"Return the python interpreter to use for ROOT." | |
(let ((env-root (local-path | |
(locate-dominating-file | |
(or root default-directory) "bin/python")))) | |
(or (when env-root (concat env-root "bin/python")) | |
python-python-command))) | |
(defun python-find-project-root (&optional start) |
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
(defun local-path (path) | |
"Return the local portion of a path. | |
If PATH is local, return it unaltered. | |
If PATH is remote, return the remote diretory portion of the path." | |
(if (tramp-tramp-file-p path) | |
(elt (tramp-dissect-file-name path) 3) | |
path)) | |
(defun python-find-python-command (&optional root) |
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
(defun sql-connect* (connection &optional new-name) | |
(interactive | |
(list (sql-read-connection "Connection: " nil '(nil)) | |
current-prefix-arg) | |
nil) | |
(require 'tramp) | |
(let ((dir (cadr (assoc 'default-directory | |
(cdr (assoc connection sql-connection-alist)))))) | |
(if dir | |
(let ((default-directory dir)) |
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
;; Scratch | |
;; This program helps keep a record of ideas. | |
;; Last edit: 2012-07-05 | |
;; Every time (scratch) is called a new buffer is opened. Title | |
;; is today's date appended before a user inputed title. | |
;Needed features | |
;* An interactive shell that shows me a list of entries | |
; from a certain time period. |
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
;; -*- Mode: Emacs-Lisp ; Coding: utf-8 -*- | |
;; for Emacs 24 | |
;;; modes(UI) | |
(tool-bar-mode -1) | |
(when (and window-system (>= emacs-major-version 23)) | |
(set-face-attribute 'default nil | |
:family "Migu 2M" | |
:height 160)) |
OlderNewer