Skip to content

Instantly share code, notes, and snippets.

View gdyrrahitis's full-sized avatar

George Dyrrahitis gdyrrahitis

  • Dublin, Ireland
View GitHub Profile
@gdyrrahitis
gdyrrahitis / main.py
Created July 30, 2023 10:40
Python minimal program setup
def main(cli_args: List[str] = None) -> int:
"""
`cli_args` makes it possible to call this function command-line-style
from other Python code without touching sys.argv.
"""
try:
# Parsing with `argparse` and additional processing
# is usually lenghty enough to extract into separate functions.
raw_config = _parse_cli(
sys.argv[1:] if cli_args is None else cli_args)
@gdyrrahitis
gdyrrahitis / sftp-pod.yml
Created June 20, 2020 15:55
k8s sftp pod
apiVersion: v1
kind: Pod
metadata:
name: sftp
labels:
app: sftp-server
spec:
containers:
- name: sftp-server-demo
image: atmoz/sftp
@gdyrrahitis
gdyrrahitis / sftp-service.yml
Created June 20, 2020 15:55
k8s sftp service
apiVersion: v1
kind: Service
metadata:
name: sftp-service
spec:
selector:
app: sftp-server
ports:
- protocol: TCP
port: 22
@gdyrrahitis
gdyrrahitis / ubuntu-pod.yml
Created June 20, 2020 15:54
Long running ubuntu pod
apiVersion: v1
kind: Pod
metadata:
name: ubuntu1
labels:
app: ubuntu1
spec:
containers:
- name: ubuntu1
image: ubuntu
int.TryParse("5", out int value);
// Use value
@gdyrrahitis
gdyrrahitis / AbstractLinker
Created August 7, 2017 22:27
Drapper new features. Getting rid of the Drapper.Settings.json and introducing a simple container to register types and methods
namespace Training.Misc
{
using System;
using System.Linq.Expressions;
using System.Reflection;
public abstract class AbstractLinker
{
protected MethodInfo GetMethodInfo<T>(Expression<Func<T, Delegate>> expression)
{
@gdyrrahitis
gdyrrahitis / prepare-commit.sh
Last active June 11, 2017 15:02
Git prepare commit hook to alter a file. Append commit id to the version.js file with a prepare-commit hook
# Disclaimer: Commits should have the following format
# <PROJNAME>: <DESCRIPTION>
# Example:
# JIRA-450: My description
# Following code will substring the JIRA-450 and append it as last value of the `window.version` variable, replacing the `SAMPLE`
# This is just a sample, it is not recommended to do such mission, versions should be handled by CI and should follow the SEMVER specification: http://semver.org/
# Should add validation to ensure one is committing following the conventions
# Git hooks documentation https://git-scm.com/docs/githooks
@gdyrrahitis
gdyrrahitis / index.html
Created August 26, 2016 23:38
We have an image with white background and a black colored rectangle. 1 = white, 0 = black. Solution in finding any number of rectangles in a 2D array.
<!DOCTYPE html>
<html>
<head>
<title>Rectangles</title>
</head>
<body>
<h1>Find rectangles in images!</h1>
<button id="singleRectangle">Find single rectangle coordinates</button>
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Windows.Media.Imaging;
namespace LightSwitchApplication.Helpers
{
public class ImageHelper
{