This file contains hidden or 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
| {-# LANGUAGE QuasiQuotes #-} | |
| module Lib where | |
| import NeatInterpolation | |
| renderXmlRequest = [text|apple|] |
This file contains hidden or 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
| # Need to install ffcast, and advisedly also xrectsel (on arch can do from AUR) | |
| # Below command will let you select a region with the mouse, than stream it to ffmpeg. | |
| # Many args magic (taken from SO), but allegedly it saves as lossless. | |
| ffcast -s % ffmpeg -f x11grab -show_region 1 -framerate 20 -video_size %s -i %D+%c -codec:v huffyuv -vf crop="iw-mod(iw\\,2):ih-mod(ih\\,2)" out.avi | |
| # Use ImageMagick to covert to gif - works great! | |
| convert -set delay 5 -layers Optimize out.avi out.gif |
This file contains hidden or 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
| data Lista = Megtobb Int Lista | Vege | |
| uresLista :: Lista | |
| uresLista = Vege | |
| egyKetHa :: Lista | |
| egyKetHa = Megtobb 1 (Megtobb 2 (Megtobb 3 Vege)) | |
| hossz :: Lista -> Int | |
| hossz Vege = 0 |
This file contains hidden or 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
| {- | |
| Copyright 2016 Google Inc. | |
| Licensed under the Apache License, Version 2.0 (the "License"); | |
| you may not use this file except in compliance with the License. | |
| You may obtain a copy of the License at | |
| http://www.apache.org/licenses/LICENSE-2.0 | |
| Unless required by applicable law or agreed to in writing, software |
This file contains hidden or 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
| #!/bin/bash | |
| INPDF=$1 | |
| OUTDIR=$2 | |
| ROT=$3 | |
| CONVOPTS=$4 | |
| INBASE=$(basename ${INPDF} .pdf) | |
| TMP=$(mktemp -d) | |
| pdfimages -j ${INPDF} ${TMP}/${INBASE} # emits ppm,pbm or jpg | |
| for i in $(ls ${TMP}/${INBASE}-*.*) | |
| do |
This file contains hidden or 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
| {-# LANGUAGE BangPatterns, OverloadedStrings #-} | |
| import qualified Data.ByteString.Lazy as BL | |
| import Data.Csv | |
| import Data.Char (ord) | |
| import Data.Monoid | |
| import Data.Vector (Vector) | |
| import qualified Data.Vector as V | |
| import Data.Foldable (foldMap) | |
| import qualified Data.Text.Lazy as T | |
| import qualified Data.Text.Lazy.Encoding as T |
This file contains hidden or 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
| function initGL() { | |
| var canvas = document.getElementById("canvas"); | |
| canvas.width = 320; | |
| canvas.height = 480; | |
| gl = canvas.getContext('experimental-webgl'); | |
| gl.disable(gl.DEPTH_TEST); | |
| gl.clearColor(0.5, 0.5, 0.5, 1.0); | |
| var vs = "attribute vec2 a_position;"; | |
| vs += "uniform vec2 u_resolution;"; |
This file contains hidden or 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
| isBlank x = ' ' == x | |
| f (lastBlank, res) ch = | |
| if isBlank ch | |
| then (True, if lastBlank then res else ' ':res) | |
| else (False, ch:res) | |
| g s = reverse $ snd $ foldl f (False, []) s | |
| main = print $ g "x y zzz ff dd e" |
This file contains hidden or 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 System.FilePath | |
| import System.Directory | |
| main = firstWhereM check ["a", "x", "b"] >>= print | |
| where check = doesFileExist . (</>"z"</>"y") | |
| firstWhereM :: (Monad m) => (a -> m Bool) -> [a] -> m (Maybe a) | |
| firstWhereM pred ins = case ins of |
This file contains hidden or 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 Network | |
| import System.IO | |
| import Data.Char (chr, ord) | |
| import Control.Exception (IOException) | |
| import Control.Concurrent (forkIO, threadDelay, killThread) | |
| import Control.Concurrent.MVar | |
| import Control.Monad.IO.Class (MonadIO, liftIO) | |
| import Control.Monad.Trans.Class (lift) | |
| import Control.Monad.Trans.Either | |
| import Control.Monad (liftM) |