Skip to content

Instantly share code, notes, and snippets.

View sharepointoscar's full-sized avatar
💭
Winter is coming...

Oscar Medina sharepointoscar

💭
Winter is coming...
  • Using tech to support my lifestyle.
  • California
  • X @DevOpsOscar
View GitHub Profile
# Copy the secret.
kubectl get secret jx-basic-auth --namespace=jx --export -o yaml |
kubectl apply --namespace=jx-stagin -f -
#Download the kubeconfig
curl -o get-kubeconfig.sh \
https://raw.githubusercontent.com/gravitational/teleport/master/examples/gke-auth/get-kubeconfig.sh
#make executable
chmod +x get-kubeconfig.sh
# Pull all remote branches
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
# Find process running on port 8080
lsof -i:8080
# Just kill it
kill -9 $(lsof -t -i:8080)
# find process listening on port 9200
lsof -nP -i4TCP:$PORT | grep LISTEN
@sharepointoscar
sharepointoscar / RMIDockerImages
Last active January 28, 2020 01:34
Removes all dangling Docker images
# delete docker images that are dangling
docker rmi $(docker images -f "dangling=true" -q ) --force
# delete images with the status 'exited'
docker rmi $(docker ps --all -f "status=exited" -q)
# A nice holistic cleanup approach named: Scorched Earth Cleanup.
# Kindly provided by James Todd (https://twitter.com/jwtodd)
@sharepointoscar
sharepointoscar / login-azure.ps1
Last active March 2, 2018 20:51
Login to Azure via PowerShell non-interactive
# Install required module
Install AzureRM Module
# Load Module
Import AzureRM Module
# Create a Credential Object
$clientID = <CLIENT_ID>
$key = <CLIENT_SECRET>
$SecurePassword = $key | ConvertTo-SecureString -AsPlainText -Force
@sharepointoscar
sharepointoscar / FindWordInstancesInArray
Created February 16, 2018 21:21
Find total occurrences of a word within a sentence. Output word and count.
module.exports = {
getText: function(req,res){
var _text = req.param('text');
var _splitUpWords = _text.split(' ');
var _wordCount = {};
// store all words in an object
@sharepointoscar
sharepointoscar / Kubernetes
Created August 24, 2017 17:01
Kubernetes Snippets
#Get all Hosts and public IP addresses on all namespaces
kubectl get ing --all-namespaces | awk {'print $3" " $4'} | column -t
@sharepointoscar
sharepointoscar / 1_kubernetes_on_macOS.md
Created August 17, 2017 16:11 — forked from kevin-smets/1_kubernetes_on_macOS.md
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites

aws ec2 delete-key-pair --key-name mykeyname --region us-west-2