Skip to content

Instantly share code, notes, and snippets.

View vst's full-sized avatar
😳

Vehbi Sinan Tunalioglu vst

😳
View GitHub Profile
@vst
vst / mdBook_plugin_gitinfo.py
Last active November 2, 2022 00:25
[mdbook Plugin] Add gitinfo to sidebar
## Usage:
##
## 1. Add this script next to `book.toml` under file name `mdbook_plugin_gitinfo.py`
## 2. Update `book.toml`:
##
## ```toml
## [preprocessor.gitinfo]
## command = "python3 mdbook_plugin_gitinfo.py"
## renderers = ["html"]
## ```
@vst
vst / README.rst
Created January 11, 2012 04:34
Automated management of copyright and licensing notes for individual source code files.

How-to Manage Copyright Notice for Individual Source Code Files

If you want to manage the copyright and licensing information of your source code files automatically, you may use headache tool.

Steps to apply:

@vst
vst / mixins.py
Created September 19, 2012 04:58
Some Django model mixins
# Copyright (c) 2012, Vehbi Sinan Tunalioglu <vst@vsthost.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# - Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
@vst
vst / aux.hs
Last active June 21, 2021 02:44
Haskell Auxiliary Module: Interval data definition and functions
-- | 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 June 21, 2021 02:29
Haskell Auxiliary Function: ifM
-- | 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 April 21, 2021 12:23
Install Hadolint (Latest Release)
#!/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 April 9, 2021 02:42
Options.Generic Example
{-# 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 June 15, 2020 02:46
Demonstrate how to use Stack for scripts (+email address validation)
{- 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 June 3, 2020 07:24
Some References for RTMP Gateway Application Ideas
@vst
vst / README.md
Last active June 3, 2020 01:28
Expected Qualities of a Modern Data Access Layer backed by an RDBMS (Personal Opinion)
  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