Skip to content

Instantly share code, notes, and snippets.

@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@lukeplausin
lukeplausin / bash_aws_jq_cheatsheet.sh
Last active January 29, 2024 10:00
AWS, JQ and bash command cheat sheet. How to query, cut and munge things in JSON generally.
# Count total EBS based storage in AWS
aws ec2 describe-volumes | jq "[.Volumes[].Size] | add"
# Count total EBS storage with a tag filter
aws ec2 describe-volumes --filters "Name=tag:Name,Values=CloudEndure Volume qjenc" | jq "[.Volumes[].Size] | add"
# Describe instances concisely
aws ec2 describe-instances | jq '[.Reservations | .[] | .Instances | .[] | {InstanceId: .InstanceId, State: .State, SubnetId: .SubnetId, VpcId: .VpcId, Name: (.Tags[]|select(.Key=="Name")|.Value)}]'
# Wait until $instance_id is running and then immediately stop it again
aws ec2 wait instance-running --instance-id $instance_id && aws ec2 stop-instances --instance-id $instance_id
# Get 10th instance in the account
@djoreilly
djoreilly / ovs-cheat.md
Last active March 15, 2024 13:02
OVS cheat sheet

DB

ovs-vsctl list open_vswitch
ovs-vsctl list interface
ovs-vsctl list interface vxlan-ac000344
ovs-vsctl --columns=options list interface vxlan-ac000344
ovs-vsctl --columns=ofport,name list Interface
ovs-vsctl --columns=ofport,name --format=table list Interface
ovs-vsctl -f csv --no-heading --columns=_uuid list controller
ovs-vsctl -f csv --no-heading -d bare --columns=other_config list port
@aschmu
aschmu / pypi-mirror.md
Last active May 2, 2024 12:34
Setting up a PyPi mirror

I) Introduction

Taken from: [https://groups.google.com/forum/#!topic/devpi-dev/S-3ioWILTiY]).

We wanted to do some python developpement but we had a problem : our working network is completely isolated from any internet access, only having servers providing services like distribution packages repository mirror and web servers. The question then was how to make a full pypi mirror for usig pip install and pip search.

This is possible to be done using devpi, a web server, bandersnatch and an external hard drive. The idea is to dump all pypi packages with bandersnatch, transfer them to the server with the hard drive,

@bzub
bzub / test.json
Created October 5, 2017 14:50
CoreOS Ignition + OEM
{
"ignition": {
"config": {},
"timeouts": {},
"version": "2.1.0"
},
"networkd": {},
"passwd": {},
"storage": {
"files": [{
@guessi
guessi / refresh-ecr-token-for-kubernetes.sh
Last active September 18, 2023 07:11
Refresh ECR Token for Kubernetes - Resolve ECR Token Expired Issue
#!/bin/bash
# prerequisite:
# - ec2 instance should attached proper iam role
# - awscli
# - kubectl
# Usage:
#
# define the following variales in your environment (root account)
@ansemjo
ansemjo / embed_ignition.sh
Created January 3, 2019 15:53
Embed CoreOS ignition configuration in the released OVA for easy deployment of multiple instances on VMware.
#!/usr/bin/env bash
# Copyright (c) 2019 Anton Semjonov
# Licensed under the MIT License
# This script embeds a transpiled ignition (JSON) config in the CoreOS OVA
# as guestinfo parameters, so you can deploy several machines with the
# same configuration easily.
# required arguments / inputs
@sub-mod
sub-mod / crc_remote_laptop.md
Last active July 9, 2022 12:03
Setup CodeReady Containers on Remote Server and connect from Laptop 4.2

Following steps work for F29 for F31 look here

On the remote host

cat /etc/redhat-release
Fedora release 29 (Twenty Nine)

Install packages

@georgegoh
georgegoh / snmp-for-alertmanager.sh
Created December 20, 2019 08:23
One-liner for spinning up snmp-notifer in kube for alertmanager
kubectl run snmp-notifier --image=docker.io/maxwo/snmp-notifier \
--port=9464 --expose \
--env="SNMP_DESTINATION=127.0.0.1:162" \
--env="SNMP_DESCRIPTION_TEMPLATE=/etc/snmp_notifier/description-template.tpl" \
-- '--snmp.trap-description-template=$(SNMP_DESCRIPTION_TEMPLATE)' \
'--snmp.destination=$(SNMP_DESTINATION)'
@ryran
ryran / ocp4-chk-upgrade-channel
Last active February 10, 2023 00:47
OCP4: leverage api.openshift.com/api/upgrades_info to inspect OCP versions
#!/bin/bash
# ocp4-chk-upgrade-channel v1.4 last mod 2022/11/16
# https://gist.github.com/ryran/072409b1b7efd5018683a8c45e019652
# Copyright 2020, 2021, 2022 Ryan Sawhill Aroha <rsaw@redhat.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#