Skip to content

Instantly share code, notes, and snippets.

View jeanjerome's full-sized avatar
🪂
Focusing on focus

Jean-Jerome Levy jeanjerome

🪂
Focusing on focus
View GitHub Profile
@jeanjerome
jeanjerome / stack_trace.sh
Created March 3, 2024 08:22 — forked from akostadinov/stack_trace.sh
Get stack trace in Bash shell script/program.
# LICENSE: MIT, wtfpl or whatever OSS license you like
function get_stack () {
STACK=""
local i message="${1:-""}"
local stack_size=${#FUNCNAME[@]}
# to avoid noise we start with 1 to skip the get_stack function
for (( i=1; i<$stack_size; i++ )); do
local func="${FUNCNAME[$i]}"
[ x$func = x ] && func=MAIN
local linen="${BASH_LINENO[$(( i - 1 ))]}"
@jeanjerome
jeanjerome / composition_function.sh
Created May 13, 2023 21:43
Functional Programming in Bash
#!/bin/bash
# Function 1: Convert text to uppercase
to_uppercase() {
echo "$1" | tr '[:lower:]' '[:upper:]'
}
# Function 2: Add a prefix to the text
add_prefix() {
echo "Prefix $1"
@jeanjerome
jeanjerome / mnist_test.py
Last active August 19, 2018 12:29 — forked from Willian-Zhang/tensorflow_1_8_high_sierra_gpu.md
Install Tensorflow 1.8 with CUDA GPU and Python 3 on macOS High Sierra 10.13.6
import tensorflow as tf
import keras
config = tf.ConfigProto( device_count = {'GPU': 1 , 'CPU': 1} )
sess = tf.Session(config=config)
keras.backend.set_session(sess)
from keras.datasets import mnist
from autokeras import ImageClassifier