text:
---
published: true
date: '2016-06-16 03:17 -0500'
title: 'XR toolbox, Part 4: Bring your own Container (LXC) App'
author: Akshat Sharma
tags:
  - vagrant
  - iosxr
  - cisco
  - linux
  - lxc
  - containers
  - xr toolbox
position: top
excerpt: Launch a Container app (LXC) on IOS-XR
---

{% include toc icon="table" title="Launching a Container App" %}
{% include base_path %}

Check out Part 3 of the XR toolbox series: [App Development Topology]({{ base_path }}/tutorials/2016-06-06-xr-toolbox-app-development-topology).

## Introduction

If you haven't checked out the earlier parts to the XR toolbox Series, then you can do so here:

>
[XR Toolbox Series]({{ base_path }}/tags/#xr-toolbox)

The purpose of this series is simple. Get users started with an IOS-XR setup on their laptop and incrementally enable them to try out the application-hosting infrastructure on IOS-XR.

In this part, we explore how a user can build and deploy their own container (LXC) based applications on IOS-XR.

## Pre-requisites

Before we begin, let's make sure you've set up your development environment.
If you haven't checked it out, go through the "App-Development Topology" tutorial here:

>
[XR Toolbox, Part 3: App Development Topology]({{ base_path }}/tutorials/2016-06-06-xr-toolbox-app-development-topology)

Follow the instructions to get your topology up and running as shown below:

![app dev topo](https://xrdocs.github.io/xrdocs-images/assets/tutorial-images/app_dev_topology.png)

If you've reached the end of the above tutorial, you should be able to issue a `vagrant status` in the `vagrant-xrdocs/lxc-app-topo-bootstrap` directory to see a rtr (IOS-XR) and a devbox (Ubuntu/trusty) instance running.

AKSHSHAR-M-K0DS:lxc-app-topo-bootstrap akshshar$ pwd
/Users/akshshar/vagrant-xrdocs/lxc-app-topo-bootstrap
AKSHSHAR-M-K0DS:lxc-app-topo-bootstrap akshshar$
AKSHSHAR-M-K0DS:lxc-app-topo-bootstrap akshshar$ vagrant status
Current machine states:

rtr                       running (virtualbox)
devbox                    running (virtualbox)

This environment represents multiple VMs. The VMs are all listed
above with their current state. For more information about a specific
VM, run `vagrant status NAME`.
AKSHSHAR-M-K0DS:lxc-app-topo-bootstrap akshshar$

All good? Perfect. Let's start building our container application tar ball.
{: .notice--success}

>
{:.align-right}
>
**The figure on the right illustrates the basic steps to undertake to launch an lxc container on IOS-XR 6.0+**:
>
*  We will build the container rootfs tar ball on our devbox (see topology above)
*  The rootfs tar ball will then be transferred to IOS-XR
*  The rootfs will  be launched on the underlying hypervisor using the virsh command in XR shell.
{: .notice}

## Create a container rootfs

{% capture notice-text %}
#### Using a custom rootfs tar ball

The technique presented here focuses on the creation of a container from scratch (using a base ubuntu template) followed by the installation of an application for first-time users.
A user can easily use their own pre-built rootfs tar ball and ignore this section altogether.

The only point to remember is that if you expect to use SSH access into the container after deployment to XR, then change the default SSH port in /etc/ssh/sshd_config in your rootfs to something other than 22/57722 (or any other port you expect XR to use based on your config).

This is showcased in the following section below:

[Change SSH port inside your container]({{ base_path }}/tutorials/2016-06-16-xr-toolbox-part-4-bring-your-own-container-lxc-app/#change-ssh-port-inside-your-container)

{% endcapture %}

  {{ notice-text | markdownify }}

To launch an LXC container we need two things:

*  A container rootfs tar ball
*  An XML file to launch the container using `virsh/libvirt`

To create them, we'll hop onto our devbox (Ubuntu/trusty) VM in the topology and install lxc-tools. lxc-tools will be used to create a container rootfs tar ball.

### Install lxc tools on devbox

SSH into the devbox:

AKSHSHAR-M-K0DS:lxc-app-topo-bootstrap akshshar$ vagrant ssh devbox
Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 3.13.0-87-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Thu Jun 16 14:27:47 UTC 2016

  System load:  0.0               Processes:           74
  Usage of /:   3.5% of 39.34GB   Users logged in:     0
  Memory usage: 25%               IP address for eth0: <IP_ADDRESS>
  Swap usage:   0%                IP address for eth1: <IP_ADDRESS>

  Graph this data and manage this system at:
    https://landscape.canonical.com/

  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud

0 packages can be updated.
0 updates are security updates.

Last login: Thu Jun 16 14:27:47 2016 from <IP_ADDRESS>
vagrant@vagrant-ubuntu-trusty-64:~$

Install lxc tools inside the devbox

```shell
sudo apt-get update
sudo apt-get -y install lxc
```

Check that lxc was properly installed:

```shell
vagrant@vagrant-ubuntu-trusty-64:~$ sudo lxc-start --version
1.0.8
vagrant@vagrant-ubuntu-trusty-64:~$
```

### Launch an LXC container on the devbox

Using the standard ubuntu template available with lxc, let's create and start the ubuntu container inside devbox:

vagrant@vagrant-ubuntu-trusty-64:~$ sudo lxc-create -t ubuntu --name xr-lxc-app
Checking cache download in /var/cache/lxc/trusty/rootfs-amd64 ...
Installing packages in template: ssh,vim,language-pack-en
Downloading ubuntu trusty minimal ...
I: Retrieving Release
I: Retrieving Release.gpg
I: Checking Release signature
I: Valid Release signature (key id 790BC7277767219C42C86F933B4FE6ACC0B21F32)
I: Retrieving Packages

------------------------------ snip output ------------------------------------

This process will take some time as the ubuntu rootfs template is downloaded for you by the lxc tools.
{: .notice--info}

Once the container template is installed successfully, it should show up in the lxc-ls output:

vagrant@vagrant-ubuntu-trusty-64:~$ sudo lxc-ls --fancy
NAME        STATE    IPV4  IPV6  AUTOSTART
------------------------------------------
xr-lxc-app  STOPPED  -     -     NO
vagrant@vagrant-ubuntu-trusty-64:~$

Now let's start the container:

vagrant@vagrant-ubuntu-trusty-64:~$ sudo lxc-start --name xr-lxc-app
<4>init: plymouth-upstart-bridge main process (5) terminated with status 1
<4>init: plymouth-upstart-bridge main process ended, respawning
<4>>init: hwclock main process (7) terminated with status 77
<4>>init: plymouth-upstart-bridge main process (15) terminated with status 1
<4>>init: plymouth-upstart-bridge main process ended, respawning

------------------------------ snip output ------------------------------------

You will be taken to the login prompt.

The Default credentials are:
Username:  **ubuntu**
Password:  **ubuntu**
{: .notice--info}

```shell
Ubuntu 14.04.4 LTS xr-lxc-app console

xr-lxc-app login: <4>init: setvtrgb main process (428) terminated with status 1
<4>init: plymouth-upstart-bridge main process (23) killed by TERM signal

Ubuntu 14.04.4 LTS xr-lxc-app console

xr-lxc-app login: ubuntu
Password:
Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 3.13.0-87-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

ubuntu@xr-lxc-app:~$

```

Perfect! You've launched an ubuntu container on your devbox.
{: .notice--success}

### Create/Install your app

In this example we'll install iperf as a sample application.You may choose to skip this step if you have another app in mind.

sudo password:  **ubuntu**
{: .notice--info}

```shell

ubuntu@xr-lxc-app:~$ sudo apt-get -y install iperf
[sudo] password for ubuntu:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  iperf
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 56.3 kB of archives.
After this operation, 174 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ trusty/universe iperf amd64 2.0.5-3 [56.3 kB]
Fetched 56.3 kB in 2s (23.5 kB/s)
Selecting previously unselected package iperf.
(Reading database ... 14629 files and directories currently installed.)
Preparing to unpack .../iperf_2.0.5-3_amd64.deb ...
Unpacking iperf (2.0.5-3) ...
Setting up iperf (2.0.5-3) ...
ubuntu@xr-lxc-app:~$
ubuntu@xr-lxc-app:~$
ubuntu@xr-lxc-app:~$
ubuntu@xr-lxc-app:~$ iperf -v
iperf version 2.0.5 (08 Jul 2010) pthreads
ubuntu@xr-lxc-app:~$

```

### Change SSH port inside your container

When we deploy the container to IOS-XR, we will share XR's network namespace. Since IOS-XR already uses up port 22 and port 57722 for its own purposes, we need to pick some other port for our container.

**Our recommendation? - Pick some port in the 58xxx range.**
{: .notice--info}

Let's change the SSH port to 58822:

ubuntu@xr-lxc-app:~$ sudo sed -i s/Port\ 22/Port\ 58822/ /etc/ssh/sshd_config
ubuntu@xr-lxc-app:~$

Check that your port was updated successfully:

```shell
ubuntu@xr-lxc-app:~$ cat /etc/ssh/sshd_config | grep Port
Port 58822
ubuntu@xr-lxc-app:~$
```

We're good!
{: .notice--success}

### Shutdown and package your container

Issue a shutdown to escape

```shell
ubuntu@xr-lxc-app:~$ sudo shutdown -h now
ubuntu@xr-lxc-app:~$
Broadcast message from ubuntu@xr-lxc-app
	(/dev/lxc/console) at 19:37 ...

The system is going down for halt NOW!

------------------------------ snip output ------------------------------------

mount: cannot mount block device /dev/sda1 read-only
 * Will now halt
vagrant@vagrant-ubuntu-trusty-64:~$
vagrant@vagrant-ubuntu-trusty-64:~$
```

We're back on our devbox.
Now hop over to the directory `/var/lib/lxc/xr-lxc-app` and package the rootfs into a tar ball.
In the end we transfer the tar ball to the home directory (~/ or /home/vagrant)

**You will need to be root for this operation**
{: .notice--warning}

vagrant@vagrant-ubuntu-trusty-64:~$ sudo -s
root@vagrant-ubuntu-trusty-64:~#
root@vagrant-ubuntu-trusty-64:~# whoami
root
root@vagrant-ubuntu-trusty-64:~# cd /var/lib/lxc/xr-lxc-app/
root@vagrant-ubuntu-trusty-64:/var/lib/lxc/xr-lxc-app# ls
config  fstab  rootfs
root@vagrant-ubuntu-trusty-64:/var/lib/lxc/xr-lxc-app# cd rootfs
root@vagrant-ubuntu-trusty-64:/var/lib/lxc/xr-lxc-app/rootfs#
root@vagrant-ubuntu-trusty-64:/var/lib/lxc/xr-lxc-app/rootfs# tar -czf xr-lxc-app-rootfs.tar.gz *
tar: dev/log: socket ignored
root@vagrant-ubuntu-trusty-64:/var/lib/lxc/xr-lxc-app/rootfs#
root@vagrant-ubuntu-trusty-64:/var/lib/lxc/xr-lxc-app/rootfs#mv *.tar.gz /home/vagrant
root@vagrant-ubuntu-trusty-64:/var/lib/lxc/xr-lxc-app/rootfs#ls -l /home/vagrant
total 119984
-rw-r--r-- 1 root root 122863332 Jun 16 19:41 xr-lxc-app-rootfs.tar.gz

## Create LXC SPEC XML File

We need to create an XML file that will define different parameters (cpu, mem, rootfs location etc.) for the container launch on IOS-XR (which uses libvirt).
On the devbox, use your favorite editor (vi, nano, pico etc.) to create a new file called
`xr-lxc-app.xml` under `/home/vagrant` of the devbox with the following content:

```html
<domain type='lxc' xmlns:lxc='http://libvirt.org/schemas/domain/lxc/1.0' >
<name>xr-lxc-app</name>
<memory>327680</memory>
<os>
<type>exe</type>
<init>/sbin/init</init>
</os>
<lxc:namespace>
<sharenet type='netns' value='global-vrf'/>
</lxc:namespace>
<vcpu>1</vcpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/lib64/libvirt/libvirt_lxc</emulator>
<filesystem type='mount'>
<source dir='/misc/app_host/xr-lxc-app/'/>
<target dir='/'/>
</filesystem>
<console type='pty'/>
</devices>
</domain>

```

>
A couple of configuration knobs seem interesting in the above XML file:
>
*  The netns (network namespace) setting:
>
   ```html
   `<sharenet type='netns' value='global-vrf'/>`;
   ```
>
   In IOS-XR the **'global-vrf' network namespace houses all the XR Gig/Mgmt interfaces that are
   in the global/default VRF.** The sharenet setting above makes sure that the container on launch
   will also have access to all of XR's interfaces natively
>
*  The rootfs mount volume:
>
   ```html
   `<source dir='/misc/app_host/xr-lxc-app/'/>`;
   ```
>
   **/misc/app_host/ in IOS-XR is a special mount volume** that is designed to provide nearly 3.9G
   of Disk space on IOS-XRv and varying amounts on other platforms (NCS5508, ASR9k) etc. This
   mount volume may be used to host custom container rootfs and other large files without using up
   XR's disk space. **In this case we expect the rootfs to be untarred in the
   /misc/app_host/xr-lxc-app/ directory**
{: .notice--info}

Your LXC app is now ready to be deployed! You should have the following two components in the home directory of the devbox:

```shell
root@vagrant-ubuntu-trusty-64:~# pwd
/home/vagrant
root@vagrant-ubuntu-trusty-64:~# ls -l
total 119988
-rw-r--r-- 1 root root 122863332 Jun 16 19:41 xr-lxc-app-rootfs.tar.gz
-rw-r--r-- 1 root root       590 Jun 16 23:29 xr-lxc-app.xml
root@vagrant-ubuntu-trusty-64:~#
```

## Transfer rootfs and XML file to XR

We can either use the XR Gig or Mgmt interface to transfer the files.
IOS-XR runs openssh in the linux environment on port 57722.

>
We need to transfer the files to the **/misc/app_host** volume on IOS-XR.
However, /misc/app_host is owned by root and root access over SSH is not allowed, for obvious security reasons.
>
Hence, to enable the transfer of custom files to IOS-XR, we provide a `/misc/app_host/scratch` directory which is owned by the app_host group. Any user transferring files over SSH to this directory must be part of the app_host group to have access.The user `vagrant` is already part of the app_host group.
{: .notice--info}

**Transfer using the Gig interface:**

**The password for the vagrant user is `vagrant`**
{: .notice--info}

```
scp -P 57722 /home/vagrant/xr-lxc-app-rootfs.tar.gz vagrant@<IP_ADDRESS>:/misc/app_host/scratch/
scp -P 57722 /home/vagrant/xr-lxc-app.xml vagrant@<IP_ADDRESS>:/misc/app_host/scratch/
```
Where <IP_ADDRESS> is the directly connected Gig0/0/0/0 interface of IOS-XR instance (this config was explained in the [XR Toolbox, Part 3: App Development Topology]({{ base_path }}/tutorials/2016-06-06-xr-toolbox-app-development-topology) tutorial).

**But this process might be slow since Gig interfaces in the Vagrant IOS-XR image are rate-limited.**

**Transfer using the Mgmt interface**

Vagrant forwards the port 57722 to some host port for IOS-XR over the management port. In Virtualbox, the IP address of the host (your laptop) is always <IP_ADDRESS> for the NAT'ed port.

So determine the forwarded port for port 57722 for XR on your laptop shell (in a separate window):

```shell
AKSHSHAR-M-K0DS:lxc-app-topo-bootstrap akshshar$ vagrant port rtr
The forwarded ports for the machine are listed below. Please note that
these values may differ from values configured in the Vagrantfile if the
provider supports automatic port collision detection and resolution.

    22 (guest) => 2223 (host)
 57722 (guest) => 2222 (host)
AKSHSHAR-M-K0DS:lxc-app-topo-bootstrap akshshar$

```

Now use port `2222` to transfer the files over the management port using the host IP = <IP_ADDRESS> from your devbox

```shell
vagrant@vagrant-ubuntu-trusty-64:~$ scp -P 2222 /home/vagrant/*.* vagrant@<IP_ADDRESS>:/misc/app_host/scratch
The authenticity of host '[<IP_ADDRESS>]:2222 ([<IP_ADDRESS>]:2222)' can't be established.
ECDSA key fingerprint is db:25:e2:27:49:2a:7b:27:e1:76:a6:7a:e4:70:f5:f7.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[<IP_ADDRESS>]:2222' (ECDSA) to the list of known hosts.
<EMAIL_ADDRESS>password:
xr-lxc-app-rootfs.tar.gz                                   100%  117MB  16.7MB/s   00:07
xr-lxc-app.xml                                             100%  590     0.6KB/s   00:00
vagrant@vagrant-ubuntu-trusty-64:~$

```

## Untar rootfs under /misc/app_host/

Let's hop onto the IOS-XR instance.

```shell
AKSHSHAR-M-K0DS:lxc-app-topo-bootstrap akshshar$ vagrant ssh rtr
Last login: Thu Jun 16 19:45:33 2016 from <IP_ADDRESS>
xr-vm_node0_RP0_CPU0:~$
xr-vm_node0_RP0_CPU0:~$
```

Create a directory `xr-lxc-app/`(remember the source dir in the XML file?) under `/misc/app_host`:

You need to be sudo to perform the next set of tasks.
{: .notice--info}

```shell
sudo mkdir /misc/app_host/xr-lxc-app/
```

Now untar the rootfs tar-ball that we transferred to the /misc/app_host/scratch directory into the newly created /misc/app_host/xr-lxc-app/ directory.

xr-vm_node0_RP0_CPU0:~$cd /misc/app_host/xr-lxc-app/
xr-vm_node0_RP0_CPU0:/misc/app_host/xr-lxc-app$
xr-vm_node0_RP0_CPU0:/misc/app_host/xr-lxc-app$sudo tar -zxf ../scratch/xr-lxc-app-rootfs.tar.gz
tar: dev/mpu401data: Cannot mknod: Operation not permitted
tar: dev/rmidi3: Cannot mknod: Operation not permitted
tar: dev/rmidi2: Cannot mknod: Operation not permitted
tar: dev/smpte1: Cannot mknod: Operation not permitted
tar: dev/audio1: Cannot mknod: Operation not permitted
tar: dev/smpte0: Cannot mknod: Operation not permitted
tar: dev/midi0: Cannot mknod: Operation not permitted
tar: dev/mixer1: Cannot mknod: Operation not permitted
tar: dev/smpte3: Cannot mknod: Operation not permitted

--------------------------- snip output --------------------------

Ignore the "Operation not permitted" messages when you untar. These are harmless.
{: .notice--warning}

## Use virsh to launch container

Now we use the XML file that we transferred to `/misc/app_host/scratch` to launch our container.

libvirtd is the daemon running on IOS-XR to help launch LXC containers. The client for libvirtd (virsh) is made available in the XR linux shell to interact with the libvirtd daemon.
{: .notice--info}

To perform the virsh client commands, you will need to be root. In order to properly source the right environment variables for the virsh commands to connect to the libvirtd daemon, use the "-i" flag with "sudo" when becoming root.

Become root:

```shell
xr-vm_node0_RP0_CPU0:~$ sudo -i
xr-vm_node0_RP0_CPU0:~$

```

The "vagrant" user is already a part of the sudoers group, so you won't be asked for the sudo password. But when you create your own users, expect the password prompt to show up.
{: .notice--info}

To list the current running containers:

```shell

xr-vm_node0_RP0_CPU0:~$ virsh list
 Id    Name                           State
----------------------------------------------------
 4922  sysadmin                       running
 12010 default-sdr--1                 running

xr-vm_node0_RP0_CPU0:~$

```

Now launch the container using `virsh create` and the XML file we transferred earlier:

xr-vm_node0_RP0_CPU0:~$ virsh create /misc/app_host/scratch/xr-lxc-app.xml
Domain xr-lxc-app created from /misc/app_host/scratch/xr-lxc-app.xml

xr-vm_node0_RP0_CPU0:~$
xr-vm_node0_RP0_CPU0:~$
xr-vm_node0_RP0_CPU0:~$ virsh list
 Id    Name                           State
----------------------------------------------------
 4922  sysadmin                       running
 7315  xr-lxc-app                     running
 12010 default-sdr--1                 running

xr-vm_node0_RP0_CPU0:~$

To get into the container, you have two options:

Our credentials for the container were:

Username: **ubuntu**
Password: **ubuntu**
{: .notice--info}

* Use `virsh console`:

  ```shell

  xr-vm_node0_RP0_CPU0:~$ virsh console xr-lxc-app
  Connected to domain xr-lxc-app
  Escape character is ^]
  init: Unable to create device: /dev/kmsg
  * Stopping Send an event to indicate plymouth is up                     [ OK ]
  * Starting Mount filesystems on boot                                    [ OK ]
  * Starting Signal sysvinit that the rootfs is mounted                   [ OK ]
  * Starting Fix-up sensitive /proc filesystem entries                    [ OK ]

  -------------------------------- snip output ---------------------------------

  Ubuntu 14.04.4 LTS xr-lxc-app tty1

  xr-lxc-app login: ubuntu
  Password:
  Last login: Thu Jun 16 19:23:10 UTC 2016 on lxc/console
  Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 3.14.23-WR<IP_ADDRESS>_standard x86_64)

  * Documentation:  https://help.ubuntu.com/
  ubuntu@xr-lxc-app:~$
  ubuntu@xr-lxc-app:~$
  ubuntu@xr-lxc-app:~$

  ```

  To get out of the container console, issue  **Ctrl+]**
  {: .notice--info}

* Use SSH to get into the container:

  We set the SSH port to 58822 earlier, we can use any of XR's interface addresses to log in:

  ```shell

  xr-vm_node0_RP0_CPU0:~$ ssh -p 58822<EMAIL_ADDRESS>  Warning: Permanently added '[<IP_ADDRESS>]:58822' (ECDSA) to the list of known hosts.
<EMAIL_ADDRESS>password:
  Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 3.14.23-WR<IP_ADDRESS>_standard x86_64)

  * Documentation:  https://help.ubuntu.com/
  Last login: Fri Jun 17 16:42:13 2016
  ubuntu@xr-lxc-app:~$

  ```

  >
  If you'd like to be able to access the container directly from your laptop, then make sure you
  forward the intended port (in this case 58822) to your laptop (any port of your choice), in the
  Vagrantfile:
  >
  ```
  node.vm.network "forwarded_port", guest: 58822, host: 58822
  ```
  >
  With the above setting in the Vagrantfile, you can ssh to the container directly from your
  laptop using:
  >
  ```
  ssh -p 58822 vagrant@localhost
  ```
  {: .notice--info}

Perfect! Our container is up and running!
{: .notice--success}

## Test your app!

Now that we have our container up and running, let's see how we run our app (iperf in our case).

Think of the LXC container as your own linux server on the router. Because we share the network namespace between the LXC and XR, all of XR's interfaces (Gig, Mgmt etc.) are available to bind to and run your applications.

We can see this by issuing an ifconfig inside the running container:

xr-vm_node0_RP0_CPU0:~$ssh -p 58822<EMAIL_ADDRESS>
Warning: Permanently added '[<IP_ADDRESS>]:58822' (ECDSA) to the list of known hosts.
<EMAIL_ADDRESS>password:
Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 3.14.23-WR<IP_ADDRESS>_standard x86_64)

 * Documentation:  https://help.ubuntu.com/
Last login: Fri Jun 17 16:42:13 2016
ubuntu@xr-lxc-app:~$
ubuntu@xr-lxc-app:~$
ubuntu@xr-lxc-app:~$
ubuntu@xr-lxc-app:~$ ifconfig
Gi0_0_0_0 Link encap:Ethernet  HWaddr 08:00:27:17:f9:a8
          inet addr:<IP_ADDRESS>  Mask:<IP_ADDRESS>
          inet6 addr: fe80::a00:27ff:fe17:f9a8/64 Scope:Link
          UP RUNNING NOARP MULTICAST  MTU:1514  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1 errors:0 dropped:3 overruns:0 carrier:1
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:42 (42.0 B)

Mg0_RP0_CPU0_0 Link encap:Ethernet  HWaddr 08:00:27:13:ad:eb
          inet addr:<IP_ADDRESS>  Mask:<IP_ADDRESS>
          inet6 addr: fe80::a00:27ff:fe13:adeb/64 Scope:Link
          UP RUNNING NOARP MULTICAST  MTU:1514  Metric:1
          RX packets:89658 errors:0 dropped:0 overruns:0 frame:0
          TX packets:34130 errors:0 dropped:0 overruns:0 carrier:1
          collisions:0 txqueuelen:1000
          RX bytes:127933763 (127.9 MB)  TX bytes:2135907 (2.1 MB)

------------------------------- snip output -----------------------------------

### Set the src-hint for Application traffic

By default, your XR Vagrant box is set up to talk to the internet using a default route through your management port.

If you want the router to use XR's routing table and talk to other nodes in the topology, then you need to set the "tpa address" in XR's configuration. This becomes the "src-hint" for all linux application traffic. The reason we use something like "loopback 0" is to make sure that the IP for any originating traffic for applications on the router is a reachable IP address across your topology.
{: .notice--warning}

AKSHSHAR-M-K0DS:lxc-app-topo-bootstrap akshshar$ vagrant port rtr | grep 22
    22 (guest) => 2223 (host)
 57722 (guest) => 2222 (host)
AKSHSHAR-M-K0DS:lxc-app-topo-bootstrap akshshar$
AKSHSHAR-M-K0DS:lxc-app-topo-bootstrap akshshar$
AKSHSHAR-M-K0DS:lxc-app-topo-bootstrap akshshar$ ssh -p 2223 vagrant@localhost
vagrant@localhost's password:

RP/0/RP0/CPU0:ios#
RP/0/RP0/CPU0:ios#conf t
Fri Jun 17 17:34:45.707 UTC
RP/0/RP0/CPU0:ios(config)#int loopback 0
RP/0/RP0/CPU0:ios(config-if)#ip address <IP_ADDRESS>/32
RP/0/RP0/CPU0:ios(config-if)#exit
RP/0/RP0/CPU0:ios(config)#tpa address-family ipv4 update-source loopback 0
RP/0/RP0/CPU0:ios(config)#commit
Fri Jun 17 17:35:19.815 UTC
RP/0/RP0/CPU0:ios(config)#
RP/0/RP0/CPU0:ios(config)#exit
RP/0/RP0/CPU0:ios#

Let's say we've set up the TPA address as shown above, you should see the following route in XR's linux shell:

RP/0/RP0/CPU0:ios#bash
Fri Jun 17 17:39:37.771 UTC

[xr-vm_node0_RP0_CPU0:~]$
[xr-vm_node0_RP0_CPU0:~]$ip route
default dev fwdintf  scope link  src <IP_ADDRESS>
<IP_ADDRESS>/24 dev Mg0_RP0_CPU0_0  proto kernel  scope link  src <IP_ADDRESS>
[xr-vm_node0_RP0_CPU0:~]$

So all you've really done using the `tpa address-family...`  config is to set src address for all application traffic to XR's loopback0 address.

The advantage of this approach is that when you use larger topologies that may include routing protocols like OSPF,BGP or even static routes, all you have to do is make loopback0 reachable and the application will be able to communicate across the entire topology. Also, this significantly reduces the routing table size in the linux environment as you can see in the output above.
{: .notice--warning}

### See if things work!

We're going to use an iperf-server inside our container on XR and an iperf-client running on devbox. You could reverse the client-server setup if you want.

Start the iperf server inside the Container on XR:

xr-vm_node0_RP0_CPU0:~$ ssh -p 58822<EMAIL_ADDRESS>
<EMAIL_ADDRESS>password:
Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 3.14.23-WR<IP_ADDRESS>_standard x86_64)

 * Documentation:  https://help.ubuntu.com/
Last login: Fri Jun 17 18:09:50 2016 from <IP_ADDRESS>
ubuntu@xr-lxc-app:~$
ubuntu@xr-lxc-app:~$ iperf -s -u
------------------------------------------------------------
Server listening on UDP port 5001
Receiving 1470 byte datagrams
UDP buffer size: 64.0 MByte (default)
------------------------------------------------------------

Keep the iperf server (started above) running, as you proceed to initiate the iperf client on the devbox.
{: .notice--warning}

Let's make sure XR's loopback0 is reachable from the devbox (since we're not running routing protocols in this topology, this isn't automatic):

AKSHSHAR-M-K0DS:lxc-app-topo-bootstrap akshshar$ vagrant ssh devbox
Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 3.13.0-87-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

---------------------------- snip output -------------------------------
vagrant@vagrant-ubuntu-trusty-64:~$
vagrant@vagrant-ubuntu-trusty-64:~$ sudo ip route add <IP_ADDRESS>/32 via <IP_ADDRESS>
vagrant@vagrant-ubuntu-trusty-64:~$
vagrant@vagrant-ubuntu-trusty-64:~$ ping <IP_ADDRESS>
PING <IP_ADDRESS> (<IP_ADDRESS>) 56(84) bytes of data.
64 bytes from <IP_ADDRESS>: icmp_seq=1 ttl=255 time=6.53 ms
64 bytes from <IP_ADDRESS>: icmp_seq=2 ttl=255 time=1.77 ms

Install iperf on devbox and start the iperf client there (to point to XR loopback=<IP_ADDRESS>):

```shell
vagrant@vagrant-ubuntu-trusty-64:~$ sudo apt-get install iperf
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  iperf
---------------------------- snip output -------------------------------

```

vagrant@vagrant-ubuntu-trusty-64:~$ iperf -u -c <IP_ADDRESS>
------------------------------------------------------------
Client connecting to <IP_ADDRESS>, UDP port 5001
Sending 1470 byte datagrams
UDP buffer size:  208 KByte (default)
------------------------------------------------------------
[  3] local <IP_ADDRESS> port 54284 connected with <IP_ADDRESS> port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  1.25 MBytes  1.05 Mbits/sec
[  3] Sent 893 datagrams
[  3] Server Report:
[  3]  0.0-10.0 sec  1.25 MBytes  1.05 Mbits/sec   0.275 ms    0/  893 (0%)
vagrant@vagrant-ubuntu-trusty-64:~$

There you have it! iperf running inside an Ubuntu Container on IOS-XR. Too many steps to look up? In our next tutorial, we look at automating all of the  steps needed to bring up a container using an Ansible Playbook: **[IOS-XR: Ansible based LXC deployment]({{ base_path }}/tutorials/2016-06-08-ios-xr-ansible-container-deployment/)**
{: .notice--success}

repository: xrdocs/application-hosting

branch_name: refs/heads/gh-pages

gha_language: SCSS

repo_name: xrdocs/application-hosting


text:
# Estimating the impacts of CA SB 827
In January 2018 California State Senator Wiener introduced [Senate Bill 827 Planning and zoning: transit-rich housing bonus](https://leginfo.legislature.ca.gov/faces/billTextClient.xhtml?bill_id=201720180SB827) or for short SB 827. This bill has the potential to be the most impactful housing bill the state has passed since 1978's Prop 13 and as such there's been a lot of public response to the bill. This repo was started by the [Policy Club](http://policyclub.io) to estimate the specific impacts of SB 827 on the City of Los Angeles. This repo is set up such that by contributing a few files one could extend this analysis to estimate the impacts of SB 827 on other California cities.
## Data for the Map

In order to create the map for a city, we need 3 things: (1) a Zoning file as a geojson (2) a zoning attributes file and (3) transit data, specifically a high quality transit definition.

### (1) Zoning File (GeoJSON)

We used the City of LA's zoning file, downloaded as `.geojson` from the [LA City Geohub](geohub.lacity.org). The zoning file must contain an attribute called `zone`, which will be used to join it with the zoning attributes file.

### (2) Zoning Attributes Table (CSV)
For each unique `zone` type in the zoning spatial file, you'll need to describe it in an attributes table. In the zoning-metadata.csv file, you'll need to provide True/False data for six new fields for SB 827.

+ `sb_827_parking`: True if parking requirements are wavied
+ `sb_827_FAR`: True if the FAR requirements are changed.
+ `sb_827_res_density`: True if there are requirements on minimum residental density that are removed.
+ `sb_827_height_quarter_mile`: True if the height limit is increased if within 1/4 quarter mile of a trasit stop.
+ `sb_827_height_half_mile`: Same as above, but for the 1/2 mile heights, rather than the quarter mile heights.
+ `sb_827_non_res`: True if the zone is a non-residential type (ie, Industrial, Park, Government Center). Additionaly

Example table (only first three, and last six columns shown)

| zone | zone type | use | sb_827_parking | sb_827_FAR | sb_827_res_density | sb_827_height_quarter_mile | sb_827_height_half_mile | sb_827_non_res |
|-|-|-|-|-|-|-|-|-|
| Agricultural | A1 | Agricultural |||||||
|One-Family Residential | R1 | One-Family Dwelling|
|Multiple Residential | R2 | Two Family Dwellings|
|Manufacturing | M2 | Light Industrial|

For a full example, check out the file in `los-angeles/los-angeles/zoning-metadata.csv`

### Zoning.Space

As of 25 Febuary 2018, Zoning Data is now being populatd at the Zoning.Space Repo. It is a submodule of this repo, we use it to generate SB 827 specific shapefiles. Checkout more at [Zoning.Space](https://github.com/zoningspace/zoning.space.git)

### (3) Transit Data (GeoJSON)
We use Transit Data that we have gotten data from their GTFS feeds and applied a filter for meeting SB 827 standards.

## Contributing

Submit updates to the spec in the form of Pull Requests.

Questions? Comments? Open an issue and we'll work with you to help get your city analyzed.

repository: policyclub/zoning-metadata

branch_name: refs/heads/master

extension: md

gha_language: Jupyter Notebook

license_type: permissive

repo_name: policyclub/zoning-metadata


text:
---
toc: false
id: 434
title: Hackers Launch PDF Attacks
date: 2009-07-26T23:51:53+00:00
author: Ajay Matharu
layout: post
guid: https://ajaymatharu.wordpress.com/?p=434
permalink: /hackers-launch-pdf-attacks/
bte_opp_original_pub_date:
  - 2008-11-09 16:39:17
dsq_thread_id:
  - 465388564
categories:
  - Technology
tags:
  - Hacking
---
Attackers are exploiting one of the vulnerabilities in Adobe Reader that was patched earlier this week, a security researcher warned Friday as he urged users to update as soon as possible.

According to Bojan Zdrnja, an analyst at the SANS Institute’s Internet Storm Center (ISC), malicious PDF (Portable Document Format) files are circulating that infect systems by exploiting one of the eight bugs Adobe Systems Inc. patched Tuesday.

“This is not surprising, though, as a fully working [proof-of-concept] has been recently published,” said Zdrnja in an alert posted to the ISC site early Friday. “But it’s interesting to see that the attackers modified the proof-of-concept a little bit, probably in order to evade anti-virus detection.”

Shortly before Adobe patched the older Reader 8.1.2, Core Security Technologies, a security company that had reported the bug to Adobe in May, published sample attack code as part of its own advisory about the danger posed by rogue PDF files.

The malicious PDFs examined by Zdrnja contained a variation of the Core Security code. “Parts of the publicly-posted proof-of-concept are visible, but the attackers also modified certain parts,” he said. “This was probably enough to fool the [anti-virus] vendors.”

In fact, that was the result, Zdrnja argued. As of 11 a.m. EST, no anti-virus company had yet released a detection signature that could finger the malformed PDF files.

A second attack PDF, published to the milw0rm.com site on Wednesday, is slightly more visible to anti-virus vendors. The proof-of-concept PDF is currently identified by about 14% of anti-virus vendors, according to VirusTotal, a free scanning and reporting service.

“If you haven’t patched your Adobe Reader installations, do it ASAP as the attacks are in the wild,” Zdrnja urged.

The patches released Tuesday bring Adobe Reader and Adobe Acrobat up to version 8.1.3. Although that edition has been superseded by Reader and Acrobat 9, which debuted in June, most users continue to run older software long after updates or upgrades are available, according to statistics published earlier this year by Secunia ASP, a Danish vulnerability tracking company. Secunia offers a free utility called Personal Software Inspector (PSI) that scans Windows machines for unpatched and out-of-date software.

Users running Reader 9 or Acrobat 9 are safe from the current round of PDF attacks, according to Adobe.

license: MIT

gha_language: HTML

gha_license_id: MIT


text:
### [1552\. Magnetic Force Between Two Balls](https://leetcode.com/problems/magnetic-force-between-two-balls/)

Difficulty: **Medium**

Related Topics: [Array](https://leetcode.com/tag/array/), [Binary Search](https://leetcode.com/tag/binary-search/)

In universe Earth C-137, Rick discovered a special form of magnetic force between two balls if they are put in his new invented basket.

Rick stated that magnetic force between two different balls at positions `x` and `y` is `|x - y|`.

Given the integer array `position` and the integer `m`. Return _the required force_.

**Example 1:**

![](https://assets.leetcode.com/uploads/2020/08/11/q3v1.jpg)

```
Input: position = [1,2,3,4,7], m = 3
Output: 3
Explanation: Distributing the 3 balls into baskets 1, 4 and 7 will make the magnetic force between ball pairs [3, 3, 6]. The minimum magnetic force is 3\. We cannot achieve a larger minimum magnetic force than 3.
```

**Example 2:**

```
Input: position = [5,4,3,2,1,1000000000], m = 2
Output: 999999999
Explanation: We can use baskets 1 and<PHONE_NUMBER>.
```

**Constraints:**

*   `n == position.length`
*   `2 <= n <= 10^5`
*   `1 <= position[i] <= 10^9`
*   All integers in `position` are **distinct**.
*   `2 <= m <= position.length`

#### Solution

Language: **JavaScript**

```javascript
/**
 * @param {number[]} position
 * @param {number} m
 * @return {number}
 */
var maxDistance = function(position, m) {
    position.sort((a, b) => a - b)
    const n = position.length
    let left = 1, right = 10 ** 9 + 1

    function isAvailable(d) {
        let count = 0, prev = -Infinity
        for (const current of position) {
            if (current - prev >= d) {
                count += 1
                prev = current
            }
            if (count >= m) return true
        }
        return false
    }

    while (left < right) {
        const middle = Math.ceil((right + left) / 2)
        if (isAvailable(middle)) {
            left = middle
        } else {
            right = middle - 1
        }
    }

    return left
};
```


text:
# Capstone - Quantum Cascade Laser Driver

## Installing MicroPython on STM32F4-Discovery

![](https://i.imgur.com/inINue8.jpg)

**Software needed on the host (Ubuntu)**

To compile Micro Python, the `arm-none-eabi` cross-compiler is needed. On newer Ubuntu versions this could be easily installed through apt:

    $ sudo apt-get install gcc-arm-none-eabi

Also you will need the [stlink](https://github.com/texane/stlink) utility from texane. For more details on how to install stlink, please consult texane’s [README](https://github.com/texane/stlink/blob/master/README).

To download the ELF firmware, you will also need the GDB for arm-none-eabi. In theory this could be done by the following apt statement:

    $ sudo apt-get install gdb-arm-none-eabi libnewlib-arm-none-eabi

But unfortunately if you have installed any other gdb already (which is likely), this command will fail due a conflicting manpage! Thus, the following work-around is needed:

    $ sudo apt-get install -d gdb-arm-none-eabi
    $ sudo dpkg -i --force-overwrite /var/cache/apt/archives/gdb-arm-none-eabi_VERSION_amd64.deb

Change VERSION to your `gdb-arm-none-eabi` version.

### Building Micro Python for the Discovery

Clone the Micro Python git repository:

    $ git clone https://github.com/micropython/micropython.git

Now change into the micropython directory and build for the STM32F4-Discovery:

    $ cd micropython
    $ cd ports/stm32
    $ make BOARD=STM32F4DISC

This should create the firmware.elf in `stm32/build-STM32F4DISC`.

### Flash the Micro Python firmware to the Discovery

Connect the Discovery through USB (the one on with the Mini-B connector, don’t connect the USB-OTG), then start (in a separate terminal) the stlinkt utilit:

    $ st-util

The `st-util` now waits for a connection from GDB. This is done like so (assuming you are still in the `micropython/ports/stm32` directory):

    $ arm-none-eabi-gdb build-STM32F4DISC/firmware.elf

Within GDB connect to st-util by:

    target extended localhost:4242

And flash the firmware with:

    load

The multi-color COM-LED should blink while loading. After downloading finised, terminate GDB.

Now disconnect the USB Mini-B cable to power the board completely off.  Connect a USB-OTG on the opposite side, and reconnect the USB Mini-B cable for power. After a few seconds, the STM should be mounted as a storage device showing the files `boot.py` and `main.py`. It is also possible to open a Python shell on the serial device `/dev/ttyACM0` or `/dev/ttyACM1`:

    $ screen /dev/ttyACM1

## Creating development environment

#### Step 1: Install a [Miniconda](http://conda.pydata.org/miniconda.html) (or [Anaconda](https://www.continuum.io/downloads) environment)

-----------------------------------------------------------------

Any Linux, Mac OS X, or Windows computer should be suitable.

If you don't already have conda on your machine, you can get it from [Miniconda](http://conda.pydata.org/miniconda.html), by opening a terminal window and

##### Download Miniconda

    # for linux
    $ wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh

    # for osx
    $ wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh

    # for windows
    # go to: https://conda.io/miniconda.html

##### Install Miniconda

    $ bash miniconda.sh
    # follow instructions

#### Step 2: Clone beyond-matplotlib-tutorial-sea-2018 git repo

    git clone https://github.com/andersy005/capstone.git

#### Step 3: Then `cd` to the capstone folder and create a separate Conda environment to work in for this tutorial

    cd capstone
    conda env update

This downloads all of the dependencies and then all you have to is:

    source activate capstone

(omitting "source" if you are on Windows).


text:
[ ![Download](https://api.bintray.com/packages/wjtan/maven/jbcrypt/images/download.svg) ](https://bintray.com/wjtan/maven/jbcrypt/_latestVersion)

# JBCrypt
jBCrypt is an implementation of the OpenBSD Blowfish password hashing algorithm,
as described in ["A Future-Adaptable Password
Scheme"](http://www.openbsd.org/papers/bcrypt-paper.ps) by Niels Provos and
David Mazieres.

This system hashes passwords using a version of Bruce Schneier's Blowfish block
cipher with modifications designed to raise the cost of off-line password
cracking. The computation cost of the algorithm is parameterised, so it can be
increased as computers get faster.

JUnit regression tests are available in in TestBCrypt.java

jBCrypt is licensed under a ISC/BSD licence. See the LICENSE file for details.

Please report bugs to Damien Miller<EMAIL_ADDRESS>Please check the
TODO file first, in case your problem is something I already know about
(please send patches!)

A simple example that demonstrates most of the features:

	// Hash a password for the first time
	String hashed = BCrypt.hashpw(password, BCrypt.gensalt());

	// gensalt's log_rounds parameter determines the complexity
	// the work factor is 2**log_rounds, and the default is 10
	String hashed = BCrypt.hashpw(password, BCrypt.gensalt(12));

	// Check that an unencrypted password matches one that has
	// previously been hashed
	if (BCrypt.checkpw(candidate, hashed))
		System.out.println("It matches");
	else
		System.out.println("It does not match");

There is also a [C#/.NET port by Derek Slager](http://derekslager.com/blog/posts/2007/10/bcrypt-dotnet-strong-password-hashing-for-dotnet-and-mono.ashx)

# Package notes

This is an distribution of [jBCrypt](https://github.com/anebril/jBCrypt/tree/gcsvn-merged-0.4-overflow-fix) patched by [anebril](https://github.com/anebril),
based on the discussion in [Stackoverflow](https://stackoverflow.com/questions/38597604/java-bcrypt-not-supporting-newer-versions-seeds-prefixed-with-2b-2y-etc).
It has been packaged to ease use in existing applications.

## Maven setup

Use it in your project by adding the following to your project *pom.xml*:

        <dependency>
            <groupId>sg.wjtan</groupId>
            <artifactId>jBCrypt</artifactId>
            <version>0.4.1</version>
        </dependency>

repository: wjtan/jBCrypt

repo_name: wjtan/jBCrypt


text:
PhpCsCommand
====================

## About

Lumen/Laravel wrapper around PHPCS-Fixer package that allows, using artisan command, easly apply pre-defined coding standards to your laravel or lumen project.

Wrapper uses [PHP Coding Standards Fixer package](https://github.com/FriendsOfPHP/PHP-CS-Fixer)

List of all fixer rules can be found [here](https://mlocati.github.io/php-cs-fixer-configurator)

## Features

* Adds console command `php artisan phpcs:fix` that fixes your project to follow standards defined in your `config/phpcs.php`
* Adds command to install pre-commit git hook `php artisan phpcs:install-hook`. After install phpcs:fix will be triggered before each commit and will auto fix your code

## Install

* Install as composer package

```bash
$ composer require noitran/cs-fixer-command
```

#### Laravel

* Laravel uses provider auto discovery. Config file can be published using command

```
$ artisan vendor:publish --provider="Noitran\CsFixer\CsFixerServiceProvider"
```

#### Lumen

* Open your bootstrap/app.php and register as service provider

```php
$app->register(Noitran\CsFixer\CsFixerServiceProvider::class);
```

* Config file should be loaded manually in bootstrap/app.php

```php
$app->configure('phpcs');
```

## Usage

* Publish `phpcs` and change if necessary, run command for inspection `php artisan phpcs:fix`

* Hook installation can be done using command `php artisan phpcs:install-hook`

* Hook install command can be added into `composer.json` as post-install command, so that, at example, other team members will get pre-commit hook when installing composer dependencies at first time.

#### Example: Adding as composer post-install command

```json
{
    "name": "laravel/lumen",
    "require": {
        ...
    },
    "autoload": {
        ...
    },
    "scripts": {
        "post-install-cmd": [
            "php artisan phpcs:install-hook"
        ],
        "post-update-cmd": [
            ...
        ]
    }
}
```

repository: noitran/cs-fixer-command

repo_name: noitran/cs-fixer-command


text:
# Changelog

This file will contain the most important changes in the different versions of the package.

While the version is below v1, it will follow this versioning:

Minor version change (0.x.0) means a breaking change that may require you to do some reconfigurations.

Patch version changes (0.0.x) means a feature and/or bug fix.

# 0.3.0

**Date**: 11.01.2020

**Changes**:

Changes shebang from `/usr/bin/node` to `/usr/bin/env node` in order to support systems where node is not located within `/usr/bin` (see #8).

This may be a possible breaking change depending on your setup. In most cases, it will work flawlessly. However, should you have a different node version within your path than that of `/usr/bin/node`, there may be issues.

# 0.2.3

**Date**: 09.02.2018

**Changes**:

No features, just bug fixes. Fixes a crash that would occur if the CLI could not get in contact with Gogs. When not able to contact through the hostname, a more nicely formatted error is displayed instead.

# 0.2.2

**Date**: 09.02.2018

**Fixes**: #3, #4, #5

**Changes**:

Adds the option of listing all repositories for a specific user or organization. This can be done by specifying the optional name after `gogs repo list`, such as `gogs repo list reewr`.

Fixes an issue with column formatting when listing repositories that could cause newlines to contain whitespace on the left side of the text, which was not ideal.

Removes filtering by pull requests in `gogs issue list` as this did not work at all. Listing issues did not list any pull requests. Since the pull request API has not yet been implemented, this is, for the moment, impossible to do.

Adds `gogs issue list assigned` that retrieves all the issues that are assigned to you.

Adds an indication of loading since some commands take quite some time. It also feels better to give feedback through it.

`gogs issue list` can now take an organization or a username to list all the issues within the organization's repositories or within the user's repositories.

`gogs issue read` now has a whole new format when outputting, the same goes for `gogs issue reply`, which follows the same formatting as read.

In addition to this, there's a lot of structure changes in the project to allow for simpler development. However, these should be unseen by users.

# 0.2.1

**Date**: 31.01.2018

**Changes**:

Adds two options to `gogs issue list`. `-p` and `-n` (`--pull-requests` and `--no-pull-requests` respectively). These can be used to only list or not list pull requests together with the issues.

Some fixes to issues that could cause the config to be overwritten with default values.
Adds better formatting when listing repositories. Adds `-l` (`--list`) command to `repo list` to allowing printing the repositories as a list of instead of in columns.

# 0.2

**Date**: 31.01.2018

**Fixes**: #1, #2

**Changes**:

This version causes a breaking change. It changes one of the important configuration field names from `host` to `hostname`. As the package is still unstable and under v1, it does not yet follow semantic versioning. Once stable, any breaking changes will incur a major version change.

This version cleans up the configuration code and how hostnames are handled. It should now be possible to use HTTPS Gogs as well (this was a dumb oversight by me when performing testing).

In addition, `ignore_invalid_ssl_cert` has been added as a configuration option to allow you to connect to HTTPS servers that does not have a valid certificate. Please be aware that this means that any certificate is then accepted as valid during the requests preformed by this CLI. It does NOT make any requests to any other sources than the one you defined in the `hostname` field in the config.

# 0.1

**Date**: 29.01.2018

**Changes**:

This was the first version of the CLI, including commands such as:

- gogs config {get, set, describe}
- gogs issue {add, list, read, reply}
- gogs repo {add, list}
- gogs user {find}
- gogs util {gen-autocompletion}

repository: Reewr/gogs-cli

repo_name: Reewr/gogs-cli


text:
# Buffer list

This sample demonstrates how to use a planar (Euclidean) buffer operation by calling `GeometryEngine.Buffer` to generate one or more polygons from a collection of input geometries and a corresponding collection of buffer distances. The result polygons can be returned as individual geometries or unioned into a single polygon output.

<img src="BufferList.jpg" width="350"/>

## Instructions

Tap on the map to add points. Each point will use the buffer distance entered when it was created. The envelope shows the area where you can expect reasonable results for planar buffer operations with the North Central Texas State Plane spatial reference.


text:
# QUARP Implementation

A library for distributed reactiive programming with consistency guarantees in the spirit of Quality Aware Reactive Programing for the IoT (QUARP) (https://haslab.uminho.pt/joseproenca/files/quarp.pdf), implemented as https://github.com/DriesDeBackker/quarp-reactivity.

Provides a DSL for reactive programming, made distributed by usage of the Reactive Programming Middleware dependency: https://github.com/DriesDeBackker/rp-middleware, https://hex.pm/packages/rp_middleware)

Can be easily deployed to embedded devices using https://nerves-project.org

Features fifo (no guarantee), glitch-freedom and logical clock synchronization as guarantees.

Built on top of and integrated with Observables Extended, a Reactive Extensions inspired library for Elixir (https://github.com/DriesDeBackker/observables-extended).

Can be extended with new guarantees if so desired by adding an implementation for the necessary operations in the Context module. See the original 'Quality Aware Reactive Programming for the IoT' paper by Proença, Baquera for further insights (https://haslab.uminho.pt/joseproenca/files/quarp.pdf). (N.B.: terminology and mechanism not strictly identical.)

This library was developed mainly for academic purposes, namely for exploring distributed reactive programming (for the IoT) with consistency guarantees.

## Installation

If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `quarp` to your list of dependencies in `mix.exs`:

```elixir
def deps do
  [
    {:quarp, "~> 1.2"}
  ]
end
```

repository: DriesDeBackker/quarp-reactivity

repo_name: DriesDeBackker/quarp-reactivity


text:
# node-auth-imperial

A Promise-based NodeJS authentication method for Imperial College student accounts. You may find this useful for any applications you are building for student development initiatives on Imperial's campus.

[![Latest Stable Version](https://img.shields.io/npm/v/auth-imperial.svg)](https://www.npmjs.com/package/auth-imperial) [![License](https://img.shields.io/npm/l/auth-imperial.svg)](https://www.npmjs.com/package/auth-imperial) [![NPM Downloads](https://img.shields.io/npm/dt/auth-imperial.svg)](https://www.npmjs.com/package/auth-imperial) [![NPM Downloads](https://img.shields.io/npm/dm/auth-imperial.svg)](https://www.npmjs.com/package/auth-imperial)

## Installing

Assuming you have `node` and `npm` installed, the package can be installed from `npm`'s public registry.
```
npm install auth-imperial
```

## Usage

The module exports one simple default method. Usage examples are below.
```
const authImperial = require("auth-imperial");

(async () => {
    let loggedIn = await authImperial("SHORTCODE", "PASS");
    console.log(loggedIn);
})();

// OR

authImperial("SHORTCODE", "PASS").then(loggedIn => {
    console.log(loggedIn);
});
```

## Inspiration

This came about through the lack of methods to authenticate Imperial student accounts externally of the Imperial College website, with the only other provider on campus requiring setting up a Kerberos instance within the Imperial network to communicate with.

This hindered the development of student projects involving Imperial accounts, having to seek very special permissions from the Imperial ICT team.

## Original Method

After finding an undocumented public API upon the Imperial.ac.uk website, this module was created to allow for student-led projects to attach user accounts to their Imperial student accounts using this API. This was done via:

    POST https://www.imperial.ac.uk/secure/login/

The body for the `POST` request is of the format

    {
        uname: string, // Username / Imperial Shortcode
        pwd: string // Password for their Imperial account
    }

The response from this endpoint would return the resulting HTML of the page to load, which will detail an error message just above the login form based on the success of the login, which was checked against using `cheerio`.

## Current Method

After the Imperial ICT team reached out to us to note that the API endpoint would be deprecated as it was an old webpage that should have been removed long ago but activity from societies and student projects using the endpoint made the ICT team aware of this legacy endpoint.

Luckily, the Imperial College Student Union does offer an endpoint for students to use, which this module has been adapted to using.

    POST https://eactivities.union.ic.ac.uk/user/login

The body for the `POST` request is of the format

    {
        username: string, // Username / Imperial Shortcode
        password: string // Password for their Imperial account
    }

If the username or password is incorrect, a `HTTP 4XX ERROR` is thrown, which is caught and regarded as a failed login attempt. If the user's details are correct, a `HTTP 200 OK` is returned, with the user understood to be verified.

repository: HilliamT/node-auth-imperial

gha_language: JavaScript

repo_name: HilliamT/node-auth-imperial


text:
# Migrating to Alma Linux from CentOS 7 files
This is the first attempt to take the files from the centos folder and install into a new Alma Linux build
It may also work for other RHEL based distros, but am trying with Alma first to see if it works

Run the alma_migrate_fromcentos7.sh
- Installs svn, downloads the files, updates Alma and installs all the packages
- Created on Alma Linux WSL instance but needs more testing
- Also reinstalls/updates python and npm including all the modules

Also included now are versions of the migrate and export scripts based on the CentOS versions for pushing the files to this repo (export)
And also one for migrating to another Alma install (migrate)
- This currently uses a yum.installed file which should still work but ideally should be switched to dnf
- It also does updates and installs as part of the migrate using yum - again should work but ideally a switch to dnf is better

repository: LPulle/Linux

repo_name: LPulle/Linux


text:
# Project Evaluation Activity

__Project Name:__ Mifos

__Evaluation Team:__ Gabe Gordon, Alvaro Luken, Raphael Rios, Natalie Totonchy

---

## Finding info about contributing on the website.

In the following section you should only enter the information that you
found on the project website. Some of the answers will be impossible to find, others
may be very hard to find. Do not _google_ for answers.

__Project website:__ http://mifos.org/

__What is the purpose of the project:__ To speed the elimination of poverty by coordinating a global community that builds, supports, and uses Mifos X, a free and open source platform that enables financial service providers to more effectively and efficiently deliver responsible financial services to the  world’s 2 billion poor and unbanked.

__How easy was it to find information about contributing on the website?__ Easy to find. Multiple links to contributing instructions on the website.

__Contributing instructions:__ https://mifosforge.jira.com/wiki/spaces/MDZ/pages/92012609/How+to+contribute

__URL for the code repository:__ https://github.com/openMF/community-app

__Bug/Issue tracker link:__ https://github.com/openMF/community-app/issues

__Mailing list:__<EMAIL_ADDRESS>
__Chat channel:__ #openMF/mifos (IRC)  https://gitter.im/openMF/mifos (Gitter)

---

## Finding info at the project repository and bug/issue tracker.

__License:__ MPL-2.0

__Is it [OSI approved](https://opensource.org/licenses/alphabetical) license:__ Yes

__Programming Language:__ HTML/JS

__URL for contributing instructions:__ https://mifosforge.jira.com/wiki/spaces/MDZ/pages/92012609/How+to+contribute

__URL for code of conduct / community norms / community guildelines:__ https://github.com/openMF/community-app/community

__URL for instructions for users to dondload an istall the package:__ https://mifosforge.jira.com/wiki/spaces/docs/pages/85033021/Installing+Mifos+X

__Number of contributors:__ 119

__Usernames of three contributors with largest number of commits; for
each of them list the link to their latest commit__: safiyu, vishwasbabu, goutham-M

1. https://github.com/safiyu/community-app/commit/ab7b318db60a9663407317cbdf57c3f5dd410067
2. https://github.com/safiyu/community-app/commit/e6c10b2513d877d31fb73f26cb84024b0b423ca3
3. https://github.com/safiyu/community-app/commit/bd2ecaf1aac51db359e7acb2a1cac2c5989cf61f

__Number of commits:__ 2911

__Latest commit__

- __link to the commit:__ https://github.com/openMF/community-app/commit/de74cc532a13976814c15d29895e49c2404518a5
- __who made that commit:__ translatewiki

__Issues__

- __how many open issues are there:__ 279
    - __url for the last issue created:__ https://github.com/openMF/community-app/issues/2870
    - __how many users discuss the issue:__ 2
    - __when was the issue reported:__ Feb 5, 2018

- __how many closed issues are there:__ 590
    - __url for the last issue closed:__ https://github.com/openMF/community-app/issues/2866
    - __how many users discussed the issue:__ 3
    - __when was the issue reported:__ Feb 4, 2018
    - __when was the issue closed:__ Feb 5, 2018

- __is there active discussion on the issues:__ Yes

- __are there issues marked "good for newbies", "beginner" or some other indicator ot=o imply that they
are good for beginner contributors:__ No. Closest is volunteer.

__Pull requests__

- __how many open pull requests are there:__ 88
    - __url for the last pull request created:__ https://github.com/openMF/community-app/pull/2872
    - __when was the pull request made:__ Feb 5, 2018

- __how many closed pull requests are there:__ 1914
    - __url for the last pull request closed:__ https://github.com/openMF/community-app/pull/2853
    - __how many users discussed the pull request:__ 3
    - __when was the pull request made:__ 15 days ago
    - __when was the pull request closed:__ 12 days ago

- __do maintainers respond quickly to pull requests when they are opened? :__ Yes

---

## Summary assesment
How friendly is this project for beginner contributors? Friendly, but not for novices. Most of issues are handled by a few contributors.

Do the maintainers respond helpfully to questions in issues? No questions in issues.

Are people friendly in the issues, discussion forum, and chat (for example, IRC or Slack)? Yes

Do pull requests get reviewed? Yes

Do maintainers thank people for their contributions? Yes, always say "Thanks for PR".


text:
---
layout: item
title:  "Pathfinder's Greataxe"
sources: [PotA.175]
tags: [weapon, greataxe, unique]
category: "Weapon (greataxe)"
rarity: "Unique"
---

When you wield this +1 greataxe, you always know the way to the nearest passage leading from underground toward the surface, as well as the approximate depth the axe is underground.


text:
---
layout: default
---

# 1994-02-10 - Re: Oh No! Nazis on the Nets

## Header Data

From: "Perry E. Metzger"<EMAIL_ADDRESS>To: Johan Helsingius<EMAIL_ADDRESS>Message Hash: 0441fb9a88f9feca04f76ce1bdc2e644c3cc83f5dd2127d74ac5d343498690cb

Message ID: \<199402101851.NAA20155@snark\>

Reply To<EMAIL_ADDRESS>UTC Datetime: 1994-02-10 19:00:24 UTC

Raw Date: Thu, 10 Feb 94 11:00:24 PST

## Raw message

```
{% raw  %}From: "Perry E. Metzger"<EMAIL_ADDRESS>Date: Thu, 10 Feb 94 11:00:24 PST
To: Johan Helsingius<EMAIL_ADDRESS>Subject: Re: Oh No! Nazis on the Nets
In-Reply-To<EMAIL_ADDRESS>Message-ID: <199402101851.NAA20155@snark>
MIME-Version: 1.0
Content-Type: text/plain

Johan Helsingius says:
>
> > > a country in which the government is so fascist to make it illegal for
> > > someone to tell you how to start your own paper?
> >
> > Do you really believe such a nonsense ????
>
> Of course. But did you know that in the USA it is illegal for a
> married couple to have anal intercourse even in their own home? Or
> that it is illegal to belong to a communist party? Or that you can
> get in trouble for using the word "stewardess".

You can be a member of the communist party, actually, although many
laws holding that you can be harrassed by the government for it are
still on the books. Sexual relations are governed by state law, so
only in some states are consentual acts illegal -- in many all
consentual acts between married partners are legal. However, the point
is well taken. The U.S. is not a libertarian paradise.

I will note, however, that the U.S. has far better press freedoms than
almost any other country on earth, and that Germany is pretty damn bad
about freedom of the press. I can walk into any book store in America
and buy a copy of Mein Kampf -- and although I hate Adolf Hitler's
works, I am happy that I can read them if I so choose. I cannot do
things like that in Germany.

.pm

{% endraw %}
```

## Thread

+ Return to [February 1994](/archive/1994/02)

+ Return to<EMAIL_ADDRESS>(Hadmut Danisch)](/authors/danisch_at_ira_uka_de_hadmut_danisch_)"
+ Return to "[Johan Helsingius <julf@penet.fi>](/authors/johan_helsingius_julf_at_penet_fi_)"
+ Return to<EMAIL_ADDRESS>(Mike McNally)](/authors/m5_at_vail_tivoli_com_mike_mcnally_)"
+ Return to "[Mike Godwin <mnemonic@eff.org>](/authors/mike_godwin_mnemonic_at_eff_org_)"
+ Return to "["Perry E. Metzger" <pmetzger@lehman.com>](/authors/perry_e_metzger_pmetzger_at_lehman_com_)"

+ 1994-02-10 (Thu, 10 Feb 94 09:32:54 PST) - [Re: Oh No! Nazis on the Nets](/archive/1994/02/c9cca55b7c6baac95bc75d638c9cf4aca010bce87eb38e8b39073f8343bc71b3) -<EMAIL_ADDRESS>(Hadmut Danisch)_
  + 1994-02-10 (Thu, 10 Feb 94 10:20:21 PST) - [Re: Oh No! Nazis on the Nets](/archive/1994/02/772b7eb5e9851d70a176fcb24585c7df6a32600599b2cb9c195799b8303d9bd3) -<EMAIL_ADDRESS>(Mike McNally)_
  + 1994-02-10 (Thu, 10 Feb 94 10:30:21 PST) - [Re: Oh No! Nazis on the Nets](/archive/1994/02/8d497c5bf6c05e8dd772892b775ea21eb32c1908ce018145c10f5aadc3d28c1b) - _Johan Helsingius<EMAIL_ADDRESS>    + 1994-02-10 (Thu, 10 Feb 94 11:00:24 PST) - Re: Oh No! Nazis on the Nets - _"Perry E. Metzger"<EMAIL_ADDRESS>    + 1994-02-10 (Thu, 10 Feb 94 11:40:22 PST) - [Re: Oh No! Nazis on the Nets](/archive/1994/02/b7665ed1acebac2b58cccff0ad84f4315e307fef745fb5d49d7637fbd3e2a7aa) - _Mike Godwin<EMAIL_ADDRESS>


text:
---
layout: post
title:  "Readings"
categories: Readings
tags:  Units
author: Allan
---

* content
{:toc}

Unless otherwise noted, the readings below are from the course textbook:

Buy at Amazon Winston, Patrick Henry. Artificial Intelligence. 3rd ed. Addison-Wesley, 1992. ISBN:<PHONE_NUMBER>774.

Additional resources, where relevant, are listed with the respective Lecture Videos under the "Related Resources" tab.

No.#|TOPICS |   READINGS
-|-|-
1|Course requirements, evaluation, organization |-
2|Welcome to Design Patterns:  an introduction  | download |-  |
3|the Strategy pattern  |  - |
4|the Observer Pattern   | - |
5|the Decorator Pattern   |  - |
6|the Factory Pattern   |  - |
7|the Singleton Pattern   | - |
8|Level-4 Project   | - |
9|the Command Pattern   | - |
10|the Adapter and Facade Patterns   | - |
11|the Template Method Pattern    |  - |
12|the State Pattern    | - |

repository: Allan-Peng/OOAD

repo_name: Allan-Peng/OOAD


text:
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v0.2.0 - 2020-06-17

- Catch nil return of `Process.whereis/1` in `process_check/1` macro

## v0.1.3 - 2018-05-05

- Update deps and author

## v0.1.2 - 2018-12-11

- Switch maintainer URLs

## v0.1.1 - 2018-10-27

- Add credo and documentation updates

## V0.1.0 - 2018-09-24

- Initial Release

gha_language: Elixir


text:
# Documentation

0. [Preface](https://github.com/timfayz/elementcss/blob/master/docs/1-preface.md)

1. [Installation](https://github.com/timfayz/elementcss/blob/master/docs/2-installation.md)

2. [Usage](https://github.com/timfayz/elementcss/blob/master/docs/3-usage.md)

## Preface
elementcss is free and open-source CSS framework written in Sass. It promotes clean, object-oriented design encouraging rapid prototyping. It helps you to create complex, scalable and elaborate GUI for the contemporary web applications as well as integrate to existing project. Thought-out structure and feature set make it possible even to recreate other popular frameworks or create your own favorite theme. elementcss is not just a framework, but a tool and suit of best practices from many professionals around the world to make GUI building maintainable, easier and faster.

The framework is based on [Sass](http://sass-lang.com/guide) preprocessor. If you use plain CSS you will love preprocessors; particularly Sass.

elementcss allows people to choose what they want to generate and what they don't. Currently framework allows you to outline your desirable GUI and prototype them via "atomic" classes.

## The Problem or Why I need this yet another framework!?
The key reason of elementcss was to create framework or principe of building styles that allows you don't think about **"aging"** and **"clogging"** styles. Something that allow you prototype GUI as fast as "What You See Is What You Get" editor if you have good CSS knowledge. It is means that "something" should be modular, abstract, flexible, strict and logical that will differentiate it from other frameworks and methods are existing (OOCSS, ACSS, BEM, SMACSS etc). As a result elementcss can be used not only for creating your own styles (eg using the same well-known methods OOCSS, ACSS, BEM), but even shareable themes with consistent API.

As a rule the most of existing frameworks have its own **"look and feel"** which makes it difficult to focus on truly **your** unique design. That is why elementcss doesn't have any predefined "look and feel" (styled forms, buttons etc). It is worth noting the framework is not easy to use at the first time, but the better you know elementcss and CSS itself, the better you understand the power of this instrument.

## The Solution or Why you like this tool!
To solve the problems described above we introduce new method: **one class** = **one CSS property** or **atomic class** (at the moment we can use several properties but with the same CSS value). At the firs time it sounds a little bit crazy, but time after time we tested it we realized that it works and it works really good! Thus far the rest of this documentation will explain how to use this method to create styles *in elementcss way*. elementcss already has well-designed built-in components (grid system, typography, vertical rhythm and normalize) and well-established practice (like clearfix, hidden text etc). However available components designed so they don't affect your "exterior design" and work insensibly. So you don't need to think about how to change here and there to modify default look. Components can be used as they are intended or as an good examples to create new ones.

 *elementcss way* means generate CSS selectors contain only one CSS value and as a rule one property (**atomic classes**). This method introduce new term **set**. **Set** is combined set of atomic classes under the same CSS property(ies). Set can be generated in the main flow as well as under some of @media rules or another CSS selectors. Section *Usage* shows a specific example how it looks like.

 To create **set** we use special mixin and notation; it gives ease of creating and using big amount of classes. This approach allows us not to get lost in your own atomic classes when we scale. When you learn more about this tool and CSS itself you can create GUI on the fly or in WYSIWYG way by applying many unified CSS classes to HTML tags without thinking how to organize abstraction level (like we do it in OOCSS method). As soon as you create sufficient amount of classes you could extend them into more generic classes (eg BEM) there is no restrictions. But let's not get ahead of ourselves.

## Features or What can I do with elementcss?
The framework has different structure, philosophy and thus different features:
* **Fast Prototyping**. Think and generate what you want in the beginning. Outline what you want to see and start to prototype your desired GUI.
* **Logical class names**. elementcss has big amount of predefined class names which makes set's class names enforced to general rules. It provides intuitive and easy remembering.
 Namespace variables allow you to remember them easily as well as add/remove/overwrite necessary features.
* **Best practices**. We merge best experience and ideas from the most popular frameworks and tools like normalize.css, bootstrap and foundation.
* **Well-designed**. Modular structure of each component make it possible to read source code and learn from the experience.
* **Normalize & Tags initiating**. elementcss make all HTML tags normalized and looking identical.
* **Vertical Rhythm**. elementcss provides vertical line-height synchronization. It is mean that all elements follow to invisible vertical grid.
* **Powerful Grid System (Flexbox included)**. Fully customized grid system which has some "defacto" standards like column offset, pushing, pulling, centering etc. However features (hence code amount) can be easily reduced. Grid system allow you set your own @media queries.
* **Mobile First**. elementcss way of working allow you manage and extend your CSS `@media` queries easily and strictly.

*The word "easily" suggests that you have solid knowledge of CSS, Sass and HTML.*

## What do I need to know before using?

Please, before using or reading the source code you need to learn HTML/HTML5, CSS/CSS3 and basics of Sass.
Otherwise you will experience difficulties in understanding principles of work and efficiency. If you know nothing about previously mentioned technologies go to [w3schools.com](http://w3schools.com) to gain some basic knowledge.

## What is CSS framework?

CSS frameworks are pre-prepared libraries that allow you prototype your CSS GUI easier, with enhanced cross-browser support using the Cascading Style Sheets language. ([wiki](http://en.wikipedia.org/wiki/CSS_frameworks))

## What is Sass?

**[Sass](http://sass-lang.com)** is CSS preprocessor that make it possible to inject into CSS some "*programming*" features/techniques like  **variables, functions, if/else statements** and so on. Preprocessor is program that simply compiles selected files with the extension ``.scss`` or ``.sass`` into ``.css``.

**Sass** has two variants of syntax: SCSS (CSS-like syntax, files ending with .scss) and Sass (syntactic sugar, files ending with .sass). We use SCSS, because its syntax is the same as CSS. For example:

```scss
/* styles.scss */
$black: #000;
$black-postfix: black;

.text-#{$black-postfix} {
  color: $black;
}
```
```Sass
/* styles.sass */
$black: #000
$black-postfix: black

.text-#{$black-postfix}
  color: $black
```
both will be compiled into
```CSS
/* styles.css */
.text-black {
  color: #000;
}
```
[More examples](http://sass-lang.com/guide)

## Why Sass and not LESS?

*Skip if you know nothing about LESS.*

Originally I was creating elementcss in LESS, but sometime later I realized that LESS doesn't have enough features to release necessary and pursued ideas. So I switched to Sass. Now there is no doubt after the release of version 3.3 - Sass become the most advanced CSS preprocessor!

## Go Next!
If you are already experienced user of Sass and CSS go right to [Usage](https://github.com/timfayz/elementcss/blob/master/docs/3-usage.md). If you are newbie, go to next section [Installation](https://github.com/timfayz/elementcss/blob/master/docs/2-installation.md) and prepare yourself for using Sass.

repository: timfayz/elementcss

gha_language: CSS

repo_name: timfayz/elementcss


text:
# Qubit Registers

## Qubit Registers and Ket Notation

At this point, you should feel pretty comfortable with qubits and single-qubit gates.
But, as you can imagine, quantum algorithms that perform useful calculations don't just manipulate single qubits.
In this section, we're going to talk about arrays of qubits - more formally called **qubit registers**.

Qubit registers aren't discrete physical blocks of qubits on a processor like classical registers in a CPU are.
The name "register" is just what we call abstract groups of arbitrary qubits.
Registers truly are just like arrays of qubits, defined in software.
Their physical mapping or layout on the actual hardware doesn't matter.

In quantum computing, qubit registers are written as kets with multiple terms inside of them.
You've already seen kets for single qubits, like so (shown with the Bloch Sphere for convenience):

$$
\textcolor{blue}{\ket{a} = \ket{0}}, \qquad
\textcolor{purple}{\ket{b} = \ket{1}}, \qquad
\textcolor{red}{\ket{c} = \frac{\sqrt{2}}{\sqrt{5}} \ket{0} + \frac{\sqrt{3}}{\sqrt{5}} \ket{1}}
$$

![](images/registers-1.png){: .center loading=lazy }

The first qubit has a 100% chance of being measured in the $\ket{0}$ state, the second one has a 100% chance of being measured in the $\ket{1}$ state, and the third one has a 40% chance of being measured as $\ket{0}$ and a 60% chance of being measured as $\ket{1}$.

This is an example of a ket that represents a register with 2 qubits in it:

$$
\ket{\psi} = \ket{00}
$$

In this ket, there are two zeros.
The first zero represents the state of the first qubit, which we'll call $\psi_0$ since we're computer scientists and everything is zero-indexed in our world.
The second zero represents the state of the second qubit, which we'll call $\psi_1$.
In this example, both qubits are in the $\ket{0}$ state, so both have a 100% chance of being measured as $\ket{0}$.
Both qubits get their own independent Bloch Spheres:

![](images/registers-2.png){: .center loading=lazy }

Here's a larger example, this time for a register with 5 qubits:

$$
\ket{\psi} = \ket{00101}
$$

In this example, the qubits $\psi_0$, $\psi_1$,and $\psi_3$ are all in the $\ket{0}$ state while $\psi_2$ and $\psi_4$ are in the $\ket{1}$ state.
This is the binary number 00101, which is 5 in decimal.
Qubit registers can be used to represent decimal numbers in binary the same way that classical bit arrays can.
As a few more examples, here are the ways of writing the numbers 0 through 3 with qubits:

$$
\displaylines{
\ket{\psi} = \ket{00} = 0
\\~\\
\ket{\psi} = \ket{01} = 1
\\~\\
\ket{\psi} = \ket{10} = 2
\\~\\
\ket{\psi} = \ket{11} = 3
}
$$

If you're familiar with binary numbers from classical software engineering, you'll feel right at home with this.

## Applying Single-Qubit Gates to Registers

When we have multiple qubits in a register, applying a single-qubit gate to one of them acts independently on that qubit, as you would expect it to.
For example, say we started with this state:

$$
\ket{\psi} = \ket{00}
$$

Both qubits are in the $\ket{0}$ state.
If we apply the X gate to the second qubit, it will flip from $\ket{0}$ to $\ket{1}$:

$$
X(\psi_1), \qquad \ket{\psi} = \ket{01}
$$

The two Bloch Spheres for this register will now look like this:

![](images/registers-3.png){: .center loading=lazy }

Note how this gate flipped the second qubit but left the first qubit alone.

This behavior is true for any single-qubit gate, and as shown, we can selectively apply single-qubit gates to any qubit in a register, just like we'd be able to apply classical operations on any bit in an array.

## Registers in Superpositions

We've seen how to write registers out when the qubits are in either of the computational basis states.
What if one of the qubits is in a superposition? Let's explore that with an example.
We'll start by creating a new register, called $\ket{\psi}$, with one qubit that starts in the $\ket{0}$ state.
Next, let's put it into the $\ket{+}$ state with the H gate:

$$
\begin{aligned}
\ket{\psi} &= \ket{0}
\\~\\
H(\psi_0), \qquad \ket{\psi} &= \ket{+}
\\~\\
&= \frac{1}{\sqrt{2}} \ket{0} + \frac{1}{\sqrt{2}} \ket{1}
\end{aligned}
$$

As a reminder, the H gate mirrors the qubit around the X=Z axis:

![](images/registers-4.png){: .center loading=lazy }

Now, let's add a second qubit to this register (which will be in the $\ket{0}$ state):

$$
\displaylines{
\ket{\psi_0} = \frac{1}{\sqrt{2}} \ket{0} + \frac{1}{\sqrt{2}} \ket{1}
\\~\\
\ket{\psi_1} = \ket{0}
}
$$

By themselves, they're easy to represent. The Bloch Spheres for these 2 qubits will look like this:

![](images/registers-5.png){: .center loading=lazy }

But how do we represent the register as a single ket?
For that, let's do a little bit of math.
Recall from [the vector math section](/background-math/vectors) that ket notation has the tensor product built into it, so the ket $\ket{ab}$ is really the same thing as $\ket{a} \otimes \ket{b}$.
So to combine our two qubits here together into one ket, we can just take their tensor product:

$$
\begin{aligned}
\ket{\psi} &= \ket{\psi_0 \psi_1}
\\~\\
&= \ket{\psi_0} \otimes \ket{\psi_1}
\\~\\
&= \left( \frac{1}{\sqrt{2}} \ket{0} + \frac{1}{\sqrt{2}} \ket{1} \right) \otimes \ket{0}
\end{aligned}
$$

At this point, it's useful to remember that the tensor product is linear, so it can be distributed to each of the terms in the parentheses:

$$
= \frac{1}{\sqrt{2}} \ket{0} \otimes \ket{0} + \frac{1}{\sqrt{2}} \ket{1} \otimes \ket{0}
$$

Now, we can turn the two tensor products back into single kets:

$$
= \frac{1}{\sqrt{2}} \ket{00} + \frac{1}{\sqrt{2}} \ket{10}
$$

This is the state of our register. So what does it mean?

Well, like with a single qubit, this state shows that there are two possible measurement outcomes: $\ket{00}$ or $\ket{10}$.
In the first case, both qubits are measured as $\ket{0}$.
In the second case, the first qubit is measured as $\ket{1}$ and the second qubit is measured as $\ket{0}$.
Both cases have a 50% chance of being measured.

Notice, however, that the second qubit is $\ket{0}$ in either case.
No matter which overall state you end up measuring, that second qubit will always be measured in the $\ket{0}$ state.
The first qubit, however, has a 50% chance of being $\ket{0}$ and a 50% chance of being $\ket{1}$.
This is exactly what we would expect, knowing that the first qubit is in the $\ket{+}$ state and the second qubit is in the $\ket{0}$ state.

In a nutshell, when a qubit register is in a superposition, the terms of the superposition represent the possible measurement outcomes for every qubit.
The amplitudes of each term tell you the probability of measuring that state.
This is exactly the same as for single qubit kets, but now each ket represents the measurement outcome of multiple qubits.

Let's do another example, this time with an uneven superposition.
We'll start with $\ket{00}$ and rotate the second qubit 45° around the X-Z plane:

![](images/registers-6.png){: .center loading=lazy }

Doing the math out for this second qubit, we get its rather ugly ket form:

$$
\begin{aligned}
\ket{\psi_1} &= \cos \left( \frac{45°}{2} \right) \ket{0} + \sin \left( \frac{45°}{2} \right) \ket{1}
\\~\\
&= \frac{\sqrt{2 + \sqrt{2}}}{2} \ket{0} + \frac{\sqrt{2 - \sqrt{2}}}{2} \ket{1}
\\~\\
&\approx 0.924 \cdot \ket{0} + 0.383 \cdot \ket{1}
\end{aligned}
$$

This qubit will have an 85.4% chance of being measured as $\ket{0}$, and a 14.6% chance of being measured as $\ket{1}$.
Now, if we follow the same tensoring process as the previous example, we get the overall state for the two-qubit register:

$$
\begin{aligned}
\ket{\psi} &= \ket{0} \otimes \left( \frac{\sqrt{2 + \sqrt{2}}}{2} \ket{0} + \frac{\sqrt{2 - \sqrt{2}}}{2} \ket{1} \right)
\\~\\
&= \frac{\sqrt{2 + \sqrt{2}}}{2} \ket{00} + \frac{\sqrt{2 - \sqrt{2}}}{2} \ket{01}
\end{aligned}
$$

In this register, there are two possible measurement outcomes: $\ket{00}$ and $\ket{01}$.
The first has an 85.4% chance of occurring, and will have both qubits in the $\ket{0}$ state.
The second has a 14.6% chance of occurring, and will have the first qubit in the $\ket{0}$ state but the second qubit in the $\ket{0}$ state.
Just like you would expect from the individual qubit states, the first qubit will be $\ket{0}$ no matter what, and the second qubit could be $\ket{0}$ or $\ket{1}$.

## The Tyranny of the State Vector

So far, we've just looked at registers with 2 qubits.
We kind of ignored the overall state vector of the register because it's not that important.
To explain why, let's try looking at the state vector for a register with 3 qubits.
To keep it simple, let's just look at the $\ket{000}$ state:

$$
\begin{aligned}
\ket{000} &= \begin{bmatrix} 1 \\ 0 \end{bmatrix} \otimes \begin{bmatrix} 1 \\ 0 \end{bmatrix} \otimes \begin{bmatrix} 1 \\ 0 \end{bmatrix}
\\~\\
&= \begin{bmatrix} 1 \\ 0 \end{bmatrix} \otimes \begin{bmatrix} 1 \cdot \begin{bmatrix} 1 \\ 0 \end{bmatrix} \\ 0 \cdot \begin{bmatrix} 1 \\ 0 \end{bmatrix} \end{bmatrix}
\\~\\
&= \begin{bmatrix} 1 \\ 0 \end{bmatrix} \otimes \begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix}
\\~\\
&= \begin{bmatrix} 1 \cdot \begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix} \\ 0 \cdot \begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix} \end{bmatrix}
\\~\\
&= \begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \end{bmatrix}
\end{aligned}
$$

As you can see, the register's state vector has 8 terms in it.
In fact, for $n$ qubits, the statevector will have $2^n$ terms.
If you use a conventional 64-bit double to represent the amplitude of a qubit, this means it would take $64 \cdot 2^n = 2^{n+6}$ bits of classical memory to represent $n$ qubits, or $2^{n+3}$ bytes.
If you include a double for the the imaginary component of each qubit's amplitude, this doubles to $2^{n+4}$ bytes.
To put that into perspective, capturing the state vector of a 32-qubit register would take 64 GB of conventional RAM.

This exponential growth is why we don't really look at state vectors in quantum computing, and just represent registers with ket notation.
This is also why quantum computers are hard to simulate with classical computers, and it hints as to why they're so powerful.
We'll explore that topic more later in the class.
For now, all you need to know is that each qubit you add to a register doubles the size of its state vector.
We could easily write a large register's state like this:

$$
\ket{11001100110011001100}
$$

This shows a 20-qubit register that happens to represent the number 838,860 in binary.
We know exactly what state each of the 20 qubits is in just by looking at the ket.
The state vector for this register is $2^{20} = 1,048,576$ terms long though, and it would just be silly to try and write that out.

## 4-Qubit Register Example

So far, we've spent a lot of time looking at registers with just 2 qubits.
Let's do some examples with, say, 4 qubits to further demonstrate ket notation and how single-qubit gates affect registers.
In this first example, we want to build the state $\ket{1010}$.

As usual, let's start by putting everything into the $\ket{0}$ state:

$$
\ket{\psi} = \ket{0000}
$$

For each of these examples, I'll include the Bloch Sphere for all 4 qubits.
Here are the Bloch Spheres for this starting state:

![](images/registers-7.png){: .center loading=lazy }

To get to $\ket{1010}$, we can easily do it by applying the X gate to the first and third qubits:

$$
X(\psi_0), \qquad \ket{\psi} = \ket{1000}
$$

![](images/registers-8.png){: .center loading=lazy }

$$
X(\psi_2), \qquad \ket{\psi} = \ket{1010}
$$

![](images/registers-9.png){: .center loading=lazy }

And with that, we have our $\ket{1010}$ state.

## 4-Qubit Register Example: X, Z, and H Gates

In this example, we're going to have some fun with the X, Z, and H gates.

First things first - let's start with a blank slate again:

$$
\ket{\psi} = \ket{0000}
$$

![](images/registers-10.png){: .center loading=lazy }

Now, let's apply H to the second qubit to see what it does to the register's ket:

$$
H(\psi_2), \qquad \ket{\psi} = \frac{1}{\sqrt{2}} \ket{0000} + \frac{1}{\sqrt{2}} \ket{0010}
$$

![](images/registers-11.png){: .center loading=lazy }

Like we saw with 2-qubit registers, the H gate on one qubit put the register into a superposition.
Now there are two possible measurement outcomes: $\ket{0000}$ and $\ket{0010}$, both of which have a 50% chance of being measured.

Next, let's apply the X gate to the first qubit:

$$
X(\psi_0), \qquad \ket{\psi} = \frac{1}{\sqrt{2}} \ket{1000} + \frac{1}{\sqrt{2}} \ket{1010}
$$

![](images/registers-12.png){: .center loading=lazy }

Note what happened here, because this is important: applying the X gate to the first qubit flipped the first qubit in both terms of the register's state.
This is a general rule about how quantum gates work: **applying a quantum gate to a register will apply it to every term in the register's superposition, independently**.
With this in mind, an easy way to figure out what the X gate does to this register is by **distributing** the gate to each of the terms:

$$
\begin{aligned}
\ket{\psi} &= \frac{1}{\sqrt{2}} \ket{0000} + \frac{1}{\sqrt{2}} \ket{0010}
\\~\\
X(\psi_0), \qquad \ket{\psi} &= \frac{1}{\sqrt{2}} \left( X_0(\ket{0000}) \right) + \frac{1}{\sqrt{2}} \left( X_0(\ket{0010}) \right)
\\~\\
&= \frac{1}{\sqrt{2}} \ket{1000} + \frac{1}{\sqrt{2}} \ket{1010}
\end{aligned}
$$

This is an easy way to figure out what the result of applying a gate to a register will be: just apply it to every term in the superposition separately, and then couple all of the results together.

Let's see what happens if we apply the Z gate to the first qubit:

$$
Z(\psi_0), \qquad \ket{\psi} = -\frac{1}{\sqrt{2}} \ket{1000} - \frac{1}{\sqrt{2}} \ket{1010}
$$

![](images/registers-13.png){: .center loading=lazy }

This is another good lesson to pay attention to: since the Z gate will negate the $\ket{1}$ state, **any state in the register's superposition where that Z'd qubit is $\ket{1}$ will be negated**.
In this case, since we're applying Z to the first qubit and the first qubit is $\ket{1}$ in both states of the register's superposition, both get negated.

But wait a minute, the first qubit is in the $\ket{1}$ state which is on the Z axis, and the Z gate mirrors things around the Z axis.
Shouldn't this end up having no effect?
In fact, that is exactly what happens because of the fact that **global phase can be ignored**:

$$
\begin{aligned}
\ket{\psi} &= -\frac{1}{\sqrt{2}} \ket{1000} - \frac{1}{\sqrt{2}} \ket{1010}
\\~\\
&= -1 \cdot \left( \frac{1}{\sqrt{2}} \ket{1000} + \frac{1}{\sqrt{2}} \ket{1010} \right)
\\~\\
&= \frac{1}{\sqrt{2}} \ket{1000} + \frac{1}{\sqrt{2}} \ket{1010}
\end{aligned}
$$

Thus, the Bloch Sphere correctly shows that there is no difference between these two states because global phase is irrelevant.

Now, let's try applying Z to the third qubit.
As a reminder, this will negate any state in the register's superposition where the third qubit is $\ket{1}$, so in this case, only the second term ($\ket{1010}$):

$$
Z(\psi_2), \qquad \ket{\psi} = \frac{1}{\sqrt{2}} \ket{1000} - \frac{1}{\sqrt{2}} \ket{1010}
$$

![](images/registers-14.png){: .center loading=lazy }

As the Bloch Sphere shows, this is different from the previous state because the third qubit is in a different position than it used to be.
If we apply the Z gate to the third qubit again, it will flip back over to the right half of the Bloch Sphere, and the ket term will become positive again:

$$
Z(\psi_2), \qquad \ket{\psi} = \frac{1}{\sqrt{2}} \ket{1000} + \frac{1}{\sqrt{2}} \ket{1010}
$$

![](images/registers-15.png){: .center loading=lazy }

Okay, that's easy enough for single-qubit gates.
In the next section, we're going to look at gates that take multiple qubits as parameters.

repository: Sarthak-Dayal/quantum-course-docs

branch_name: refs/heads/main

gha_license_id: NOASSERTION

repo_name: Sarthak-Dayal/quantum-course-docs


text:
# responsive-portfolio

## Description

The purpose of this project was to create a responsive portfolio website from scratch using the powerful framework of bootstrap in combination with HTML and CSS. The final product incorporates a responsive layout that effortlessly transitions from a large computer screen to the smaller viewing area of tablets and mobile devices.

## Built With

* HTML
* CSS
* Bootstrap

## Website

View the website [here](https://bhayes11.github.io/responsive-portfolio/)

Full website display ![Full Size Website](/assets/images/about.png)

Medium website display ![Full Size Website](/assets/images/about768.png)

Small website display ![Full Size Website](/assets/images/about400.png)

## License

[MIT](https://choosealicense.com/licenses/mit/#) License


text:
cakephp-timezone
======

CakePHP model behavior for automating timezone functionality. Also supports virtual date fields which can be formatted using PHP date formatting conventions. Support requests and bugs will most likely not be responded to at this stage.

Dependencies
------
This behavior assumes you are using the CakePHP Auth component to manage user authorisation. It also assumes you have a field called 'timezone' in your users table which contains a timezone in the PHP format eg. Australia/Brisbane. Without this, the behaviour will fail to work correctly, this may be revised in the future but suits my needs for now.

Installation
------
Place the TimeZoneBehavior.php file in your CakePHP model behaviors folder aka. /app/Model/Behavior/

Demo
------
The code needed to activate this behavior needs to be included in the model that you want to automatically convert between timezones. Alternatively, you can place it in the AppModel to affect every model in your Model directory.

For minimal usage, you only need to include the fields section with a list of fields to include
```php
	public $actsAs = array(
		"TimeZone" => array(
			"fields" => array(
				"created",
				"modified"
			)
		)
	);
```

The full API including optional fields and virtual fields is used as below
```php
	public $actsAs = array(
		"TimeZone" => array(
			"fields" => array(
				"created",
				"modified",
				"start" => array(
					"optional" => true
				)
			),
			"virtualFields" => array(
				"start_iso" => array(
					"format" => "c",
					"source" => "start"
				)
			)
		)
	);
```

Licensing
------
Code is licensed under the MIT License.

Developer
------
Jayden Meyer http://jaydenm.com/

repository: drjaydenm/cakephp-timezone

repo_name: drjaydenm/cakephp-timezone


text:
Ansible config
==============

This is a set of Ansible files to set up a working PHP development environment
on a Ubuntu 12.04 machine (apache, mysql, php).

Ansible is an IT automation tool. It can configure systems, deploy software, and
orchestrate more advanced IT tasks such as continuous deployments or zero
downtime rolling updates.

Docs - http://www.ansibleworks.com/docs/

## Pre-requisite

To setup ansible, execute as root (or with sudo) `setup_ansible.sh`

make sure the `hosts` file is not executable to avoid a cryptic Ansible
error message

## Usage

    ansible-playbook -i hosts lamp.yml

## Info

Adminer, the database management tool, will be installed at http://localhost/adminer.php. see http://adminer.org

MySQL user is root and password is blank. This is not a production server, just a dev server to be accessed by the host machine.

If not using vagrant, the username/password combo to access the vm are: `vagrant/vagrant`

##  License

This code is open-sourced software licensed under the
[MIT license](http://opensource.org/licenses/MIT)

repository: YotpoLtd/vagrant-cscart

gha_language: PHP

repo_name: YotpoLtd/vagrant-cscart


text:
# JODConverter  LibreOffice / Apache OpenOffice

[![Build status](https://ci.appveyor.com/api/projects/status/mvn8oqr2m8xorslk?svg=true)](https://ci.appveyor.com/project/sbraconnier/jodconverter)
[![Build Status](https://travis-ci.org/sbraconnier/jodconverter.svg?branch=master)](https://travis-ci.org/sbraconnier/jodconverter)
[![Coverage Status](https://coveralls.io/repos/github/sbraconnier/jodconverter/badge.svg?branch=master)](https://coveralls.io/github/sbraconnier/jodconverter?branch=master)
[![Dependency Status](https://www.versioneye.com/user/projects/596d252e6725bd000e2d8b3b/badge.svg?style=flat)](https://www.versioneye.com/user/projects/596d252e6725bd000e2d8b3b)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.jodconverter/jodconverter-core/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.jodconverter/jodconverter-core)
[![Javadocs](http://javadoc.io/badge/org.jodconverter/jodconverter-core.svg)](http://javadoc.io/doc/org.jodconverter/jodconverter-core)

I created this fork because I had to do some changes to the original project and now it is time to share my work with the community.

## What you want to know...

- **Documentation**: The JODConverter documentation (work in progress) can be found [here](doc/README.md).
- **SIGAR**: This fork does not depend on SIGAR. JODConverter only needs to retrieve office processes (PIDs) and kill office processes (using PID). It should work just fine without SIGAR with the actual process managers base on an older version of JODConverter. But I added the ability to use any process manager you would like to implement. More details on this feature later. For now, just look at the DefaultOfficeManagerBuilder class documentation.
- **Dependencies**: See [this](https://maven-badges.herokuapp.com/maven-central/org.jodconverter/jodconverter-core) for core project dependencies.
- **Tests**: JODConverter is supposed to work just fine on Windows, MacOS and Unix/Linux. Any confirmation would be welcome so we could build a list of official supported OS distributions.

## Usage

### Using Gradle:
```Shell
compile 'org.jodconverter:jodconverter-core:4.0.0-RELEASE'
```

### Using Maven:
```Shell
<dependency>
  <groupId>org.jodconverter</groupId>
  <artifactId>jodconverter-core</artifactId>
  <version>4.0.0-RELEASE</version>
</dependency>
```

## Building the Project

### Using LibreOffice libraries:
```Shell
gradlew clean build -x test -x integTest
```

### Using OpenOffice libraries:
```Shell
gradlew clean build -x test -x integTest -PuseOpenOffice
```

## Building Cli Executable

```Shell
gradlew clean build -x test -x integTest distZip
```

## Thanks To...

I cannot say exactly where you could find some similitude between my source code and the one of these forks/projects but here are my favorite/inspiration forks/projects:

- [XWiki fork](https://github.com/xwiki/jodconverter): Nice choice if you can afford using the SIGAR tools (which I couldn't sadly).
- [Nuxeo fork](https://github.com/nuxeo/jodconverter): Nice choice if you don't want to use SIGAR and don't came across an unresponsive office process following a timeout exception that drives you crazy.
- [documents4j project](https://github.com/documents4j/documents4j): Nice choice if you want 100% perfect conversion using MS Office. But work only on Windows out of the box (Local implementation) and not totally free (since MS Office is not free).

### A special thanks to:

[@michelole](https://github.com/michelole) who created a pull request in these two forks with a stress test that made my office process to crash every times! I don't know him but my first commit was when I was able to build my things with his stress test on!!

## Original JODConverter

JODConverter (Java OpenDocument Converter) automates document conversions using LibreOffice or OpenOffice.org.

The previous home for this project is at [Google Code](http://code.google.com/p/jodconverter/),
including some [wiki pages](https://code.google.com/archive/p/jodconverter/wikis).

repository: acaloiaro/jodconverter

repo_name: acaloiaro/jodconverter


text:
Genotet
=======

Genotet: An Interactive Web-based Visual Exploration Framework to Support Validation of Gene Regulatory Networks

Installation:

- Install node.js on your machine.
- Put the genotet folder to your server web directory, or your localhost web directory (e.g. xampp).
- Install required packages in the server folder:

cd server
  npm install express
  npm install body-parser

- Modify server/server.js to locate the data at correct directories.
- Run the server code
-
node server/server.js

repository: flyingmeat/genotet

repo_name: flyingmeat/genotet