Skip to content

Instantly share code, notes, and snippets.

View vitor-caetano's full-sized avatar

Vitor Caetano vitor-caetano

View GitHub Profile
@vitor-caetano
vitor-caetano / prod.sh
Last active December 18, 2018 14:11
Change to prod DNS
#!/usr/bin/env bash
networksetup -setdnsservers Ethernet 208.67.222.222 208.67.220.220 8.8.8.8
echo "Switched to PROD"
@vitor-caetano
vitor-caetano / keybindings.md
Created September 24, 2018 17:22 — forked from jimmyhillis/keybindings.md
iTerm 2 Mac-ready key binding additions.

Standard bindings

  • Move left between words: ⌥← | send escape sequence | b
  • Move right between words: ⌥→ | send escapes sequence | f
  • Start of the line: ⌘← | send escape sequence | [H
  • End of the line ⌘→ | send escape sequence | [F
  • Delete previous word ⌥←Delete | send hex code | 0x1B 0x08
  • Delete entire line ⌘←Delete | send hex code | 0x15

Don't forget the amazing icons ⌘ = command and ⌥ = options/alt (why oh why?).

Pragma: akamai-x-cache-on, akamai-x-cache-remote-on, akamai-x-check-cacheable, akamai-x-get-cache-key, akamai-x-get-extracted-values, akamai-x-get-nonces, akamai-x-get-ssl-client-session-id, akamai-x-get-true-cache-key, akamai-x-serial-no
@vitor-caetano
vitor-caetano / k8s.txt
Last active May 8, 2018 20:33
Kubernets commands
minikube version
minikube start
minikube start --vm-driver=virtualbox
minikube status
kubectl version
kubectl cluster-info
kubectl get componentstatuses
kubectl get events
kubectl get pods --all-namespaces
kubectl get services --all-namespaces
@vitor-caetano
vitor-caetano / backup-restore-status.sql
Created March 26, 2018 18:46
Get Status of Running Backup and Restore in SQL Server
SELECT r.session_id AS [Session_Id]
,r.command AS [command]
,CONVERT(NUMERIC(6, 2), r.percent_complete) AS [% Complete]
,GETDATE() AS [Current Time]
,CONVERT(VARCHAR(20), DATEADD(ms, r.estimated_completion_time, GetDate()), 20) AS [Estimated Completion Time]
,CONVERT(NUMERIC(32, 2), r.total_elapsed_time / 1000.0 / 60.0) AS [Elapsed Min]
,CONVERT(NUMERIC(32, 2), r.estimated_completion_time / 1000.0 / 60.0) AS [Estimated Min]
,CONVERT(NUMERIC(32, 2), r.estimated_completion_time / 1000.0 / 60.0 / 60.0) AS [Estimated Hours]
,CONVERT(VARCHAR(1000), (
SELECT SUBSTRING(TEXT, r.statement_start_offset / 2, CASE
@vitor-caetano
vitor-caetano / dm-swarm-versioned.sh
Last active October 18, 2017 13:27
Create swarm with a docker-machine choosing docker version
#!/usr/bin/env bash
if [[ "$(uname -s )" == "Linux" ]]; then
export VIRTUALBOX_SHARE_FOLDER="$PWD:$PWD"
fi
for i in 1 2 3; do
docker-machine create \
-d virtualbox \
--virtualbox-boot2docker-url=https://github.com/boot2docker/boot2docker/releases/download/v17.04.0-ce/boot2docker.iso \
@vitor-caetano
vitor-caetano / remove-docker-images.sh
Created February 2, 2017 13:20
Remove old docker images
docker images --no-trunc --format '{{.ID}} {{.CreatedSince}}' | grep ' days' | awk '{ print $1 }' | xargs docker rmi || true
docker images --no-trunc --format '{{.ID}} {{.CreatedSince}}' | grep ' weeks' | awk '{ print $1 }' | xargs docker rmi || true
docker images --no-trunc --format '{{.ID}} {{.CreatedSince}}' | grep ' months' | awk '{ print $1 }' | xargs docker rmi || true
@vitor-caetano
vitor-caetano / homebrew-cask-upgrade.md
Created January 29, 2017 20:18
brew cask upgrade
@vitor-caetano
vitor-caetano / setup-vm-ws2012.txt
Last active January 23, 2017 15:04
Setup Vagrant Box from a Virtual Box VM with Windows Server 2012 R2
References:
http://www.sanjeevnandam.com/blog/instructions-to-create-a-windows-vagrant-box
http://www.intowindows.com/how-to-boot-and-install-from-iso-in-virtualbox/
@vitor-caetano
vitor-caetano / virt-install.txt
Created January 23, 2017 13:29
virt-install
virt-install --connect qemu:///session \
--name ws2012 --ram 2048 --vcpus 2 \
--network network=default,model=virtio \
--disk path=ws2012.qcow2,format=qcow2,device=disk,bus=virtio \
--cdrom /opt/Windows12.ISO \
--disk path=/opt/virtio-win.iso,device=cdrom \
--vnc --os-type windows --os-variant win2k8