Skip to content

Instantly share code, notes, and snippets.

Avatar
🏞️

Lazarus Lazaridis iridakos

🏞️
View GitHub Profile
@iridakos
iridakos / google-analytics-current-users-tab.js
Created May 22, 2019
Display current users on the tab in Google Analytics
View google-analytics-current-users-tab.js
/* Given you navigate to the Realtime section, execute the following in the browser's console */
setInterval(function(){
var el = window.frames[0].document.getElementById('ID-overviewCounterValue');
if (el) {
document.title=el.textContent;
} else {
document.title="0"
} }, 3000);
@iridakos
iridakos / medium-cabcs-11.sh
Created Aug 27, 2018
Bash completion script - 11
View medium-cabcs-11.sh
export DOTHIS_COMPLETION_COMMANDS_NUMBER=5
$ dothis <tab><tab>
505 clear
506 source ./dothis-completion.bash
507 dothis clear
508 clear
509 export DOTHIS_COMPLETION_COMMANDS_NUMBER=5
@iridakos
iridakos / medium-cabcs-10.sh
Created Aug 27, 2018
Bash completion script - 10
View medium-cabcs-10.sh
#/usr/bin/env bash
_dothis_completions()
{
if [ "${#COMP_WORDS[@]}" != "2" ]; then
return
fi
local commands_number=${DOTHIS_COMPLETION_COMMANDS_NUMBER:-50}
local IFS=$'\n'
local suggestions=($(compgen -W "$(fc -l -$commands_number | sed 's/\t//')" -- "${COMP_WORDS[1]}"))
@iridakos
iridakos / medium-cabcs-9.sh
Created Aug 27, 2018
Bash completion script - 9
View medium-cabcs-9.sh
#/usr/bin/env bash
_dothis_completions()
{
if [ "${#COMP_WORDS[@]}" != "2" ]; then
return
fi
local IFS=$'\n'
local suggestions=($(compgen -W "$(fc -l -50 | sed 's/\t//')" -- "${COMP_WORDS[1]}"))
@iridakos
iridakos / medium-cabcs-8.sh
Created Aug 27, 2018
Bash completion script - 8
View medium-cabcs-8.sh
#/usr/bin/env bash
_dothis_completions()
{
if [ "${#COMP_WORDS[@]}" != "2" ]; then
return
fi
# keep the suggestions in a local variable
local suggestions=($(compgen -W "$(fc -l -50 | sed 's/\t/ /')" -- "${COMP_WORDS[1]}"))
@iridakos
iridakos / medium-cabcs-7.sh
Created Aug 27, 2018
Bash completion script - 7
View medium-cabcs-7.sh
#/usr/bin/env bash
_dothis_completions()
{
if [ "${#COMP_WORDS[@]}" != "2" ]; then
return
fi
COMPREPLY=($(compgen -W "$(fc -l -50 | sed 's/\t//')" -- "${COMP_WORDS[1]}"))
}
@iridakos
iridakos / medium-cabcs-6.sh
Created Aug 27, 2018
Bash completion script - 6
View medium-cabcs-6.sh
$ dothis 623<tab>
$ dothis 623 ls 623 ls -la
...
$ dothis 623 ls 623 ls 623 ls 623 ls 623 ls -la
@iridakos
iridakos / medium-cabcs-5.sh
Created Aug 27, 2018
Bash completion script - 5
View medium-cabcs-5.sh
$ dothis <tab><tab>
632 source dothis-completion.bash 649 source dothis-completion.bash 666 cat ~/.bash_profile
633 clear 650 clear 667 cat ~/.bashrc
634 source dothis-completion.bash 651 source dothis-completion.bash 668 clear
635 source dothis-completion.bash 652 source dothis-completion.bash 669 install ./dothis ~/bin/dothis
636 clear 653 source dothis-completion.bash 670 dothis
637 source dothis-completion.bash 654 clear 671 dothis 6546545646
638 clear 655 dothis 654 672 clear
639 source dothis-completion.bash 656 dothis 631 673 dothis
640 source dothis-completion.bash 657 dothis 150 674 dothis 651
@iridakos
iridakos / medium-cabcs-4.sh
Created Aug 27, 2018
Bash completion script - 4
View medium-cabcs-4.sh
#/usr/bin/env bash
_dothis_completions()
{
COMPREPLY=($(compgen -W "$(fc -l -50 | sed 's/\t//')" -- "${COMP_WORDS[1]}"))
}
complete -F _dothis_completions dothis
@iridakos
iridakos / medium-cabcs-3.sh
Created Aug 27, 2018
Bash completion script - 3
View medium-cabcs-3.sh
#/usr/bin/env bash
_dothis_completions()
{
COMPREPLY=($(compgen -W "now tomorrow never" "${COMP_WORDS[1]}"))
}
complete -F _dothis_completions dothis
You can’t perform that action at this time.