Skip to content

Instantly share code, notes, and snippets.

View flavio-fernandes's full-sized avatar

Flavio Fernandes flavio-fernandes

View GitHub Profile
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: ovsdb-mon-ovs
spec:
selector:
matchLabels:
name: ovsdb-mon-ovs
template:
metadata:
apiVersion: v1
kind: Pod
metadata:
name: ovsdb-mon-ovn
spec:
containers:
- name: ovsdb-mon-ovn
image: quay.io/pdiak/fedora-ovn:latest
resources:
requests:
@flavio-fernandes
flavio-fernandes / osp-ovn-playground-create.sh
Last active September 17, 2020 19:44 — forked from danalsan/osp-ovn-playground-create.sh
osp-ovn-playground-create.sh
#!/bin/bash -x
#
#
# +------------+
# | |
# | |
# | public |
# | |
# | |
# +-----+------+
@flavio-fernandes
flavio-fernandes / rhpaste.sh
Last active April 13, 2022 20:09
remoce extra end of the line when used with --clip
# Helper for determining if this is MacOS
_is_osx() {
uname | grep --quiet -i Darwin && echo 1 || echo 0
}
function rhpaste() {
# -c will take link generated by rhpaste and put it in clipboard
# -d will dump contents of response as a browser would receive
# usage rhpaste <filename> or via pipe e.g.: git show|rhpaste
# rhpaste file1 file2

Let's say you have a Bash shell script, and you need to run a series of operations on another system (such as via ssh). There are a couple of ways to do this.

First, you can stage a child script on the remote system, then call it, passing along appropriate parameters. The problem with this is you will need to manually keep the remote script updated whenever you change it -- could be a bit of a challenge when you have something to execute on a number of remote servers (i.e., you have a backup script running on a central host, and it needs to put remote databases in hot backup mode before backing them up).

Another option is to embed the commands you want to run remotely within the ssh command line. But then you run into issues with escaping special characters, quoting, etc. This is ok if you only have a couple commands to run, but if it is a complex piece of Bash code, it can get a bit unwieldy.

So, to solve this, you can use a technique called rpcsh -- rpc in shell script, as follows:

First, place th

@flavio-fernandes
flavio-fernandes / .bashrc_vagrant.sh
Last active July 5, 2016 15:48 — forked from purpleidea/.bashrc_vagrant.sh
# Vagrant vsftp and other tricks# from: https://ttboj.wordpress.com/2013/12/21/vagrant-vsftp-and-other-tricks/# and# Vagrant clustered SSH and 'screen'# from: https://ttboj.wordpress.com/2014/01/02/vagrant-clustered-ssh-and-screen/# for use inside a ~/.bashrc or similar
# vagrant vsftp and other tricks
# from: https://ttboj.wordpress.com/2013/12/21/vagrant-vsftp-and-other-tricks/
# and
# Vagrant clustered SSH and 'screen'
# from: https://ttboj.wordpress.com/2014/01/02/vagrant-clustered-ssh-and-screen/
# for use inside a ~/.bashrc or similar
# copyright James Shubin, 2013, agplv.3+
### VAGRANT ###################################################################
# avoid needing to always add --provider=kvm