Skip to content

Instantly share code, notes, and snippets.

@nejo
nejo / rsync.sh
Created February 2, 2018 11:06
rsync command samples
# Rsync with statistics and progress info Deleting files at destination, compressing during transfer
rsync -ahivzW --dry-run --progress --delete /tmp/source user@10.2.2.1:/tmp/destination --stats
# same but output to a file
rsync -ahivzW --dry-run --progress --delete /tmp/source user@10.2.2.1:/tmp/destination --stats > rsync_output.txt
# less verbose without showing individual files progress
rsync -ahivzW --dry-run --delete /tmp/source user@10.2.2.1:/tmp/destination --stats
rsync -ahivzW --dry-run --progress --delete /tmp/source user@10.2.2.1:/tmp/destination --stats --log-file=/tmp/rsync.log
@nejo
nejo / ora_queries.sql
Created April 7, 2016 08:42
Oracle Queries
# getting a ROLE/USER to be able to execute commands over the entities we have
ALTER SESSION SET CURRENT_SCHEMA = MY_SCHEMA_NAME;
# looking for the configuration
SELECT * FROM NLS_DATABASE_PARAMETERS;
# restoring a lost entry
INSERT INTO employees
(SELECT * FROM employees
AS OF TIMESTAMP
@nejo
nejo / gist:64e84b4093ec2fd9bd84
Created July 6, 2015 11:09
Copying files removing a filename part
for i in *.txt; do echo mv $i ${i%%.sample.txt}.txt; done
# for example my.sample.txt -> my.txt
@nejo
nejo / crontab_comment
Created September 12, 2014 09:27
Crontab man comment
#MAILTO=
# +--------- Minute (0-59) | Output Dumper: >/dev/null 2>&1
# | +------- Hour (0-23) | Multiple Values Use Commas: 3,12,47
# | | +----- Day Of Month (1-31) | Do every X intervals: */X -> Example: */15 * * * * Is every 15 minutes
# | | | +--- Month (1 -12) | Aliases: @reboot -> Run once at startup; @hourly -> 0 * * * *;
# | | | | +- Day Of Week (0-6) (Sunday = 0) | @daily -> 0 0 * * *; @weekly -> 0 0 * * 0; @monthly ->0 0 1 * *;
# | | | | | | @yearly -> 0 0 1 1 *;
# * * * * * COMMAND |
@nejo
nejo / .git_things
Last active August 3, 2017 09:56
Git things
[user]
name = Username
email = valid@email.com
[core]
excludesfile = ~/.gitignore
fileMode = false
[alias]
co = checkout
@nejo
nejo / date_generate.sh
Created November 13, 2013 14:28
Generate lines with dates inside them, from one date to another
#!/bin/bash
#=============================================================================
#
# FILE: list_dates.sh
#
# USAGE: list_dates.sh start_date end_date
#
# DESCRIPTION: List the dates between a given range of dates.
#
#=============================================================================
@nejo
nejo / file2utf8.sh
Created November 13, 2013 14:25
Convert a file to use UTF-8 encoding
#!/bin/bash
if [ -z "$1" ]
then
echo "Usage $0 FILENAME"
exit 86
fi
file_from=$1;
file_to="$1.utf8";
@nejo
nejo / file_unifier.sh
Created November 13, 2013 14:23
File Unifier
#!/bin/bash
FILENAME='unified/MERGED_FILENAME.txt'
`rm $FILENAME`
`touch $FILENAME`
FILES2012=`ls files/ | grep -E "FILENAME2012[0-9]{1,}\.txt"`
for file in $FILES2012; do