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
fun! Term(...) abort | |
let l:currmax=0 | |
let l:currwinnr=win_getid() | |
for l:bn in range(1,bufnr('$')) | |
let l:currbufname = bufname(l:bn) | |
let l:currshellnr = str2nr(bufname(l:bn)[10:-1]) | |
if bufloaded(l:bn) && l:currbufname =~# "term:shell.*" && l:currshellnr != 0 | |
if l:currshellnr > l:currmax | |
let l:currmax = l:currshellnr | |
endif |
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/sh | |
# | |
# Provides 2 functions | |
# 1) agf (ag-find) : searches for a string | |
# 2) ragf (replace-ag-find) : searches for a string and replaces it; displays results | |
# | |
# WHY IS THIS NOT A SIMPLE ONE LINER? | |
# It is a convenience function with shorthand for the inclusion and exclusion list. | |
# $ ragf "^foo|bar$" "baz" file1 file2 *.csv somedirectory/ :: somedirectory/.gitignore somedirectory/*.log data/ | |
# ┗━━━━━━━ included files ━━━━━━━┛ ┗━━━━━━━━━━━━━━━━ excluded files ━━━━━━━━━━━━━━━━┛ |
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/sh | |
rm ~/.npmrc | |
touch ~/.npmrc && echo prefix=~/.npm-packages >> ~/.npmrc | |
mkdir ~/.npm-packages | |
curl -L https://www.npmjs.com/install.sh | sh |
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
#!/usr/bin/env bash | |
SCRIPT_PATH=${BASH_SOURCE[0]} | |
SCRIPT_NAME=${SCRIPT_PATH##*/} | |
SCRIPT_DIR="$(cd "$(dirname "${SCRIPT_PATH:-$PWD}")" 2>/dev/null 1>&2 && pwd)" | |
HELP=$(cat <<EOF | |
Usage: $SCRIPT_NAME <file.csv> | |
Joins lines in a csv file that are meant to be one line. If CRLF + LF | |
terminated lines are present, this script will join all LF terminated lines. |
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
#!/usr/bin/env bash | |
SCRIPT_PATH=${BASH_SOURCE[0]} | |
SCRIPT_NAME=${SCRIPT_PATH##*/} | |
# SCRIPT_DIR="$(cd "$(dirname "${SCRIPT_PATH:-$PWD}")" 2>/dev/null 1>&2 && pwd)" | |
HELPDOC=$(cat <<HEREDOC | |
Usage: $SCRIPT_NAME <file.sqlite3> [--db <mysql_database_name> --table <table_name> --user <username> --pass <password> --dumpfile <sql_file> --execute --help] | |
Dumps an SQLite table into a MySQL table. Requires an sqlite3 database file. | |
MySQL table will be created if it doesn\'t already exist. |
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
#!/usr/bin/env bash | |
SCRIPT_PATH=${BASH_SOURCE[0]} | |
SCRIPT_NAME=${SCRIPT_PATH##*/} | |
# SCRIPT_DIR="$(cd "$(dirname "${SCRIPT_PATH:-$PWD}")" 2>/dev/null 1>&2 && pwd)" | |
HELPDOC=$(cat <<HEREDOC | |
Usage: $SCRIPT_NAME <file.csv> [--delim <csv_delimter> --db <mysql_database_name> --table <table_name> --user <username> --pass <password> --execute --help] | |
Dumps a CSV file into a MySQL table. MySQL table will be created if it | |
doesn\'t already exist. |
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
#!/usr/bin/env bash | |
# Renders a text based list of options that can be selected by the | |
# user using up, down and enter keys and returns the chosen option. | |
# | |
# Usage: | |
# echo "Select one option using up/down keys and enter to confirm:" | |
# options=("one" "two" "three") | |
# select_option "${options[@]}" | |
# choice=$? |
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 | |
SCRIPT_PATH=${BASH_SOURCE[0]} | |
SCRIPT_NAME=${SCRIPT_PATH##*/} | |
# SCRIPT_DIR="$(cd "$(dirname "${SCRIPT_PATH:-$PWD}")" 2>/dev/null 1>&2 && pwd)" | |
HELPDOC=$(cat <<HEREDOC | |
Usage: $SCRIPT_NAME <file.sql> [--db <mysql_database_name> --user <username> --pass <password>] | |
Dumps the query from a provided SQL file into a CSV file. The CSV file will | |
be in same place as the SQL file, but with '.csv' appended to the end of it. |
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
-- psql variables can only be used outside functions | |
-- plpgsql variables can only be used inside functions | |
-- session variables can be used both outside and inside functions, bridging the gap between the two types of variables | |
\set func_name vars | |
\echo '[':func_name'.sql]' | |
CREATE OR REPLACE FUNCTION :func_name (arg_execute TEXT) | |
RETURNS VOID AS $$ DECLARE | |
BEGIN | |
END; |
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 | |
dump_tar_xz_contents() { | |
total="$1" | |
index="$2" | |
file="$3" | |
file_without_extension="$(basename "$file" .tar.xz)" | |
echo "[START][$index/$total] $file" | |
tar tf "$file" > "$file_without_extension.txt" | |
echo "[END][$index/$total] $file" |
OlderNewer