Skip to content

Instantly share code, notes, and snippets.

View reduardo7's full-sized avatar
💭
🤔

Eduardo Daniel Cuomo reduardo7

💭
🤔
View GitHub Profile
@reduardo7
reduardo7 / kubernetes-connect-mongo.sh
Last active March 6, 2019 18:18
Kubernetes: Connect to Mongo POD + port-forward
#!/usr/bin/env bash
# https://gist.github.com/reduardo7/00928a0a50bf51f7c9ba218e95eb37c3
################# Connect to Mongo DB #################
# Params:
# - Environment: uat/prod
# - POD Name: Optional. Specific POD.
#
# Examples:
@reduardo7
reduardo7 / kubernetes-get-mongo-master.sh
Last active March 6, 2019 18:18
Kubernetes: Get Mongo master of replicaset.
#!/usr/bin/env bash
# https://gist.github.com/reduardo7/c8ce682f7cb02f90168c5bec23fed53e
################# Get Master Mongo POD #################
# Params:
# - Environment: uat/prod
#
# Examples:
# ./get-mongo-master.sh prod
@reduardo7
reduardo7 / user-name-validation.js
Created October 8, 2018 19:10
UserName validation
function testUser(t) {
console.info(t,
/^[a-z0-9\.\-_]+$/.test(t) && /^[^\.\-_]+/.test(t) && /[^\.\-_]+$/.test(t) && !/[\.\-_]{2,}/.test(t),
/^[a-z0-9\.\-_]+$/.test(t) , /^[^\.\-_]+/.test(t) , /[^\.\-_]+$/.test(t) , !/[\.\-_]{2,}/.test(t));
}
// Valid
testUser('foo');
testUser('foo.bar');
testUser('foo.bar-asd_123');
@reduardo7
reduardo7 / install-redis.sh
Last active September 27, 2018 17:07 — forked from khelll/install-redis.sh
Installing Redis on Amazon Linux
#!/bin/bash
###############################################
# To use:
# chmod +x install-redis.sh
# ./install-redis.sh
###############################################
version=4.0.11
set -e
@reduardo7
reduardo7 / list-files.ps1
Created September 24, 2018 23:31
Windows PowerShell - Files Details
Get-Item g:\* | Foreach { "Nombre: " + $_.Name + ", Creado: " + $_.CreationTime + "; Modificado: " + $_.LastWriteTime + ", Tamaño: " + $_.Length + " k
b" }
@reduardo7
reduardo7 / keybase.md
Created August 21, 2018 19:03
keybase.md

Keybase proof

I hereby claim:

  • I am reduardo7 on github.
  • I am reduardo7 (https://keybase.io/reduardo7) on keybase.
  • I have a public key ASBPF9vxn6uoQaQD06IGZB1aCw7qQiLb4_htndVfHfn0mQo

To claim this, I am signing this object:

@reduardo7
reduardo7 / slack-file-killer.js
Created March 14, 2018 14:05 — forked from iamstuartwilson/slack-file-killer.js
Kill multiple slack files from your browser console. Simply paste this code when on the "https://[space].slack.com/files/[me]" page.
(function(){
$('#files_list > [data-file-id]').each(function(i) {
killIt($(this).attr('data-file-id'));
function killIt(id) {
console.log(id);
$.post('/api/files.delete', {
file: id,
token: boot_data.api_token
@reduardo7
reduardo7 / docker-destroy-all.sh
Created November 28, 2017 16:51 — forked from JeffBelback/docker-destroy-all.sh
Destroy all Docker Containers and Images
#!/bin/bash
# Stop all containers
docker stop $(docker ps -a -q)
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
@reduardo7
reduardo7 / user-creation.sh
Created November 1, 2017 21:08
Create Unix user with permissions
# Run as ROOT: $ sudo su
(
##########
# Config #
##########
# Required
PTECH_SETUP_USER_NAME=username
# Optional
@reduardo7
reduardo7 / user-creation-function.sh
Last active November 1, 2017 21:08
Create multiple Unix users with permissions
# Run as ROOT: $ sudo su
#########
# Utils #
#########
@log() {
echo "# $*"
}