Skip to content

Instantly share code, notes, and snippets.

View jazlopez's full-sized avatar
🏠

Jaziel Lopez jazlopez

🏠
  • Thermo Fisher Scientific
  • Tijuana, MX
View GitHub Profile
@jazlopez
jazlopez / hash.string.openssl.examples.sh
Created December 31, 2022 17:58
Create hash strings with openssl
!#/bin/bash
# Create hash strings with openssl
# Jaziel Lopez <jazlopez @ github.com>
INPUT="foo"
# MD5 HASH
echo "${INPUT}" | openssl dgst -md5 | awk '{print $2}'
@jazlopez
jazlopez / what.are.security.design.principles.md
Last active December 19, 2022 20:37
What Are Security Design Principles?

What Are Security Design Principles?

When you write non-trivial software, you have to break the problem into smaller components that work together. This process of deciding how to break a problem into components and how they will work together is called design or architectural design.

For example, you are designing when you are trying to decide how to break a problem into a particular set of classes and methods. The result of those decisions is also called a design or architectural design. The word "design" is also used to describe user interface design, but that is not the sense we mean here.

Remember that the design process, like any other software development process, doesn’t happen just once. It is really common to try to implement some software, realize that the design doesn’t work, and then change the design. You often have to change a design when you change what the software does. So the design process happens whenever you think about changing how to break the problem down in your software

@jazlopez
jazlopez / fino.zsh-theme
Last active December 13, 2022 07:24
fino.zsh-theme customization
# Use with a dark background and 256-color terminal!
# Meant for people with rbenv and git. Tested only on OS X 10.7.
# You can set your computer name in the ~/.box-name file if you want.
# Borrowing shamelessly from these oh-my-zsh themes:
# bira
# robbyrussell
#
# Also borrowing from http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/
@jazlopez
jazlopez / steps.resize.volume.zsh
Created December 13, 2022 03:09
Resize volume from system (after resize volume in digital ocean web console)
# unmount disk
sudo umount /mnt/volume_nyc3_01
# check disk (if lost and found is not located press y to created)
sudo e2fsck /dev/disk/by-id/scsi-0DO_Volume_volume-nyc3-01
# resize disk (if prompt accept defaults)
sudo resize2fs /dev/disk/by-id/scsi-0DO_Volume_volume-nyc3-01
# mount disk
@jazlopez
jazlopez / tcp_process.zsh
Created December 9, 2022 02:50
List/Filter TCP process information
# ----------------------------------
# List/Filter TCP process information
# Jaziel Lopez jazlopez @ github.com
# ----------------------------------
function __tcp_process__(){
local IFACE="tcp"
! [ -z $1 ] && IFACE="$IFACE:$1"
lsof -i $IFACE | awk '{print $2}' | tail -n+2 | xargs ps
}
@jazlopez
jazlopez / mobproxy.alias.zsh
Created December 9, 2022 02:12
Configured alieases to work with mobproxy
# configured alias to work with mobproxy. It can be download from github page
# https://github.com/lightbody/browsermob-proxy/releases
# ----
# author: jazlopez @ github.com
# Dec 2022
# INSTRUCTIONS
# create a new file mobproxy.alias.zsh and enter the below
alias launch-browser-proxy="browsermob-proxy --port 8080"
@jazlopez
jazlopez / aws.backup.restore.s3.sh
Created November 11, 2022 08:57
HOWTO: Backup and restore S3 bucket using AWS Backups CLI
# For instructional and non profit purposes
# Jaziel Lopez
# 2022
export FMS_TESTING_USER=fms-cluster-dev
export DESTINATION_S3_BUCKET=fms-connect-dev-restore-bucket-0001
export ASSUMED_BACKUP_ROLE=backups-fms-cluster-dev
export ROLE_SESSION_NAME=backup-fms-dev
export VAULT_NAME=fms-connect-dev-backup-vault
export TOKEN=kiwis-restore-job-test-0001
@jazlopez
jazlopez / fowlers.code.smells.levels.md
Last active August 22, 2022 09:29
Overview of Fowler’s smells and the levels they pertain to

Overview of Fowler’s smells and the levels they pertain to


Code smell Explanation Level
Long method A method should not consist of many lines of code performing different calculations. Method level
Long parameter list A method should not have many parameters. Method level
Switch statements Code should not contain large switch statements; polymorphism could be used to ease the code. Method level
Primitive obsession Avoid the overuse of primitive types in a class. Class level
Incomplete library class Methods should not be added to random classes instead of to a library class. Class level
@jazlopez
jazlopez / list.available.zones.zsh
Last active November 26, 2022 21:23
Bash custom function and profile autocomplete to list available zones for a given profile.
# =============================================================================================
# Bash custom function and profile autocomplete to list available zones for a given profile.
# Jaziel Lopez jazlopez @ github.com
# 2022
# =============================================================================================
# --
# list aws profiles from default aws credentials file
# --
function _completion_aws_profile_names_(){
@jazlopez
jazlopez / head.large.files.zsh
Created June 13, 2022 08:57
OSX compatible script: head larger files under current directory
#!/bin/bash
# -----------------------------------------------------------------
# OSX compatible script: head larger files under current directory
# Jaziel Lopez 2022
# -----------------------------------------------------------------
function _head_large_files_(){
[ -z "$1" ] && { HEAD_MAX=10 } || HEAD_MAX="$1";
find . ! -type d -exec du -sh {} > /tmp/.size.files.tsv \;