Skip to content

Instantly share code, notes, and snippets.

View arturoaviles's full-sized avatar

Arturo Avilés arturoaviles

View GitHub Profile
@arturoaviles
arturoaviles / .zshrc
Created September 7, 2019 03:34
Install Kubectx & Kubens with ZSH Auto Completion in Linux
# Add all the following lines to your .zshrc file
# Download and Install kubectx & kubens
# You can change the folder that is used to save the files.
alias install_kubectx_kubens='curl "https://raw.githubusercontent.com/ahmetb/kubectx/master/kubectx" --create-dirs -o ~/Downloads/kubectx/kubectx \
&& curl "https://raw.githubusercontent.com/ahmetb/kubectx/master/kubens" --create-dirs -o ~/Downloads/kubectx/kubens \
&& sudo mv ~/Downloads/kubectx/kubectx /usr/local/bin/kubectx \
&& sudo mv ~/Downloads/kubectx/kubens /usr/local/bin/kubens \
&& sudo chmod +x /usr/local/bin/kubectx \
&& sudo chmod +x /usr/local/bin/kubens \
@arturoaviles
arturoaviles / Dockerfile
Created December 31, 2019 01:19
Python Dockerfile
FROM python:3.7-slim
# Recommendation:
# - Major distributions reserve uid from 1000 to 60000
# - GKE worker nodes reserve uid from 5000 to 60000
# Use larger numbers! (Ex. 61000)
RUN groupadd -g <uid-number> groupName
RUN useradd -r -u <uid-number> -g groupName appuser
ENV TIMEZ_PORT 8080
@arturoaviles
arturoaviles / .zshrc
Created September 20, 2019 21:25
ZSHRC
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/home/arturoaviles/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="robbyrussell"
@arturoaviles
arturoaviles / usefool_kubectl.sh
Created August 23, 2019 07:25
Usefool Kubernetes Commands
# If you want to check the pod logs:
kubectl logs <pod-name> <container-name>
@arturoaviles
arturoaviles / iteration_without_copy.py
Created June 8, 2019 20:38
Python Iteration starting at X index without copying the list
fruits = ["apple", "orange", "banana"]
# Simple Method (Inefficient).
for fruit in fruits[1:]:
print(fruit)
# Efficient Method (It doesn't needs to copy each element of the list).
from itertools import islice
@arturoaviles
arturoaviles / GitHub-Forking.md
Created April 17, 2019 19:46 — forked from Chaser324/GitHub-Forking.md
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

@arturoaviles
arturoaviles / check_flask_request.py
Created March 21, 2019 17:21
Check Flask Request
print("Request Content Type:", request.content_type)
print("Is it Json?", request.is_json)
print("Request Data Type:",type(request.get_data()))
print("Request Data", request.get_data())
print(request.args)
print(request.get_data().decode('utf-8'))
print(type(request.get_data().decode('utf-8')))
print("Json:", json.dumps(request.get_data().decode('utf-8')))
print("Type:", type(json.dumps(request.get_data().decode('utf-8'))))
@arturoaviles
arturoaviles / instructions.txt
Created February 21, 2019 17:48
Add string before or after every line in VS Code file using regex expression
Find: ^(.*)$
Replace: $0 Anything You want
or
Replace: Anything You want $0
@arturoaviles
arturoaviles / gist:186dfe4f450de45c33c065c422c67af9
Created December 19, 2018 21:31
combine_files_in_user_order_into_another_file.sh
cat file.txt file2.txt > final_file.txt
@arturoaviles
arturoaviles / count_word_in_file.sh
Created November 29, 2018 23:12
Count Specific Word in File
grep -c "word" file