Skip to content

Instantly share code, notes, and snippets.

View carlessanagustin's full-sized avatar

carles san agustin carlessanagustin

View GitHub Profile
@carlessanagustin
carlessanagustin / bash-colors.md
Last active March 18, 2021 11:18 — forked from Prakasaka/bash-colors.md
The entire table of ANSI color codes.

TLTR;

RED=$'\e[0;31m'
R=${RED}
BLUE=$'\e[0;34m'
B=${BLUE}
GREEN=$'\e[0;32m'
G=${GREEN}
CYAN=$'\e[0;36m'
@carlessanagustin
carlessanagustin / keycloak.sh
Created February 14, 2021 20:01 — forked from paoloantinori/keycloak.sh
Keycloak Admin API Rest Example
#!/bin/bash
export TKN=$(curl -X POST 'http://localhost:8080/auth/realms/master/protocol/openid-connect/token' \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=admin" \
-d 'password=admin' \
-d 'grant_type=password' \
-d 'client_id=admin-cli' | jq -r '.access_token')
curl -X GET 'http://localhost:8080/auth/admin/realms' \
@carlessanagustin
carlessanagustin / iterm2.md
Created March 11, 2020 06:51 — forked from squarism/iterm2.md
iterm2 cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
@carlessanagustin
carlessanagustin / tmux-cheatsheet.markdown
Last active October 7, 2019 09:08 — forked from MohamedAlaa/tmux-cheatsheet.markdown
TMUX: tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@carlessanagustin
carlessanagustin / iptables.sh
Last active June 19, 2018 10:38 — forked from Tristor/iptables.sh
Simple IPtables script for an OpenVPN server
#!/bin/bash
# Flushing all rules
iptables -F FORWARD
iptables -F INPUT
iptables -F OUTPUT
iptables -X
# Setting default filter policy
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
@carlessanagustin
carlessanagustin / etc_hosts.yml
Last active June 7, 2018 10:21 — forked from rothgar/main.yml
ANSIBLE: Generate /etc/hosts with Ansible from https://gist.github.com/rothgar/8793800
---
- hosts: all
gather_facts: yes
tasks:
- name: Update /etc/hosts
become: true
tags:
- dns
lineinfile:
dest: /etc/hosts
@carlessanagustin
carlessanagustin / ufw_cs.md
Last active March 7, 2018 17:49 — forked from drAlberT/CS_ufw.md
UFW Cheatsheet

UFW cheat sheet

Usage

ufw [--dry-run] enable|disable|reload
ufw [--dry-run] default allow|deny|reject [incoming|outgoing]
ufw [--dry-run] logging on|off|LEVEL
    toggle logging. Logged packets use the LOG_KERN syslog facility. Systems configured for rsyslog
    support may also log to /var/log/ufw.log. Specifying a LEVEL turns logging on for the specified LEVEL.
@carlessanagustin
carlessanagustin / install_lamp.sh
Last active February 28, 2018 17:00 — forked from rrosiek/install_mysql.sh
Vagrant provision script for php, Apache, MySQL, phpMyAdmin, Laravel, and javascript helpers. Outputs nearly everything to /dev/null since "quiet" on most commands is still noisy.
#!/usr/bin/env bash
# Variables
APPENV=local
DBHOST=localhost
DBNAME=dbname
DBUSER=dbuser
DBPASSWD=test123
echo -e "\n--- Mkay, installing now... ---\n"
@carlessanagustin
carlessanagustin / bash-cheatsheet.md
Last active February 28, 2018 16:59 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems

#!/usr/bin/env bash

0. Shortcuts.

CTRL+A  # move to beginning of line
CTRL+B  # moves backward one character
CTRL+C  # halts the current command
CTRL+D  # deletes one character backward or logs out of current session, similar to exit
CTRL+E  # moves to end of line