Skip to content

Instantly share code, notes, and snippets.

View nhamilakis's full-sized avatar
🎱
pondering on quests

Hamilakis Nicolas nhamilakis

🎱
pondering on quests
View GitHub Profile
@nhamilakis
nhamilakis / setup.sh
Last active January 18, 2024 11:16
mac setup
#!/bin/bash
# Setup console tools
xcode-select --install
# install brew
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# install dependencies
brew bundle --no-lock --file=/dev/stdin <<EOF
@nhamilakis
nhamilakis / pytree.py
Last active August 30, 2022 12:43
A reimplementation of the `tree` command using rich.tree
#!/usr/bin/env python3
import sys
import argparse
from pathlib import Path
from typing import Optional
try:
from rich.console import Console
from rich.tree import Tree
except ImportError:
@nhamilakis
nhamilakis / rich_status.py
Created August 30, 2022 12:19
Diplay a rich.console.status with a self updating "Time Elapsed" information on the side
from datetime import datetime
import contextlib
from time import sleep
from threading import Thread
from rich.console import Console
# pip install humanize
import humanize
@nhamilakis
nhamilakis / sanitize.py
Created March 2, 2022 14:54
A sanitize script for InfTrain
"""
Script to sanitize all argument files for infSim model data.
- checkpoint_args.json & args.json : files used to save arguments used to train the model.
::> contain absolute paths that require to be converted to the current machine after moving the model data.
"""
import argparse
import json
from pathlib import Path
@nhamilakis
nhamilakis / readme.md
Last active December 3, 2021 11:26
Secret Santa

Secret Santa Script

pip install pandas Jinja2 tqdm

Gmail as smtp

$ python3 secret_santa.py

Google Sheet Structure needs to have the following columns [Nom, Prenom, Email]

@nhamilakis
nhamilakis / scratch.py
Last active April 13, 2021 11:39
durable_upload
""" Sample code for an tolerant to failure upload
using UploadManifest class to iterate over items to upload/process
UploadManifest does not close the loop if all the items do not have a status done or failed.
Customisable number of retries (via argument)
Checkpoint saving to local json file
"""
import json
import random
import time
@nhamilakis
nhamilakis / env.ts
Last active November 13, 2019 14:37
Block Click Events in Angular
import { Directive, HostListener} from '@angular/core';
@Directive({
selector: '[noClickable]'
})
export class ComponentLockDirective {
constructor() { }
@HostListener('click', ['$event'])
@nhamilakis
nhamilakis / component.ts
Last active October 16, 2019 08:59
Get Stuff in Angular
class Corpus {
name: string;
}
@TrucAngularAUZEF
class MyCorporaComponent extends OnInit {
listCorpora : Array<Corpus> = [];
constructor(private api: MyAPIServiceDeLEspace){}
@nhamilakis
nhamilakis / mixin.ts
Created March 11, 2019 16:40
Mixins idea in Typescript/Javascript
interface Exposable {
public exposeFunctions: () => Array<string>;
}
// TODO: fix function prototype.add
function applyMixins(derivedCtor: any, baseCtors: Array<Exposable>) {
baseCtors.forEach((baseCtor) => {
baseCtor.prototype.exposeFunctions().forEach(funct => {
Object.setPrototypeOf(derivedCtor, {