Skip to content

Instantly share code, notes, and snippets.

View avansp's full-sized avatar
🎯
Focusing

Avan Suinesiaputra avansp

🎯
Focusing
  • King's College London
  • United Kingdom
  • X @asui085
View GitHub Profile
@avansp
avansp / prog_argparse.py
Last active March 15, 2022 15:59
Comparison of CLI
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('integers', metavar='N', type=int, nargs='+',
help='an integer for the accumulator')
parser.add_argument('--sum', dest='accumulate', action='store_const',
const=sum, default=max,
help='sum the integers (default: find the max)')
@avansp
avansp / hashid.py
Last active December 27, 2021 14:17
A function to return a string from hashlib
def get_hashid(key: str, method: str = 'sha256', nchar: int = 0):
"""
Generate a hash identifier.
:param key: input string for the hash algorithm.
:param method: an algorithm name. Select from hashlib.algorithms_guaranteed
or hashlib.algorithms_available.
:param nchar: number of the first character to return. Set 0 for all characters.
:return: a string.
@avansp
avansp / collision_test.py
Last active December 27, 2021 18:19
Collision tests for generating HashID's
import string
import secrets
from datetime import date
import random
import time
from hashid import get_hashid # see my hashid.py gist
# patient ID's are alphanumeric characters
alphabet = string.ascii_letters + string.digits
@avansp
avansp / skeleton_html.Rmd
Last active December 15, 2021 02:25
RMarkdown HTML
---
title: "TITLE"
author: "AUTHOR"
date: "DD/MM/YYY"
output:
html_document:
toc: true
toc_depth: 2
toc_float: true
number_sections: true
@avansp
avansp / VAE.md
Created January 19, 2020 07:29
VAE notes & links
@avansp
avansp / Good Deep Learning Readings.md
Last active September 4, 2018 00:33
My selections on understanding deep learning
@avansp
avansp / OpenLDAP_Centos7_Setup.md
Created August 29, 2017 09:00
Installing and setup OpenLDAP server on CentOS 7
  • Install OpenLDAP server
sudo yum -y install openldap compat-openldap openldap-clients openldap-servers openldap-servers-sql openldap-devel
  • Start the server
sudo systemctl start slapd.service
sudo systemctl enable slapd.service
@avansp
avansp / .block
Created April 2, 2017 03:55
Bezier curves
license: gpl-3.0
height: 400
border: no
@avansp
avansp / .block
Last active April 2, 2017 07:58
Image on a grid
license: gpl-3.0
height: 640
border: no
@avansp
avansp / .block
Last active April 2, 2017 07:29
Grid with D3
license: gpl-3.0
height: 400
border: no