Skip to content

Instantly share code, notes, and snippets.

Joan Arnaldich jarnaldich

Block or report user

Report or block jarnaldich

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jarnaldich
jarnaldich / Makefile
Created Feb 27, 2019
[sample makefile for image transformation] takes a directory of input files and performs 2 chained transformations #make #makefile
View Makefile
TXTS=$(shell CMD /C DIR /B Z:\mrsids\params)
OUT=\\icgc.local\dades\datacloud_2\of5m_ETRS89\sid_ed50\\
OUTS=$(patsubst %.tif,$(OUT)%.tif,$(TXTS:.txt=.tif))
SIDS=$(patsubst %.sid,$(OUT)%.sid,$(TXTS:.txt=.sid))
target: $(SIDS)
$(OUT)%.tif : Z:\mrsids\params\%.txt
\\icgc.local\aplicacions\produccio\DFApplications\ICCImageOperationsGeocorrection\exe\ICCImageGeoTransformation.exe < $<
@jarnaldich
jarnaldich / FileWatcher.ps1
Created Feb 6, 2019
Powershell File System Watcher #powershell #watch #filesystem
View FileWatcher.ps1
$w = New-Object System.IO.FileSystemWatcher
$w.Path= pwd
$w.Filter= "*.py"
$w.EnableRaisingEvents = $true
$action = { (&{ cls; $p = $Event.SourceEventArgs.FullPath; python $p }) 2>&1 | Write-Host }
$changed = Register-ObjectEvent $w "Changed" -Action $action
Unregister-Event $changed.Id
@jarnaldich
jarnaldich / parCurl.hs
Created Nov 29, 2018
[Concurrent Curl in Haskell] Concurrency in Haskell #haskell #concurrency #parallel #network
View parCurl.hs
#!/usr/bin/env stack
{- stack --resolver lts-12.20 --install-ghc runghc
--package random --package async --package stm-chans --package wreq --package cassava
-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE DeriveGeneric #-}
import Control.Exception
import Control.Concurrent.Async (mapConcurrently, concurrently)
@jarnaldich
jarnaldich / flightDates.hs
Created Nov 28, 2018
[Using Text.XML.Lens with namespaces] Example of using namespaces for Text.MXL.Lens #haskell #xml #stack #script
View flightDates.hs
#!/usr/bin/env stack
{-
stack
--install-ghc runghc
--package xml-lens
-}
{-# LANGUAGE OverloadedStrings #-}
module Main where
import System.Environment (getArgs)
import Text.XML
@jarnaldich
jarnaldich / tick.psm1
Created Jun 6, 2017
Sample Code for Blog Post on Porting Unix Philosophy To Windows
View tick.psm1
function Sample-Count-Files {
[CmdletBinding()]
param(
# The file pattern to count
[Parameter(Mandatory=$true,
Position=0)]
[string]$pattern,
# Name of the log file
@jarnaldich
jarnaldich / SumXmlField.hs
Created Mar 31, 2017
Add fields from a directory tree with XML files using lenses, Directory Tree
View SumXmlField.hs
#!/usr/bin/env stack
{-
stack
--resolver lts-4.2
--install-ghc runghc
--package xml-lens
--package directory-tree
-}
{-# LANGUAGE OverloadedStrings #-}
module Main where
@jarnaldich
jarnaldich / my-match-lambda.rkt
Created Oct 24, 2014
Racket genericity with match-lambda clauses
View my-match-lambda.rkt
#lang racket
(provide my-match-lambda*
(struct-out my-match-lambda-procedure)
my-match-lambda-append
my-match-lambda-add-clause!
my-match-lambda-add-overriding-clause!
(struct-out exn:fail:my-match-lambda:no-match)
(struct-out exn:fail:my-match-lambda:no-match:next-clause)
raise-my-match-lambda:no-match-error)
You can’t perform that action at this time.