This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # ============================================================================ | |
| # Check Bash Version - This script requires Bash 4.0+ | |
| # ============================================================================ | |
| if [[ "${BASH_VERSINFO[0]}" -lt 4 ]]; then | |
| echo "ERROR: This prompt requires Bash 4.0 or newer" | |
| echo "Current version: ${BASH_VERSION}" | |
| echo "" | |
| echo "Solution: Install bash with Homebrew:" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| BUCKET="mybucket" | |
| PREFIX="elasticsearch-backup/all-indexes" | |
| [ "$(which pv)" != "" ] && echo "Required: 'apt install -y pv'" && exit 1 | |
| aws s3api list-objects --output text --bucket $BUCKET --prefix $PREFIX --query 'Contents[].[Key]' | pv -l > /tmp/${BUCKET}.keys | |
| split -d -l 1000 /tmp/${BUCKET}.keys ${BUCKET}- | |
| # If for any reason the process stops (you loose network connection, for instance), you can continue the job from here | |
| for i in $( ls ${BUCKET}-* ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Add to your ~/.bashrc: | |
| source /home/user/bin/myprompt.sh | |
| PROMPT_COMMAND=myprompt | |
| #Enjoy. Any improvement is welcome. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "AWSTemplateFormatVersion": "2010-09-09", | |
| "Description": "An etcd cluster based off an auto scaling group", | |
| "Mappings" : { | |
| "RegionMap" : { | |
| "eu-central-1" : { | |
| "AMI" : "ami-840a0899" | |
| }, | |
| "ap-northeast-1" : { | |
| "AMI" : "ami-6c5ac56c" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python3 | |
| import os | |
| import re | |
| import yaml | |
| import sys | |
| if not os.getenv("CONFIG_FILE"): | |
| print("Usage:") | |
| print("$ CONFIG_FILE=the/config.yaml " + sys.argv[0] + " < exports to yaml by default") | |
| print("$ CONFIG_FILE=the/config.yaml " + sys.argv[0] + " yaml") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| usix15y22zbix30y14zbix29y24zbix29y19zbix29y21zbix30y16zbix30y12zbix30y7zbix30y9zbmix14y20r20zpix10y23zdtix45y19zbix43y19zdtix43y17zlsix68y23zlsix67y22zlsix68y19zeix57y23zeix52y24zeix48y23zeix8y8zeix10y14znetix43y11znwtix52y10zutix53y8zpix28y15zbmix25y17r7zbmix24y12r6zpix28y11zbmix55y6r8zbmix23y7r13zpix44y-4zlsvx62y24zbmvx71y4r12zbmvx65y20r0zpvx41y17zpix39y18zpix37y20zpix36y20zusix33y18zlsix39y18zlsix39y18zevx33y22zevx54y12zdtvx67y-4zutvx72y23zpvx74y23zutvx76y22z |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This is one of those little treasures hidden in the filesystem | |
| # you always forget how you did it and which server you have it running on | |
| # so, here it is | |
| # | |
| description "node web-a5-app" | |
| start on (net-device-up and local-filesystems and runlevel [2345]) | |
| stop on runlevel [!2345] | |
| respawn | |
| script | |
| [ -p /var/run/web-a5-out ] && rm /var/run/web-a5-out |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| */5 * * * * [ $( lsof -p $(pgrep java) | wc -l ) -gt 60000 ] && service tomcat7 restart && notify-adm "${HOSTNAME}: [ERROR] JVM open files limit reached, restarting." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo apt-get purge $(\ | |
| for tag in "linux-image" "linux-headers"; \ | |
| do dpkg-query -W -f'${Package}\n' "$tag-[0-9]*.[0-9]*.[0-9]*" | \ | |
| sort -V | \ | |
| awk 'index($0,c){exit} //' c=$(uname -r | cut -d- -f1,2); \ | |
| done) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Whenever is possible, try to do not install anything on your desktop. | |
| Use virtualbox. | |
| Better, use Docker. | |
| Don't feel bad. I have lots of shit installed in my desktop too. | |
| ------ | |
| On source machine: |
NewerOlder