Skip to content

Instantly share code, notes, and snippets.

View aristidb's full-sized avatar

Aristid Breitkreuz aristidb

  • Amsterdam, Netherlands
View GitHub Profile
module Aws.Aws
{-( -- * Logging
LogLevel(..)
, Logger
, defaultLog
-- * Configuration
, Configuration(..)
, baseConfiguration
, dbgConfiguration
-- * Transaction runners
{-# LANGUAGE OverloadedStrings #-}
import qualified Aws
import qualified Aws.S3 as S3
import Data.Conduit (($$+-))
import Data.Conduit.Binary (sinkFile)
import Network.HTTP.Conduit (withManager, responseBody)
import Control.Monad.IO.Class
main :: IO ()
{-# LANGUAGE DeriveFunctor, ScopedTypeVariables, ViewPatterns #-}
module ZipStream where
import Control.Applicative
import Data.Monoid
import Data.Foldable
import Data.Traversable
import Test.QuickCheck
import Test.QuickCheck.Gen
@aristidb
aristidb / gist:4751790
Created February 11, 2013 01:01
m ^ n mod p
powModPrime_naive :: Word64 -> Word64 -> Word64
powModPrime_naive m n = fromInteger $ (toInteger m ^ toInteger n) `rem` toInteger prime
powModPrime :: Word64 -> Word64 -> Word64
powModPrime m 0 = 1
powModPrime m 1 = m `rem` prime
powModPrime m n = let (q,p) = n `quotRem` 2
k = powModPrime m q
f = if p == 0 then 1 else m
in (k * k * f) `rem` prime
Leaving directory `/home/aristid/.emacs.d/elpa/s-20130216.1611'
Compiling file /home/aristid/.emacs.d/elpa/s-20130216.1611/s-pkg.el at Wed Feb 20 11:59:09 2013
Entering directory `/home/aristid/.emacs.d/elpa/s-20130216.1611/'
Compiling file /home/aristid/.emacs.d/elpa/s-20130216.1611/s.el at Wed Feb 20 11:59:09 2013
Compiling no file at Wed Feb 20 11:59:09 2013
Leaving directory `/home/aristid/.emacs.d/elpa/weechat-20130220'
Debugger entered--Lisp error: (void-function read-only-mode)
(read-only-mode 1)
(save-current-buffer (set-buffer (get-buffer weechat-relay-buffer-name)) (read-only-mode 1) (set-buffer-multibyte nil) (buffer-disable-undo))
(with-current-buffer (get-buffer weechat-relay-buffer-name) (read-only-mode 1) (set-buffer-multibyte nil) (buffer-disable-undo))
weechat-relay-connect("localhost" 9000 (closure ((password . "yvLPc8dZdMMNk-trMUZu") (port . 9000) (host . "localhost") t) nil (weechat-relay-authenticate password) (weechat-relay-send-command "info version" (lambda (data) (message "Connected to '%s', version %s" host (cdar data)) (weechat-update-buffer-list (lambda nil (weechat-relay-send-command "sync") (setq weechat--connected t) (run-hooks (quote weechat-connect-hook))))))))
(progn (weechat-relay-connect host port (lambda nil (weechat-relay-authenticate password) (weechat-relay-send-command "info version" (lambda (data) (message "Connected to '%s', version %s" host (cdar data)) (weechat-update-buffer-
@aristidb
aristidb / gist:5789059
Created June 15, 2013 18:27
Linux 3.9.6 warnings regarding my Haswell graphics
Jun 15 20:19:09 euphemus kernel: ------------[ cut here ]------------
Jun 15 20:19:09 euphemus kernel: WARNING: at drivers/iommu/dmar.c:483 warn_invalid_dmar+0x8f/0xa0()
Jun 15 20:19:09 euphemus kernel: Hardware name: MS-7823
Jun 15 20:19:09 euphemus kernel: [119B blob data]
Jun 15 20:19:09 euphemus kernel: Modules linked in:
Jun 15 20:19:09 euphemus kernel: Pid: 0, comm: swapper Not tainted 3.9.6 #1
Jun 15 20:19:09 euphemus kernel: Call Trace:
Jun 15 20:19:09 euphemus kernel: [<ffffffff8133eadf>] ? warn_invalid_dmar+0x8f/0xa0
Jun 15 20:19:09 euphemus kernel: [<ffffffff8105263f>] warn_slowpath_common+0x7f/0xc0
Jun 15 20:19:09 euphemus kernel: [<ffffffff810526df>] warn_slowpath_fmt_taint+0x3f/0x50
digits count
0.0 176472744
1.0 310255395
2.0 118922421
3.0 178165178
4.0 12365998
5.0 9810739
6.0 10366160
7.0 23198464
8.0 14479226
$ orifs downloads
An error has occurred!
Problem: orifs may have previously exited uncleanly
Solution:
Check the .ori/tmp/fuse directory for any files that may not have been
saved to the file systems store. You can copy or move these files to
another location. Then delete the .ori/tmp/fuse directory and all
{-# LANGUAGE ScopedTypeVariables #-}
import System.FilePath
import System.Directory
import Control.Exception
dirTree :: FilePath -> IO [FilePath]
dirTree f =
do names <- getDirectoryContents f `catch` (\(_ :: IOException) -> return [])
let paths = (map (f </>) . filter (`notElem` [".", ".."])) names