Skip to content

Instantly share code, notes, and snippets.

@arsu-leo
arsu-leo / .bash_aliases
Last active March 15, 2023 08:53
Some usefull aliases por better listing and color support on bash output
#cat << EOF >> .bash_aliases
#Add this into your .bashrc
#if [ -f ~/.bash_aliases ]; then
# . ~/.bash_aliases
#fi
#Some aliases
if [ -x /usr/bin/dircolors ]; then
COLOR_SUPPORT='--color=auto '
else
function processRow(row, fields, fieldSeparator)
{
const
outRow = [],
keys = Array.isArray(row)
? Object.keys(row)
: (fields || Object.keys(row));
for(let j = 0; j < keys.length; j++)
{
#!/bin/sh
DQUOTE=$(echo "\42")
SQUOTE=$(echo "\47")
COMMAND="mysql -u USER -pPASSWD -h HOST --default-character-set=utf8 \
--database=DB --batch -e ${DQUOTE}SELECT * FROM SOMEWHERE${DQUOTE} | \
sed ${SQUOTE}s/${DQUOTE}/${DQUOTE}${DQUOTE}/g;s/\t/${DQUOTE},${DQUOTE}/g;s/^/${DQUOTE}/;s/$/${DQUOTE}/;s/\n//g;s/\\n/\n/g${SQUOTE} \
> ${VOLUME_OUTPUT_FILE}"
mysql -u[user] -p[password] -h[host] --database=[database] --batch -e "SQL QUERY FROM X" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > export.csv
#!/bin/bash
### This script is intended to be used from inside a git repository (Say any folder where git status would not fail)
### It is intended to be stored on a path folder to be used directly as follows:
### $ gitc ['comment']
###
### If comment is missing it will still prompt asking for a comment, if no input it would use the default_comment value '-.-'
default_comment='-.-'