Skip to content

Instantly share code, notes, and snippets.

View saevarb's full-sized avatar

Sævar Berg saevarb

  • NTT Data BS Nordics
  • Odense, Denmark
View GitHub Profile
void reference_dgemm (int N, double ALPHA, double* A, double* B, double* C)
{
int M = N;
int K = N;
double BETA = 1.;
int LDA = N;
int LDB = N;
int LDC = N;
#ifdef LOCAL
cblas_dgemm(CblasColMajor, CblasNoTrans, CblasNoTrans, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC);
foo [] = []
foo ('/':xs) = '/': foo (dropWhile (== '/') xs)
foo (x:xs) = x:foo xs
import Text.Parsec
import Text.Parsec.String
foo [] = []
foo ('/':xs) = '/': foo (dropWhile (== '/') xs)
foo (x:xs) = x:foo xs
partP :: Parser String
partP = do
many1 (char '/')
(defun sbrg:base64-decode-image (arg)
"Treats the currently selected region as a base64 encoded png, decodes it,
saves it to /tmp/first_5_chars_of_base64.png.
If the current major mode is org-mode, the selected region is also replaced
with a link to the image, and the image is displayed inline using
`org-display-inline-images'."
(interactive "P")
(let (encoded filename)
(setq encoded (buffer-substring (region-beginning) (region-end)))
cabal: Use of GHC's environment variable GHC_PACKAGE_PATH is incompatible with
Cabal. Use the flag --package-db to specify a package database (it can be used
multiple times).
ghc-mod: readCreateProcess: cabal "configure" "--with-ghc=ghc" (exit 1): failed
~/programming/haskell/tenten $ ghc-mod check Main.hs
cabal: At least the following dependencies are missing:
MonadRandom -any, gloss -any
ghc-mod: readCreateProcess: cabal "configure" "--with-ghc=ghc" (exit 1): failed
~/programming/haskell/tenten $ stack exec ghc-mod check Main.hs
cabal: Use of GHC's environment variable GHC_PACKAGE_PATH is incompatible with
Cabal. Use the flag --package-db to specify a package database (it can be used
multiple times).
ghc-mod: readCreateProcess: cabal "configure" "--with-ghc=ghc" (exit 1): failed
def permute(list):
j = len(list) - 2
while list[j] > list[j + 1]:
j -= 1
k = len(list) - 1
while list[j] > list[k]:
k -= 1
i = 0
j = 0
for i in range(0, 10):
print((i % 2) * " ", end=" ")
for j in range(0, 4 - i % 2):
print((i % 2 + j * 2, 4 + j - i // 2), end=" ")
print()
# (0, 4) (2, 5) (4, 6) (6, 7)
# (1, 4) (3, 5) (5, 6)
function newtemplate {
filename=$(basename "$(pwd)")
if [[ $1 != "" ]]; then
filename=$1
fi
filename="$filename.tex"
if [[ -a $filename ]]; then
echo "File $filename exists already, quitting."
return 1
fi
{-# LANGUAGE OverloadedStrings #-}
module MonadBot.Plugins.Darchoods
( plugin
) where
import Data.Map.Strict (Map)
import qualified Data.Map.Strict as M
import System.Directory
import qualified Data.Text as T