Skip to content

Instantly share code, notes, and snippets.

View satrialoka's full-sized avatar

Loka satrialoka

View GitHub Profile
@satrialoka
satrialoka / useful.py
Created April 2, 2025 14:19
useful python stuff
# Timer #############################################################################
import time
class Timer:
"""
A simple context manager for timing code execution.
Usage:
with Timer() as t:
@satrialoka
satrialoka / .vimrc
Last active October 4, 2024 10:48
.vimrc
" A very minimal vimrc config for use in remote servers
" Loka 2024
" Enable line numbers
set number
set relativenumber
" Enable syntax highlighting
syntax on
@satrialoka
satrialoka / cmaes.py
Created July 3, 2023 13:53
CMAES trieste acquisition optimizer
from __future__ import annotations
"""
usage:
pip install cmaes
https://pypi.org/project/cmaes/
"""
from typing import Any, List, Optional, Tuple, Union
@satrialoka
satrialoka / non_dominated_sort.py
Last active October 23, 2020 22:00
non_dominated_sort gpflowopt tensorflow port
# %%
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
def non_dominated_sort(objectives):
"""
Computes the non-dominated set for a set of data points
:param objectives: data points
:return: tuple of the non-dominated set and the degree of dominance,
@satrialoka
satrialoka / LatinHyperCubeDesign.py
Created April 29, 2020 07:15
Latin Hypercube design from gpflowopt
import numpy as np
from scipy.spatial.distance import cdist, pdist
class LatinHyperCube():
"""
***copied from gpflowopt design***
Latin hypercube with optimized minimal distance between points.
Created with the Translational Propagation algorithm to avoid lengthy generation procedures.
For dimensions smaller or equal to 6, this algorithm finds the quasi-optimal LHD with overwhelming probability.
@satrialoka
satrialoka / tmux_local_install.sh
Created January 8, 2020 09:14 — forked from ryin/tmux_local_install.sh
bash script for installing tmux without root access
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=1.8
@satrialoka
satrialoka / tmux-cheatsheet.markdown
Created December 25, 2019 09:52 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@satrialoka
satrialoka / hilbertcurve.py
Last active March 27, 2018 13:28
Hilbert Space Filling Curve Implementation in Python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
first try to implement hilbert curve
Created on Thu Mar 1 12:27:38 2018
source : https://en.wikipedia.org/wiki/Hilbert_curve
@author: lokasatria
"""
import numpy as np
import math