Skip to content

Instantly share code, notes, and snippets.

View talhanai's full-sized avatar
🐇

Tuka Alhanai talhanai

🐇
View GitHub Profile
@talhanai
talhanai / UsingPreferenceKey.md
Last active October 31, 2023 09:39
An example .swift code to retrieve GeometryReader value externally using PreferenceKey method.

If you are using SwiftUI elements and want to determine the location of an element on the screen, then you will need to use GeometryReader. However GeometryReader values cannot be accessed externally by parent elements unless you use the PreferenceKey method.

Useful links to references:

@talhanai
talhanai / runTaskInParallel.sh
Last active July 10, 2020 15:34
An example for running a list of bash commands in parallel, while monitoring progress.
#!/bin/bash
# Create list of bash commands to execute
echo "echo "hello"; sleep 5;
echo "hello"; sleep 5;
echo "hello"; sleep 5;
echo "hello"; sleep 5;
echo "hello"; sleep 5;
echo "hello"; sleep 5;
echo "hello"; sleep 5;
@talhanai
talhanai / bashrc
Created March 2, 2020 06:30
Bash terminal customization to color terminal line, directories, and files.
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[36m\]\h:\[\033[36;1m\]\w\[\033[m\]\\n$ "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ls='ls -GFh'
@talhanai
talhanai / downsampleAudio.sh
Created January 22, 2020 15:59
bash script to downsample audio file
#!/bin/bash
# generate list of wav files
find "/usr/users/tuka/fram/sessions-audio-did/audio/wav" -mindepth 1 -maxdepth 1 > file.wav.list
outputdir=/usr/users/tuka/fram/sessions-audio-did/audio/wav_8K
mkdir $outputdir
# clean executable script
rm run.ctl
@talhanai
talhanai / convertAudio2WAV.sh
Created January 22, 2020 15:56
bash pseudo-script to convert an audio file into WAV
ffmpeg -n -i "$filename" ${outputdir}/${id}.wav