This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git_open_link(){ | |
# $1 can be 'origin' or 'dev' depending on the source | |
remote_link=$(git remote get-url $1) | |
browser=firefox | |
CURL_CHECK="curl --head --silent --fail" | |
if $CURL_CHECK "$remote_link" &> /dev/null; then | |
$browser $remote_link; | |
else | |
built_link=$(echo "https://$(echo $remote_link | sed -e 's/git@//' | sed -e 's/:/\//')") | |
if $CURL_CHECK "$built_link" &> /dev/null; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
const char *MORSE_TABLE[] = { | |
".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", | |
".---", "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.", | |
"...", "-", "..-", "...-", ".--", "-..-", "-.--", "--.."}; | |
int main() { | |
char word[100]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# run a command again and again only if the standard output hash change by a single bit | |
# _inf git status | |
_inf(){ | |
echo "Executing '$@' until the output change or you quit:" | |
# we source our alias first | |
PREVIOUS_HASH="" | |
while true; do | |
CURRENT_HASH=$($(echo "${@}") | md5sum) | |
if [ "$CURRENT_HASH" != "$PREVIOUS_HASH" ]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# a confirm check before executing anything | |
# _confirm "your message" your command there | |
_confirm(){ | |
args=("${@}") | |
if [[ $NOTINTERACTIVE = "1" ]]; then | |
echo -e "\n$BLUE[+] ${args[0]} $COLOROFF" | |
callback=${args[@]:1} | |
$callback | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# _sleep 10 | |
_sleep(){ | |
seconds=$1 | |
start="$(($(date +%s) + $seconds))" | |
while [ "$start" -ge `date +%s` ]; do | |
time="$(( $start - `date +%s` ))" | |
printf '%s\r' "$(date -u -d "@$time" +%H:%M:%S)" | |
done | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_ps_per_mem(){ | |
while true; do | |
clear | |
ps -eo pid,%mem,cmd --sort=-%mem | head -n 10 | |
sleep 100 | |
done | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
clean_volumes(){ | |
# List all volumes from docker volume | |
# then remove the first line | |
# sed to delete "local " from the /tmp/volumes | |
# and then apply the docker volume rm on each lines from that file | |
docker volume ls > /tmp/volumes && \ | |
tail -n +2 /tmp/volumes && \ | |
sed -i 's/local //g' /tmp/volumes && \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# To take note about something really quickly | |
# Requirements : fzf and ag | |
# | |
# $ note topic note to my self... # will add a new note for the topic | |
# $ note topic # will seach for notes on this topic | |
# $ note # will list for you all notes taken globally | |
note(){ | |
NOTES_DIR=$HOME/notes/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# this small scrip combine audio streams from a running instance of pulseaudio | |
# and creates a new virtual input | |
f_log() { | |
echo "[+] $0 -> $*" | |
} | |
function usage () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// hit :: two times to have emoji popup open | |
let keystrokes = []; | |
const TARGET_EMOJI_POPUP_ON = ['::'] | |
const LETTERS = [ | |
'A', 'B', 'C', 'D', | |
'E', 'F', 'G', 'H', | |
'I', 'J', 'K', 'L', | |
'M', 'N', 'O', 'P', | |
'Q', 'R', 'S', 'T', | |
'U', 'V', 'W', 'X', |