Skip to content

Instantly share code, notes, and snippets.

View mauri870's full-sized avatar
🌎

Mauri de Souza Meneguzzo mauri870

🌎
View GitHub Profile
@mauri870
mauri870 / tensorflow_audio_to_mfcc.py
Last active October 12, 2022 13:21
Wav audio to mfcc features in tensorflow 1.15
import tensorflow as tf
# FIXME: audio_ops.decode_wav is deprecated, use tensorflow_io.IOTensor.from_audio
from tensorflow.contrib.framework.python.ops import audio_ops
# Enable eager execution for a more interactive frontend.
# If using the default graph mode, you'll probably need to run in a session.
tf.enable_eager_execution()
@tf.function
def audio_to_mfccs(
@mauri870
mauri870 / u9fs-sharing-unix-files-with-plan9.md
Last active August 4, 2022 13:48
Sharing UNIX files with a Plan9 instance through 9P

Hi,

this gist summarizes how to share UNIX files/folders with a Plan9 instance using u9fs.

First of all, grab the latest u9fs release from source or install it with the package manager of your preference, then build and install.

Please be sure to find the correct path to your u9fs binary because it may differ based on the installation, normally it is /usr/local/bin/u9fs or /usr/bin/u9fs.

On older unix/linux systems you may use inetd, which is already covered by the u9fs man page.

@mauri870
mauri870 / ==.md
Last active December 4, 2023 21:04
Comparing strings and byte slices with ==

Comparing string == string and []byte == []byte

The types string and []byte share the same memory layout, it is a pointer to memory followed by the length (with a capacity, in the case of slices) and the actual contents. When we do a == comparison with slices (or strings, if that matter) the runtime issues a call to

runtime.memequal(a, b unsafe.Pointer, size uintptr) bool

This function is akin to libc’s memcmp(3).

Most compilers, such as gcc, will generate very optimized assembly for an operation like this, but it mostly boils down to: