Skip to content

Instantly share code, notes, and snippets.

View sgsfak's full-sized avatar

Stelios Sfakianakis sgsfak

  • Heraklion Greece
  • 02:39 (UTC +02:00)
  • LinkedIn in/sgsfak
View GitHub Profile
@sgsfak
sgsfak / export_clinical.md
Last active November 15, 2023 17:53
Export Clinical Data options

Making (clinical) data available

Export in files

  • Single denormalized table (e.g. CSV)

  • Multiple CSVs / PArquets linked together

Export in structured formats

@sgsfak
sgsfak / venv-jupyterlab.md
Last active July 11, 2023 07:15
venv and jupyterlab

Creation of the virtual environment using venv

Assuming that you have a recent Python version installed (eg. using your Linux package manager or by downloading one), first I create a virtual env like so:

python -m venv venv

NOTE: For this to work in Ubuntu Linux you probably need to also install python3-venv using apt

@sgsfak
sgsfak / GitHub-Forking.md
Created March 17, 2023 11:12 — forked from Chaser324/GitHub-Forking.md
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

@sgsfak
sgsfak / modern_sql_style_guide.md
Created March 13, 2023 08:23 — forked from mattmc3/modern_sql_style_guide.md
Modern SQL Style Guide
layout author title revision version description
default
mattmc3
Modern SQL Style Guide
2019-01-17
1.0.1
A guide to writing clean, clear, and consistent SQL.

Modern SQL Style Guide

#!/bin/bash
dcm2xml $1 |
xmlstarlet sel -T -t -m 'file-format/data-set/element[@tag != "7fe0,0010"]' \
-v 'concat(./@tag, " ", ./@name, " ", normalize-space(.))' -n
@sgsfak
sgsfak / tailwind.md
Created December 11, 2022 10:34 — forked from sandren/tailwind.md
Tailwind CSS best practices

Tailwind CSS best practices

Utility classes

  1. When writing a string of multiple utility classes, always do so in an order with meaning. The "Concentric CSS" approach works well with utility classes (i.e,. 1. positioning/visibility 2. box model 3. borders 4. backgrounds 5. typography 6. other visual adjustments). Once you establish a familiar pattern of ordering, parsing through long strings of utility classes will become much, much faster so a little more effort up front goes a long way!

  2. Always use fewer utility classes when possible. For example, use mx-2 instead of ml-2 mr-2 and don't be afraid to use the simpler p-4 lg:pt-8 instead of the longer, more complicated pt-4 lg:pt-8 pr-4 pb-4 pl-4.

  3. Prefix all utility classes that will only apply at a certain breakpoint with that breakpoint's prefix. For example, use block lg:flex lg:flex-col lg:justify-center instead of block lg:flex flex-col justify-center to make it very clear that the flexbox utilities are only applicable at the

@sgsfak
sgsfak / rrysnc.sh
Created November 14, 2022 10:25 — forked from michaelherger/rrysnc.sh
rrsync replacement without perl, useful for limited environment like CoreOS
#!/bin/sh
# Copyright (C) 2004 Joe Smith <[email protected]>
# Copyright (C) 2004-2015 Wayne Davison <[email protected]>
# Copyright (C) 2016-2018 YOSHIOKA Takuma <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
@sgsfak
sgsfak / deserium.sql
Created November 3, 2022 07:13
Compute "deserium" numbers in SQL
CREATE OR REPLACE FUNCTION deserium(num INTEGER) RETURNS BOOLEAN AS $$
WITH RECURSIVE
digts(d, m, pos) AS (
SELECT t / 10, t % 10, 1 FROM (VALUES(num)) v(t)
UNION ALL
SELECT d / 10, d % 10, pos + 1
FROM digts WHERE d > 0
),
to_sum(v) AS (
@sgsfak
sgsfak / script.sh
Created December 1, 2021 14:28 — forked from vielhuber/script.sh
PostgreSQL: Backup and restore export import pg_dump with password on command line #sql
# best practice: linux
nano ~/.pgpass
*:5432:*:username:password
chmod 0600 ~/.pgpass
# best practice: windows
edit %APPDATA%\postgresql\pgpass.conf
*:5432:*:username:password
# linux
@sgsfak
sgsfak / mllp_panacea_imp.py
Last active October 8, 2021 06:48
a python server accepting MLLP-wrapped requests for PANACEA IMP
import socket
import threading
import socketserver
import sys
import time
def send_command(command:str)->str:
HOST = '127.0.0.1'
PORT = 27016
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: