Skip to content

Instantly share code, notes, and snippets.

@omarzina
omarzina / wsDgi.md
Created October 11, 2023 17:10 — forked from MaskeZen/wsDgi.md
WS DGI
@omarzina
omarzina / csv_to_hash_array.rake
Created April 28, 2022 12:08 — forked from voleinikov/csv_to_hash_array.rake
Ruby -- turn CSV file into array of hashes with headers as keys (rake task)
# Adapted from StackOverflow answers:
# http://stackoverflow.com/a/8477067/1319740
# and
# http://stackoverflow.com/a/18113090/1319740
# With help from:
# http://technicalpickles.com/posts/parsing-csv-with-ruby/
# A small rake task that validates that all required headers are present in a csv
# then converts the csv to an array of hashes with column headers as keys mapped
# to relevant row values.

FWIW: I didn't produce the content presented here (the outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

What's an Effective Engineer?

@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

@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 / 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 / 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: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 / 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 / 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