Skip to content

Instantly share code, notes, and snippets.

View drconopoima's full-sized avatar

Luis Jesús Díaz drconopoima

View GitHub Profile
@drconopoima
drconopoima / .bashrc_manjaro
Last active August 30, 2019 06:01 — forked from arindam89/.bashrc
.bashrc example for a Ubuntu/OpenSUSE host with customized Prompt to visualize git branch and depth level, aliases for Backend tools for network (tcpdump, ngrep, ss), Python (Pyenv) and Node.js (NVM)
#
# ~/.bashrc
#
[[ $- != *i* ]] && return
colors() {
local fgc bgc vals seq0
printf "Color escapes are %s\n" '\e[${value};...;${value}m'
@drconopoima
drconopoima / centos_7_python_development_configuration_root
Last active August 3, 2019 17:51
Script for quick configuration of CentOS 7 to manage and use different python virtual environments. Configures locale to en_US.UTF-8, installs Python 3, development packages. Installs Pyenv and Pipenv
#!/bin/sh
DESIRED_UTF8_LOCALE='en_US.UTF-8'
DESIRED_PYTHON_VERSION='2.7.16 3.4.10 3.5.7 3.6.9 3.7.4'
# PYTHON_COLLECTION_VERSION='27'
# PYTHON_COLLECTION_VERSION='34'
# PYTHON_COLLECTION_VERSION='35'
PYTHON_COLLECTION_VERSION='36'
@drconopoima
drconopoima / LICENSE
Last active August 3, 2019 12:56
This license applies to all my public gists at https://gist.github.com/drconopoima
MIT License
Copyright (c) 2019 Luis Díaz
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@drconopoima
drconopoima / juanghurtado.zsh-theme
Created May 11, 2020 20:29
Minor modification to standard oh-my-zsh theme juanghurtado.zsh-theme to show git on the left and prompt colored according to return code
# Color shortcuts
RED=$fg[red]
YELLOW=$fg[yellow]
GREEN=$fg[green]
WHITE=$fg[white]
BLUE=$fg[blue]
RED_BOLD=$fg_bold[red]
YELLOW_BOLD=$fg_bold[yellow]
GREEN_BOLD=$fg_bold[green]
WHITE_BOLD=$fg_bold[white]
@drconopoima
drconopoima / minimalist_plug_vimrc
Last active May 12, 2020 07:00
Minimalist vimrc config with vim-plug plugin manager
set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets.
set incsearch " Incremental search
set autowrite " Automatically save before commands like :next and :make
set hidden " Hide buffers when they are abandoned
set nocompatible " be iMproved, required
filetype off " required
set nu rnu " Show line numbers and relative line numbers in hybrid mode
set ignorecase
set smartcase " ...except when serach query contains a capital letter
@drconopoima
drconopoima / zshrc
Last active August 1, 2020 21:27
ZSHRC file with fix for keybindings in Zsh Line Editor (home/end escape codes)
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
@drconopoima
drconopoima / p10k.zsh
Last active August 1, 2020 21:24
powerlevel10k config
# Generated by Powerlevel10k configuration wizard on 2020-08-01 at 10:07 CEST.
# Based on romkatv/powerlevel10k/config/p10k-rainbow.zsh, checksum 38309.
# Wizard options: nerdfont-complete + powerline, large icons, rainbow, unicode,
# 24h time, angled separators, sharp heads, sharp tails, 2 lines, disconnected,
# no frame, sparse, many icons, concise, instant_prompt=verbose.
# Type `p10k configure` to generate another config.
#
# Config for Powerlevel10k with powerline prompt style with colorful background.
# Type `p10k configure` to generate your own config based on it.
#
@drconopoima
drconopoima / bash_aliases
Last active November 10, 2024 23:51
Personal aliases (fedora dnf)
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
function alert {
notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e 's/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//')"
}
function update_all {
echo "Updating all system packages, Flatpak packages, Snap packages, pyenv, npm, and nvm"
sudo -p "Please enter your password: " whoami 1>/dev/null
( sudo snap refresh & sudo flatpak update -y & pyenv update 2>/dev/null & dotnet tool update powershell --global & wait ) && \
NVM_GIT_VERSION="$(curl -s https://api.github.com/repos/nvm-sh/nvm/tags | jq '.[0].name' | tr -d '"' | cut -c2-)" && \
@drconopoima
drconopoima / recursion_loadtest.sh
Created March 24, 2021 23:45
System loadtest bash shell script that recursively forks itself. Generate CPU/memory/swap stress.
#!/bin/bash
script_name=$(basename $0)
script_version='0.1.0'
printf "* %s (%s)\n" "${script_name}" "${script_version}"
printf "System loadtest script that recursively forks itself\n"
printf "For maximum load:\n"
printf "\t * Raise maximum number of open files fs.file-max\n"
printf "\t * Raise user number of files soft/hard limits in /etc/security/limits.conf\n"
printf "**** CTRL + C to stop ****\n"
parent_process=${1:-$$}
@drconopoima
drconopoima / inputrc
Last active April 14, 2021 10:09
readlines configuration
# Search through the history for the characters before the cursor using the up
# and down arrows.
"\e[A": history-search-backward
"\e[B": history-search-forward
# Delete word forwards
"\e[3;3~": kill-word