Skip to content

Instantly share code, notes, and snippets.

View AntoniosHadji's full-sized avatar

Antonios Hadjigeorgalis AntoniosHadji

View GitHub Profile
@AntoniosHadji
AntoniosHadji / Dockerfile.user
Created March 23, 2023 13:25
Dockerfile create and use non-root user inside container
ARG UNAME=antonios
ARG UID=1000
ARG GID=1000
RUN groupadd -g $GID -o $UNAME
RUN useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME
RUN usermod -aG sudo $UNAME
USER $UNAME
@AntoniosHadji
AntoniosHadji / kyc.mermaid
Created July 26, 2022 17:54
Mermaid code for KYC sequence Diagram
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Keybase proof

I hereby claim:

  • I am antonioshadji on github.
  • I am antonioshadji (https://keybase.io/antonioshadji) on keybase.
  • I have a public key ASAqQHrfa898wvvQfSnZggzRQzIwBT4d_4QA6CdB_MBHcAo

To claim this, I am signing this object:

@AntoniosHadji
AntoniosHadji / main.c
Created April 11, 2019 00:18
test c program for testing python subprocess
#define _POSIX_C_SOURCE 199309L
#include <stdio.h>
#include <time.h>
int main(int argc,char* argv[])
{
time_t now;
time(&now);
printf("Today is: %s", ctime(&now));
@AntoniosHadji
AntoniosHadji / log_path.py
Last active April 11, 2019 00:15
archive log files
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
from pathlib import Path
import datetime
import time
print(os.path.dirname(__file__))
print(type(os.path.dirname(__file__)))
print(os.path.dirname(os.path.abspath(__file__)))
@AntoniosHadji
AntoniosHadji / benchmark.py
Created March 8, 2019 02:29
Using timeit as library
import timeit
import random
def test(setup, cmd):
repeat = 3
precision = 3
t = timeit.Timer(stmt=cmd, setup=setup)
number, _ = t.autorange()
r = t.repeat(repeat, number)
@AntoniosHadji
AntoniosHadji / cli.py
Created February 20, 2019 02:59
python cli option parser with logging
#!/usr/bin/env python3
import argparse
import logging
import os
import pathlib
import sys
from datetime import date, timedelta
# create logger
@AntoniosHadji
AntoniosHadji / gnucash.trace
Created December 31, 2018 19:59
gnucash --debug --extra plus files for version 3.4 build
* 14:19:42 DEBUG <gnc.module> module_name: gnucash/app-utils
* 14:19:42 WARN <gnc.module> Could not locate module gnucash/app-utils interface v.0
* 14:19:42 DEBUG <gnc.module> module_name: gnucash/gnome-utils
* 14:19:42 WARN <gnc.module> Could not locate module gnucash/gnome-utils interface v.0
* 14:19:42 DEBUG <gnc.module> module_name: gnucash/gnome-search
* 14:19:42 WARN <gnc.module> Could not locate module gnucash/gnome-search interface v.0
* 14:19:42 DEBUG <gnc.module> module_name: gnucash/register/ledger-core
* 14:19:42 WARN <gnc.module> Could not locate module gnucash/register/ledger-core interface v.0
* 14:19:42 DEBUG <gnc.module> module_name: gnucash/register/register-core
* 14:19:42 WARN <gnc.module> Could not locate module gnucash/register/register-core interface v.0
@AntoniosHadji
AntoniosHadji / Dockerfile
Last active November 24, 2018 21:41
Dockerfile to create Centos Latest with Python 3.7.1 (working as of 11/24/2018)
FROM centos:latest
# ensure local python is preferred over distribution python
ENV PATH /usr/local/bin:$PATH
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG en_US.utf8
RUN yum -y update && yum -y groupinstall development
@AntoniosHadji
AntoniosHadji / update.R
Created November 1, 2018 19:33
update R to 3.5 and reinstall packages for jupyter notebook kernel on Ubuntu 18.04
install.packages('base64enc')
install.packages('rprojroot')
install.packages('backports')
install.packages('rprojroot')
install.packages('rlang')
install.packages('digest')
install.packages('Rcpp')
install.packages('jsonlite')
install.packages('glue')
install.packages('devtools')