Skip to content

Instantly share code, notes, and snippets.

@nareshganesan
nareshganesan / ubuntu-18.04-pipenv.bash
Last active February 3, 2024 12:17
Ubuntu 18.04 install python3 with pip and pyenv - for multiple python versions
# install dependencies
sudo apt install -y make build-essential \
python3 python-pip libpq-dev python3-dev libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \
libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl
# pyenv for installing different python versions
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
# export pyenv path for python environments
#
## custom commands
#
[DEFAULT]
nuke = if [ -d ./node_modules ]; then rm -rf ./node_modules; else echo "Skipping ... No node_modules/"; fi
report =
yarn
GENERATE_SOURCEMAP=true yarn build
@HarshadRanganathan
HarshadRanganathan / .gitconfig
Created March 20, 2019 15:27
.gitconfig aliases
[alias]
##
# One letter alias for our most frequent commands.
#
# Guidelines: these aliases do not use options, because we want
# these aliases to be easy to compose and use in many ways.
##
a = add
@bmoyles
bmoyles / 52-ec2-xen-vbd-devices.rules
Created March 19, 2019 17:29
ec2 vbd and NVMe udev rules and helpers
# ensure any xen virtual block devices named xvdN get a sdN symlink for consistency
KERNEL=="xvd*", PROGRAM="/sbin/ec2udev-vbd %k", SYMLINK+="%c"
# Keyspace Name
keyspace: keyspace_to_load_test
# The CQL for creating a keyspace (optional if it already exists)
keyspace_definition: |
CREATE KEYSPACE keyspace_to_load_test with replication = {'class': 'SimpleStrategy', 'replication_factor' : '3'}
# Table name
table: table_to_load_test
@enisozgen
enisozgen / ansible-nested-variable.yml
Last active November 4, 2023 10:21
Ansible example which shows how to reach nested variable with dynamic elements
# Example which shows how to reach nested ansible variable which is partially different.
# Run that plabook with ansible-playbook -e "env=test" ansible-nested-variable.yml
---
#
- hosts: localhost
connection : ssh
gather_facts: no
vars:
cidr_blocks:
vpc_production_cidr_block: "10.10.0.0/28"
@whiteinge
whiteinge / complex_salt_orchestrate.sls
Last active March 20, 2024 15:48
An example of a complex, multi-host Salt Orchestrate state that performs status checks as it goes
# /srv/salt/upgrade_the_app.sls
# Example of a complex, multi-host Orchestration state that performs status checks as it goes.
# Note, this is untested and is meant to serve as an example.
# Run via: salt-run state.orch upgrade_the_app pillar='{nodes: [nodeA, nodeB], version: 123}'
{% set nodes = salt.pillar.get('nodes', []) %}
{% set all_grains = salt.saltutil.runner('cache.grains',
tgt=','.join(nodes), tgt_type='list') %}
{# Default version if not given at the CLI. #}
@MattHealy
MattHealy / rotate-ami-launch-config.sh
Created August 8, 2017 12:43
Update an existing AWS Launch Configuration to use a new AMI image
#!/bin/bash
oldconfigname="$1"
newconfigname="$2"
ami="$3"
KEYNAME="my_keypair_name"
ASGROUP="my_autoscaling_group_name"
SECURITYGROUP="sg-1234"
INSTANCETYPE="t2.micro"
@onnimonni
onnimonni / s3.tf
Created March 13, 2017 10:03
s3 replicated bucket with terraform
# Create all variables used in this Terraform run
variable "aws_access_key" {}
variable "aws_access_secret_key" {}
variable "aws_bucket_name" {}
variable "aws_region_main" {
default = "eu-west-1"
}
variable "aws_region_replica" {
default = "eu-central-1"
}
@markbirbeck
markbirbeck / ubuntu-from-scratch.md
Last active February 27, 2021 18:55
Setting up a new Ubuntu Laptop
# Update repos
#
sudo apt update
sudo apt install --only-upgrade -y \
  gcc-5-base \
  libstdc++6

# Tools
#