Skip to content

Instantly share code, notes, and snippets.

@omarzina
omarzina / mercurial log template
Created July 7, 2015 17:20
Template compacto para log de mercurial
hg log -l 5 --template "{branch} {date|shortdate} {rev}|{node} {user} stats:{diffstat} {desc}\n"
@omarzina
omarzina / exiftool organizer
Last active September 21, 2015 18:22
Exiftool oneliners to organize pics
# Copies files from source to dest with specified date-time format
exiftool -o destDir '-FileName<FileModifyDate' '-FileName<DateCreated' '-FileName<ModifyDate' '-FileName<DateTimeCreated' '-FileName<DateTimeOriginal' -d %Y%m%d_%H%M%S%%-c.%%le -r sourceDir
# Move files from source to dest with specified directory date format
exiftool '-Directory<FileModifyDate' '-Directory<DateCreated' '-Directory<ModifyDate' '-Directory<DateTimeCreated' '-Directory<DateTimeOriginal' -d destDir/%Y-%m-%d -r sourceDir
liquibase --driver=com.microsoft.sqlserver.jdbc.SQLServerDriver --url=jdbc:sqlserver@localhost:1324:db --username=sa --password= diff --referenceUrl=jdbc:sqlserver@localhost:1324:refdb --referenceUsername=user --referencePassword=password
@omarzina
omarzina / postgres-cheatsheet.md
Created December 1, 2015 03:29 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

Magic words:

psql -U postgres

If run with -E flag, it will describe the underlaying queries of the \ commands (cool for learning!).

Most \d commands support additional param of __schema__.name__ and accept wildcards like *.*

  • \q: Quit/Exit
  • \c __database__: Connect to a database
@omarzina
omarzina / cheatsheet-git.sh
Created December 7, 2015 20:27 — forked from raineorshine/cheatsheet-git.sh
Cheatsheet: git commands
# adding and committing
git add -A # stages All
git add . # stages new and modified, without deleted
git add -u # stages modified and deleted, without new
git commit --amend # Add staged changes to previous commit. Do not use if commit has been pushed.
git commit --amend --no-edit # Do so without having to edit the commit message.
# remotes - pushing, pulling, and tracking
git fetch # gets remote objects and refs. Needed if new branches were added on the remote.
git remote -v # Lists all remotes (verbose)
@omarzina
omarzina / gist:d5224d81f7c38eee6f1c
Created March 15, 2016 04:20
100% solution to codility sample test in java - https://codility.com/demo/take-sample-test/
class Solution {
public int solution(int[] A) {
int N = A.length;
double sum = 0;
for (double i : A) {
sum += i;
}
if (N == 1) return 0;
double left = 0;
@omarzina
omarzina / tmux.md
Created May 28, 2016 17:36 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@omarzina
omarzina / gist:5e53035e564a8005552aa3fc1af6b557
Created July 22, 2016 21:22
create bootable usb drive in linux
fdisk -l
umount sdx_
dd if=/path/to/file.iso of=/dev/sdx bs=4M
@omarzina
omarzina / convert.sh
Created February 24, 2017 12:47 — forked from rhardih/convert.sh
Recursively find and convert .epub to .mobi using calibres ebook-convert (in parallel)
find . -name "*.epub" -exec sh -c 'ebook-convert "{}" "$(dirname "{}")/$(basename -s .epub "{}").mobi" &' \;
@omarzina
omarzina / ansible-summary.md
Created December 20, 2017 20:10 — forked from andreicristianpetcu/ansible-summary.md
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of