Skip to content

Instantly share code, notes, and snippets.

@jobliz
jobliz / hb.c
Created May 12, 2019 01:49
Himmelblau function with simulated annealing
// gcc himmelblau_simulated_annealing.c -lm && ./a.out
#include <math.h>
#include <stdio.h>
#include <stdlib.h> // RAND_MAX
double rand01(void)
{
return rand() / ((double) RAND_MAX);
}
@jobliz
jobliz / lftp_sync.sh
Last active May 25, 2019 19:02
A script to sync a local directory with a remote directory through FTP.
#!/bin/bash
#
# A script to sync a local directory with a remote directory through FTP. The local directory contents
# will overwrite the remote directory. If a file was deleted locally, it will be deleted remotely.
# Notes:
#
# - It excludes the content of the .git directory.
# - The -P flag is for parallelizing work.
# - 'set ssl:verify-certificate false' might not be necessary. YMMV.
#
@jobliz
jobliz / gist:f31b5eeac16f8b6649907fa00243d9c2
Created May 4, 2020 09:15
Bash function to set terminal title. Put it in .bashrc
function set-title(){
if [[ -z "$ORIG" ]]; then
ORIG=$PS1
fi
TITLE="\[\e]2;$*\a\]"
PS1=${ORIG}${TITLE}
}