Skip to content

Instantly share code, notes, and snippets.

View vst's full-sized avatar
😳

Vehbi Sinan Tunalioglu vst

😳
View GitHub Profile
@vst
vst / inpututils.py
Last active March 22, 2020 12:30
Various functions to inspect and normalize value inputs
"""
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 / README.md
Last active March 11, 2020 04:02
Setting up an OpenFAAS Gateway (using Docker Swarm)

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.

@vst
vst / README.md
Last active March 11, 2020 03:58
Setting up a Local Docker Registry

Setting up a Local Docker Registry

Note: Follow the official guide.

bash setup.sh myusername mypassword
  • Authentication information is stored under /data/docker/registry/auth.
  • Storage directory is set to be /data/docker/registry/storage.
@vst
vst / packages.list
Last active November 9, 2018 02:02
List of Debian/Ubuntu Packages I usually need on a fresh installation
ack
axel
curl
emacs
git
htop
jq
mc
network-manager
pandoc
@vst
vst / macro.vba
Created September 19, 2018 02:59
Open/Libre Office Save All Sheets as CSV
' Run the SaveAllAsCSV subroutine.
' Creates a CSV file from the active sheet under the given directory.
'
' Based on https://forum.openoffice.org/en/forum/viewtopic.php?t=41284
sub SaveAsCSV(filename As String)
' Declare the document variable:
dim document as object
' Get the document:
#!/usr/bin/env perl
=head1 NAME
sample.pl - Sample Perl Script
=head1 SYNOPSIS
perl sample.pl
perldoc sample.pl
@vst
vst / casts.py
Created December 29, 2015 10:54
"""
Provides a cast operations module.
>>> cast_to_decimal(1.0001)
Decimal('1.0001')
>>> cast_to_decimal(1)
Decimal('1')
>>> cast_to_decimal("1.0001")
Decimal('1.0001')
>>> cast_to_decimal(Decimal("1.0001"))
@vst
vst / setup.py
Last active December 29, 2015 09:39
"""
Provides the setup module.
"""
from ___YOURMODULE___ import __version__
from setuptools import setup
from setuptools import find_packages
import os
## The absolute directory path:
from enum import Enum
from decimal import Decimal
class Currency:
"""
Defines an ISO 4217 compatible currency object model.
>>> Currency("XXX", "My Currency", 2)
<Currency XXX 2 My Currency>
from enum import Enum
from math import inf
class Multiplicity(Enum):
"""
Defines multiplicities.
>>> Multiplicity.OPTIONAL.min
0