Get code for Opportunistic routing in ns2 - omnet++

I want to simulate opportunistic routing protocol in ns2 . Does anyone know where can I get the code or atleast some reference to write code. I searched it but didn't find anything

Totally opportunistic routing algorithm (TORA) is present in e.g. ns-2.35/. But the default code isn't working very well. I.e. in order not to conflict with other protocols, the functions are limited to a minimum.
A working TORA can be added with "tora_ns235-1.patch"
https://drive.google.com/file/d/0B7S255p3kFXNWXc4UnRYcGVHZXc/view?usp=sharing
$ tar xvf ns-allinone-2.35_gcc5.tar.gz # year 2014 update
https://drive.google.com/file/d/0B7S255p3kFXNVVlxR0ZNRGVORjQ/view?usp=sharing
$ cd ns-allinone-2.35/
$ patch -p0 < tora_ns235-1.patch
$ ./install
$ cd ns-2.35/
$ cp ns ns235-tora # This is also your backup
$ sudo cp ns235-tora /usr/local/bin/
------- Simulation -----------
$ ns235-tora 02-T-msg12973.tcl
Tora-examples_06.19.tar.gz
https://drive.google.com/file/d/1INSqfrCCw7xZk_PTgtEkK-7Rw7kg5-2A/view?usp=sharing

Related

Git push completion not working for branch (second argument)

So I have downloaded the git-completion.bash from here as you can see from the following output:
$ ls ~ | grep git-completion
-rw-r--r-- 1 waldyr staff 64720 Jul 21 23:43 .git-completion.bash
I'm running macOS High Sierra version 10.13.6 and I downloaded bash-completion using homebrew as you can see from the following output:
$ brew info bash-completion
bash-completion: stable 1.3 (bottled)
Programmable completion for Bash 3.2
https://salsa.debian.org/debian/bash-completion
Conflicts with:
bash-completion#2 (because Differing version of same formula)
/usr/local/Cellar/bash-completion/1.3_3 (189 files, 608.2KB) *
Poured from bottle on 2018-07-18 at 11:25:01
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/bash-completion.rb
==> Caveats
Add the following line to your ~/.bash_profile:
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
My .bash_profile sources a file called .bashrc which sources both bash-completion and git completion with telling the :
$ cat ~/.bash_profile
. ~/.bashrc
$ cat ~/.bashrc
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion
if [ -f ~/.git-completion.bash ]; then
source ~/.git-completion.bash
__git_complete gp _git_push
fi
alias gp='git push'
Whenever I type gp in the terminal and press tab asking for completion the script works perfectly:
$ gp <tab>
origin production
And after my selection of a repository the completion doesn't work for the refspec:
When there's nothing after it keeps showing the repositories:
$ gp origin <tab>
origin production
If there's at least one letter it (for example m from master), it looks for the files in the current directory
$ gp origin m<tab>
Makefile Minafile
I know I can alias git in the bashrc to g and alias git-push in gitconfig to p making the command g p which the completion works perfectly but I find annoying having to type the space.
What am I missing to make the completion work for the second argument (refspec)? Is that a git bug?
Here is the link for my dotfiles so you can check the whole files.

How can I enable unit templates?

I have written a my own unit template:
/etc/systemd/user/my_service#.service
This is the base for a bunch of services I want to come up at boot. I do want to create each service as a symlink to the template something like this:
$ cd /etc/systemd/user
$ sudo ln -s my_service#.service my_service#runner001.service
$ sudo ln -s my_service#.service my_service#runner002.service
...
But if I now try to enable the services I get:
$ sudo systemctl enable my_service#runner001.service
Failed to execute operation: Too many levels of symbolic links
To solve this I copied the file instead:
$ cd /etc/systemd/user
$ sudo cp my_service#.service my_service#runner001.service
$ sudo cp my_service#.service my_service#runner002.service
...
Now systemctl enable works as expected.
But: Making all those copies and keeping them synced when the template is changed are awkward and sort of defeats the purpose of a templating system I think.
What am I missing here? Could the runners be enabled without copying the template?
I'm using Ubuntu 16.04 and systemd=229
Btw: If I after enabling of the service replace it with a symlink it will still work for some systemctl commands (daemon-reload, start, stop and status) while is-enabled, enable and disable will all fail with:
Failed to execute operation: Too many levels of symbolic links
Strange I think, and I have not tried to reboot my system to see if that works...
You don't need symlinks. Just use
systemctl start/enable my_service#runner001.service. Then, systemd will use your template directly.
See https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Specifiers for more info about specifiers (ie, variables you can use inside you template)
If you want more, paste template and expected result.

Makefile for running fig

I try to create a make task which do fig up and install fig and docker in case when they don't installed. Problem which I try to address is a easy way to work with a project for newcomers.
I finished with something like this:
.PHONY: up
up:
command -v docker >/dev/null 2>&1 || {\
curl -sSL https://get.docker.com/ubuntu/ | sudo sh;\
};\
command -v fig >/dev/null 2>&1 || {\
curl -L https://github.com/docker/fig/releases/download/1.0.1/fig-`uname -s`-`uname -m` > /usr/local/bin/fig; chmod +x /usr/local/bin/fig;\
};
fig up;
and realized that it's not a simple task. Is there a community adopted way to install and run docker and fig with make?
I wouldn't use make for this at all.
Especially not when the commands that need to be run are so simple and single-use.
Just create a bootstrap.sh or similar script and tell people that they can run it if they need to.
I'm not going to argue if it's good practice or not, but I wrote a blog post about mixing make and fig.
http://www.byrnedo.com/2014/12/17/docker-fig-and-makefiles/
One advantage that has popped up is the fact that I can swap fig for another tool very simple. Which is relevant as that's now changing to docker-compose, so my interfacing scripts don't have to change. They still call make start or whatever when booting up a cluster.

Where are the svn hook files located in OS X?

I'm running OS X Mavericks. Pretty sure I got svn from the Command Line Tools from the Apple Developer site.
I've searched around for where hook script are supposed to be located. All the articles I've found (e.g. this one: https://stackoverflow.com/a/7577251/726378) say that there is a hooks directory in the repository directory. I have found no such directory.
Where is this directory?
Is this directory on the svn server or the client?
In Subversion, hooks are run on the server side, and are located inside the repository directory on the server.
Try this:
$ cd $HOME
$ svnadmin create foo_repo # Creating Subversion repository called "foo_repo"
$ cd foo_repo
$ hooks
post-commit.tmpl post-revprop-change.tmpl pre-commit.tmpl
pre-revprop-change.tmpl start-commit.tmpl post-lock.tmpl
post-unlock.tmpl pre-lock.tmpl pre-unlock.tmpl
There they are!
You can try using this repo if you'd like:
$ cd $HOME/foo_repo/conf
$ vi svnserve.conf # Remove the "#" from "password-db = passwd" (Line 27)
$ vi passwd # You want to define a password for your user
$ cd $HOME
$ svnserve -r foo_repo -d # Starts up the Subversion server
$ mkdir $HOME/workdir
$ cd $HOME/workdir
$ svn co svn://localhost localhost
$ cd localhost # Your Subversion working directory!
Now, you can play around with your various hook and see how it affects using your repository.

Installing RVM with space in $USER

So I've run into a bit of a problem. I've found many similar problems with spaces in $HOME, but the fixes do not apply to spaces in $USER - so I'm posting a question here.
Due to regulations at work my username for my workstation consists of +space+ (cannot be changed), for instance: John Doe
This is my $USER:
$ echo $USER
john doe
When I try to install rvm I get the following error:
It looks you are one of the happy *space* users(in home dir name),
RVM is not yet fully ready for it, use this trick to fix it:
sudo ln -s "/Users/john doe/.rvm/" /john doe.rvm
echo "export rvm_path=/john doe.rvm" >> "/Users/john doe/.rvmrc"
However, when I try to run the first command I get the following error:
ln: doe.rvm: No such file or directory
And if I attempt to run
sudo ln -s "/Users/john doe/.rvm/" "/john doe.rvm"
I get:
ln: /john doe.rvm: File exists
Any help would be tremendously appreciated :-)
Edit
sudo ln -s "/Users/john doe/.rvm/" /john\ doe.rvm
yields
ln: /john doe.rvm: File exists
Edit 2
Okay, thanks to platzhirsch I no longer get an error message when running the ln command. Now the problem is following:
When I run
echo "export rvm_path=/john\ doe.rvm" >> "/Users/john doe/.rvmrc"
or
echo "export rvm_path="/john doe.rvm"" >> "/Users/john doe/.rvmrc"
I get the following error when trying to re-install:
usage: dirname path
Edit 3
I've also tried manually editing the .rvmrc file. This is what it looks like:
export rvm_path="/john doe.rvm"
I've also tried
export rvm_path=/john\ doe.rvm
With no luck, I still get:
usage: dirname path
When I try to run
\curl -L https://get.rvm.io | bash -s stable --ruby
this message is fixed with https://github.com/wayneeseguin/rvm/issues/2140 - just start again and now it will propose the directory with _ (underscore) instead of (space)
why don't try to escape the white space ?!
sudo ln -s "/Users/john\ doe/.rvm/" "/john\ doe.rvm"
See this pst about escaping in linux shell. It is (almost) the same if you are using a terminal on a mac

Resources