Skip to content

Instantly share code, notes, and snippets.

View marcostolosa's full-sized avatar
👽
Memento Mori. Try Harder.

Marcos Tolosa marcostolosa

👽
Memento Mori. Try Harder.
View GitHub Profile
@marcostolosa
marcostolosa / kubectl-cheatsheet.md
Created November 2, 2018 18:15
KUBECTL CheatSheet
title reviewers content_template
kubectl Cheat Sheet
bgrant0607
erictune
krousey
clove
templates/concept
@marcostolosa
marcostolosa / Vagrantfile
Created November 1, 2018 02:34
Offensive-Security Official Vagrant file
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "offensive-security/kali-linux"
# Create a forwarded port
config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network. In VirtualBox, this is a Host-Only network

Keybase proof

I hereby claim:

  • I am marcostolosa on github.
  • I am marcostolosa (https://keybase.io/marcostolosa) on keybase.
  • I have a public key ASDVE7ivh7BXVlqX9tS7wzqu1mbWku58KlT-y34wvJ9Kywo

To claim this, I am signing this object:

@marcostolosa
marcostolosa / send-ip.sh
Created October 20, 2018 07:56
Receive an email when your IP changes
#!/bin/bash
ip_file=~/.ip
if [ ! -f "$ip_file" ]; then touch $ip_file; fi
last=$(cat "$ip_file")
current=$(dig +short myip.opendns.com @resolver1.opendns.com) || exit
if [ "$last" = "$current" ]; then exit; fi
mail -s "[IP from Everywhere]" <your_email>@server.com <<< "$current"
@marcostolosa
marcostolosa / vagranfile.rb
Created September 19, 2018 12:53
Vagrantfile CheatSheet
Vagrant.configure("2") do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "precise64"
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
@marcostolosa
marcostolosa / vagrant-cheatsheet.md
Created September 19, 2018 12:52
Vagrant CheatSheet

Typing vagrant from the command line will display a list of all available commands.

Be sure that you are in the same directory as the Vagrantfile when running these commands!

Creating a VM

  • vagrant init -- Initialize Vagrant with a Vagrantfile and ./.vagrant directory, using no specified base image. Before you can do vagrant up, you'll need to specify a base image in the Vagrantfile.
  • vagrant init <boxpath> -- Initialize Vagrant with a specific box. To find a box, go to the public Vagrant box catalog. When you find one you like, just replace it's name with boxpath. For example, vagrant init ubuntu/trusty64.

Starting a VM

  • vagrant up -- starts vagrant environment (also provisions only on the FIRST vagrant up)
@marcostolosa
marcostolosa / nginx.conf
Last active September 5, 2018 19:46
Nginx Improved - Security and Performance
# read more here http://tautt.com/best-nginx-configuration-for-security/
# don't send the nginx version number in error pages and Server header
server_tokens off;
# config to don't allow the browser to render the page inside an frame or iframe
# and avoid clickjacking http://en.wikipedia.org/wiki/Clickjacking
# if you need to allow [i]frames, you can use SAMEORIGIN or even set an uri with ALLOW-FROM uri
# https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options
add_header X-Frame-Options SAMEORIGIN;
@marcostolosa
marcostolosa / shellBash-cheatsheet.md
Created July 17, 2018 23:36
Bash Shell - Cheat Sheet

Bash is a name of the unix shell, which was also distributed as the shell for the GNU operating system and as default shell on Linux and Mac OS X. Nearly all examples below can be a part of a shell script or executed directly in the shell.

Read more here.

#!/bin/bash
# First line of the script is shebang which tells the system how to execute
# the script: http://en.wikipedia.org/wiki/Shebang_(Unix)
# As you already figured, comments start with #. Shebang is also a comment.
@marcostolosa
marcostolosa / bashscript-cheatsheet.md
Last active July 17, 2018 23:31
Bash Script - Cheat Sheet

Bash Getting started

Example

#!/usr/bin/env bash

NAME="John"
echo "Hello $NAME!"
@marcostolosa
marcostolosa / docker-cheatsheet.md
Last active July 12, 2018 17:35
Docker Cheat-Sheet