Skip to content

Instantly share code, notes, and snippets.

Avatar
😳

Vehbi Sinan Tunalioglu vst

😳
View GitHub Profile
@vst
vst / aux.hs
Last active Jun 21, 2021
Haskell Auxiliary Module: Interval data definition and functions
View aux.hs
-- | Working with closed intervals.
--
-- See https://gist.github.com/vst/65ac335e452068ac0306dac61eceb13f
--
-- Alternative: https://hackage.haskell.org/package/intervals
{-# LANGUAGE FlexibleContexts #-}
import Control.Monad.Except (MonadError(throwError))
@vst
vst / aux.hs
Last active Jun 21, 2021
Haskell Auxiliary Function: ifM
View aux.hs
-- | See https://gist.github.com/vst/a1a49e0047c8fd24adbd1759bd14f864
--
import Data.Bool (bool)
-- | Monadic version of @if-then-else@.
--
-- >>> ifM (pure False) (pure "Nice") (pure "Oh no!")
-- "Oh no!"
-- >>> ifM (pure True) (pure "Nice") (pure "Oh no!")
@vst
vst / install-hadolint.sh
Created Apr 21, 2021
Install Hadolint (Latest Release)
View install-hadolint.sh
#!/usr/bin/env sh
## URL for the latest release:
_latest="https://api.github.com/repos/hadolint/hadolint/releases/latest"
## Kernel name:
_kernel="$(uname -s)"
## Architecture:
_arch="$(uname -m)"
@vst
vst / Main.hs
Created Apr 9, 2021
Options.Generic Example
View Main.hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeOperators #-}
module Main where
import Data.Char (isUpper, toLower)
@vst
vst / ParseEmail.hs
Created Jun 15, 2020
Demonstrate how to use Stack for scripts (+email address validation)
View ParseEmail.hs
{- stack script
--resolver lts-16.0
--package bytestring
--package email-validate
--ghc-options -Wall
--install-ghc
--compile
-}
-- * Command Line Usage:
@vst
vst / README.md
Created Jun 3, 2020
Some References for RTMP Gateway Application Ideas
View README.md
@vst
vst / README.md
Last active Jun 3, 2020
Expected Qualities of a Modern Data Access Layer backed by an RDBMS (Personal Opinion)
View README.md
  1. High-Level and Accessible: Data should be made available via an API which doesn't require any (1) proprietary, idiosyncratic access technology, (2) custom query language, (3) a particular language, or (4) a particular run-time environment. In other words, users should be able to issue queries using a query language, over a communication protocol and on a run-time environment which they already are familiar with and be able to possess and maintain comfortably on a personal computer with minimal effort and no extra costs.
  2. Liberal: Consumers should be able to issue read/write queries
@vst
vst / inpututils.py
Last active Mar 22, 2020
Various functions to inspect and normalize value inputs
View inpututils.py
"""
This module provides various functions to inspect and normalize value inputs.
Reference: https://gist.github.com/vst/f377006ebe30f3a90d5d54366430ccee
"""
__all__ = ["identity", "strnorm", "is_positive_integer", "as_positive_integer"]
import re
from functools import wraps
@vst
vst / xlsxutils.py
Last active Mar 22, 2020
.xlsx utilities
View xlsxutils.py
"""
This module provides various functions to work with XLSX file.
Reference: https://gist.github.com/vst/269aceb5a54de0adf2cb23e3482895f8
"""
__all__ = ["read_workbook_data", "read_worksheet_data"]
from typing import Any, Dict, Iterable
@vst
vst / README.md
Last active Mar 11, 2020
Setting up an OpenFAAS Gateway (using Docker Swarm)
View README.md

Setting up an OpenFAAS Gateway (using Docker Swarm)

Note: For the Docker Swarm setup, check out the official guide.

bash setup.sh [<OPENFAAS-HOME-DIRECTORY>]

whereby OPENFAAS-HOME-DIRECTORY defaults to /data/openfaas.