text:
# Execution-Time Performance of Deep Learning Networks on CPU, GPU and TPU Runtime Environments

:o2: avoid using images, instaed use tables from markdown. Performabnce tables can be copied as is.

## Summary

A performance review of execution times on Google Colab, for five deep learning network examples, was conducted on CPU, GPU and TPU runtime environments using the MNIST dataset.  The networks were 1) a multi-layer perceptron (MLP) network, 2) a convolutional neural network (CNN), 3) a recurrent neural network (RNN), 4) a long short-term memory network (LSTM), and 5) an autoencoder.

## General findings

Training times (Table 1) for all five network exemplars were significantly better on the GPU runtime environment than on Google Colab’s CPU environment. Of the networks, the CNN had the greatest performance improvement on GPUs than CPUs only, with a speedup of over 33 times (3332%). This was followed by the LSTM, which had a speedup of over 22 times (2257%), while speed ups for the autoencoder, MLP and RNN were 1464%, 697% and 229% respectively.

Execution time performance for model testing was also significantly better on GPUs than CPUs, for the exemplars. Speedups for the LSTM, CNN, RNN, autoencoder and MLP where 1113%, 915%, 601%, 326%, and 177% respectively.

The TPU runtime environment performed worse than the CPU environment, on training times for the autoencoder, RNN and CNN. Performance time declines were most significant for the autoencoder (-10%). TPU training times were nevertheless significantly better for the LSTM (+9%), and marginally better for the MLP (+1%), than on CPU runtime. All model exemplars performed worse on model evaluation times, on TPUs than on CPUs.

## Discussion

To leverage advantages of using TPUs, optimizations could have been applied to the code used for the performance evaluations [^1]. Nevertheless, no customizations were made to the code used, for a head-to-head comparison in the environments. The network code examples were simply run under the three runtime environment options by changing the relevant Colab notebook settings.

## Appendix:

**Table 1:** Summary of CPU, GPU, TPU Performance
![Table 1](https://github.com/cybertraining-dsc/sp21-599-359/raw/develop/Assignments/images/runtime_performance.jpg)

### Multi-Layer Perceptron (MLP) Example using MNIST Dataset

**Table 2:** MLP using CPUs only
![Table 2](https://github.com/cybertraining-dsc/sp21-599-359/raw/develop/Assignments/images/mlp_cpu.jpg)

**Table 3:** MLP using GPUs
![Table 3](https://github.com/cybertraining-dsc/sp21-599-359/raw/develop/Assignments/images/mlp_gpu.jpg)

**Table 4:** MLP using TPUs
![Table 4](https://github.com/cybertraining-dsc/sp21-599-359/raw/develop/Assignments/images/mlp_tpu.jpg)

### Convolutional Neural Networks (CNN) Example using MNIST Dataset

**Table 5:** CNN using CPUs only
![Table 5](https://github.com/cybertraining-dsc/sp21-599-359/raw/develop/Assignments/images/cnn_cpu.jpg)

**Table 6:** CNN using GPUs
![Table 6](https://github.com/cybertraining-dsc/sp21-599-359/raw/develop/Assignments/images/cnn_gpu.jpg)

**Table 7:** CNN using TPUs
![Table 7](https://github.com/cybertraining-dsc/sp21-599-359/raw/develop/Assignments/images/cnn_tpu.jpg)

### Recurrent Neural Networks (RNN) Example using MNIST Dataset

**Table 8:** RNN using CPUs only
![Table 8](https://github.com/cybertraining-dsc/sp21-599-359/raw/develop/Assignments/images/rnn_cpu.jpg)

**Table 9:** RNN using GPUs
![Table 9](https://github.com/cybertraining-dsc/sp21-599-359/raw/develop/Assignments/images/rnn_gpu.jpg)

**Table 10:** RNN using TPUs
![Table 10](https://github.com/cybertraining-dsc/sp21-599-359/raw/develop/Assignments/images/rnn_tpu.jpg)

### Long Short-Term Memory (LSTM) Example using MNIST Dataset

**Table 11:** LSTM using CPUs only
![Table 11](https://github.com/cybertraining-dsc/sp21-599-359/raw/develop/Assignments/images/lstm_cpu.jpg)

**Table 12:** LSTM using GPUs
![Table 12](https://github.com/cybertraining-dsc/sp21-599-359/raw/develop/Assignments/images/lstm_gpu.jpg)

**Table 13:** LSTM using TPUs
![Table 13](https://github.com/cybertraining-dsc/sp21-599-359/raw/develop/Assignments/images/lstm_tpu.jpg)

### Autoencoder Example using MNIST Dataset

**Table 14:** Autoencoder using CPUs only
![Table 14](https://github.com/cybertraining-dsc/sp21-599-359/raw/develop/Assignments/images/autoencoder_cpu.jpg)

**Table 15: Autoencoder using GPUs**
![Table 15](https://github.com/cybertraining-dsc/sp21-599-359/raw/develop/Assignments/images/autoencoder_gpu.jpg)

**Table 16:** Autoencoder using TPUs
![Table 16](https://github.com/cybertraining-dsc/sp21-599-359/raw/develop/Assignments/images/autoencoder_tpu.jpg)

## References

[^1]. Google. (2021, 03 26). TPUs in Colab. Retrieved from [https://colab.research.google.com/:] (https://colab.research.google.com/notebooks/tpu.ipynb#scrollTo=kvPXiovhi3ZZ)

gha_language: Jupyter Notebook


text:
---
title: "rebootDefault"
description: "Attempts to reboot the server by issuing a reset (soft reboot) command to the server's remote management card. If the reset (soft reboot) attempt is unsuccessful, a power cycle command will be issued via the powerstrip. The power cycle command is equivalent to unplugging the server from the powerstrip and then plugging the server back into the powerstrip.  If a reboot command has been issued successfully in the past 20 minutes, another remote management command (rebootSoft, rebootHard, powerOn, powerOff and powerCycle) will not be allowed.  This is to avoid any type of server failures. "
date: "2018-02-12"
tags:
    - "method"
    - "sldn"
    - "Hardware"
classes:
    - "SoftLayer_Hardware_SecurityModule750"
type: "reference"
layout: "method"
mainService : "SoftLayer_Hardware_SecurityModule750"
---

branch_name: refs/heads/master

extension: md

gha_language: HTML

gha_license_id: NOASSERTION

license_type: permissive


text:
# wildmatch

package `wildmatch` is a reimplementation of Git's `wildmatch.c`-style filepath pattern matching.

For more information, see the [godoc][1].

[1]: https://godoc.org/github.com/git-lfs/wildmatch

license: MIT

gha_license_id: MIT


text:
# netmeter
*netmeter* is a trio of analog panel meters showing the up-/download speed of my AVM FRITZ!Box 7360 and ping roundtrip times.

![netmeter](https://raw.githubusercontent.com/kiu/netmeter/master/pics/netmeter_banner.jpg)

Video: https://youtu.be/6VHqjQCAy3I

# Inspiration
*netmeter* is inspired by the 10 year old [megabitmeter](http://dk7sl.de/2010/11/11/megabitmeter/) and its - now defunct - commercial version [megabitmeter](http://megabitmeter.de).

# Tech Details
The [ESP32-DevKitC V4](https://www.espressif.com/en/products/devkits/esp32-devkitc) offers a powerful plug and play solution providing the core functionality of *netmeter*.
It connects to the network via wifi and polls the [UPnP](https://en.wikipedia.org/wiki/Universal_Plug_and_Play) interface of the FRITZ!Box obtaining the current transmitted and received bytes count of the WAN interface. In addition it runs a simple ping command to determine the roundtrip time. The results are transformed into PWM signals driving the meters.

The mechanical design features horizontal and vertical mounting of the panel meters. The included custom scales can be omitted to save costs. In that case a standard scale - e.g. 100A = 100 MBit/s - can be used.

repository: kiu/netmeter

repo_name: kiu/netmeter


text:
---
layout: post
title: "Guided Image Inpainting: Replacing an Image Region by Pulling Content from Another Image"
date: 2018-03-22 16:20:45
categories: arXiv_CV
tags: arXiv_CV
author: Yinan Zhao, Brian Price, Scott Cohen, Danna Gurari
mathjax: true
---

* content
{:toc}

##### Abstract
Deep generative models have shown success in automatically synthesizing missing image regions using surrounding context. However, users cannot directly decide what content to synthesize with such approaches. We propose an end-to-end network for image inpainting that uses a different image to guide the synthesis of new content to fill the hole. A key challenge addressed by our approach is synthesizing new content in regions where the guidance image and the context of the original image are inconsistent. We conduct four studies that demonstrate our results yield more realistic image inpainting results over seven baselines.

##### Abstract (translated by Google)
深度生成模型已经在使用周围环境自动合成缺失图像区域方面取得了成功。但是，用户不能直接决定用这种方法综合哪些内容。我们提出了一个图像修复的端到端网络，该网络使用不同的图像来指导新内容的合成以填补空白。我们的方法解决的关键挑战是在指导图像和原始图像的上下文不一致的地区合成新内容。我们进行了四项研究，证明我们的结果在七条基线上产生更真实的图像修复结果。

##### URL
[https://arxiv.org/abs/1803.08435](https://arxiv.org/abs/1803.08435)

##### PDF
[https://arxiv.org/pdf/1803.08435](https://arxiv.org/pdf/1803.08435)


text:
# homebrew shell scripts

Tap for my [shell-scripts](https://github.com/rileytwo/shell-scripts) repo

## How do I install these formulae?
`brew install rileytwo/shell-scripts/<formula>`

Or `brew tap rileytwo/shell-scripts` and then `brew install <formula>`.

Or install via URL (which will not receive updates):

```
brew install https://raw.githubusercontent.com/rileytwo/homebrew-shell-scripts/master/Formula/<formula>.rb
```

## Documentation
`brew help`, `man brew` or check [Homebrew's documentation](https://docs.brew.sh).

repository: rileytwo/homebrew-shell-scripts

branch_name: refs/heads/main

repo_name: rileytwo/homebrew-shell-scripts


text:
PolyPoint
=========

PolyPoint is a system for using ultra-wideband RF time-of-flight ranging to perform indoor localization.
It incorporates the DecaWave DW1000 for UWB packet transmission and timestamping
into a solder-on module that provides node-to-node ranges over an I2C interface.

Name
----

The name PolyPoint comes from the use of many polygons and shapes in the prototype design and the
desire to pinpoint where users are with the system.

Git Clone
---------

When cloning this repository, be absolutely sure to do

    git clone --recursive https://github.com/lab11/polypoint.git

so that you get the submodules as well. All of the supporting
libraries and build tools are in submodules for the various
hardware platforms used in this project.

Hardware
--------

The PolyPoint system is composed of several hardware pieces. At the core is the
TriPoint module which is a 1.25" on a side triangle that encompasses all of the
core ranging hardware and software. TriPoint has castellated edges and can be
soldered on to a carrier board, effectively as a ranging IC. TriTag is one such
carrier board designed to be the tag in the ranging system. It includes the
UWB antennas and a Bluetooth Low Energy radio plus a battery charging circuit.
TriTag is able to provide ranges to a mobile phone application.

### TriPoint

TriPoint includes the following components:

- DecaWave DW1000 UWB radio
- STM32F031G6U6 MCU
- RF switch

The MCU contains all the necessary code to run the DW1000 and the ranging
protocol.

### TriTag

TriTag includes:

- The TriPoint module
- 3 UWB antennas
- nRF51822 BLE radio
- 3.3 V LDO
- Li-ion battery charger

TriTag is designed to be the tag to be localized in the system and connected
to a smartphone.

### TriDev

TriDev is a breakout and testing board for the TriPoint module.
It contains the same BLE hardware as TriTag, but also adds an FTDI
chip for issuing I2C commands over USB.

Software
--------

PolyPoint contains many software layers that run at various levels of
the system.

#### TriPoint

The core firmware that makes the drop-in TriPoint module work
includes all of the logic to implement two way ToF ranging
on top of the DecaWave DW1000 UWB radio. The firmware architecture
supports multiple "applications", or ranging algorithms, that can
be selected at runtime.

#### TriTag

The TriTag code implements a BLE application
that uses the TriPoint module as an I2C device and prov
a BLE service. It puts the TriTag hardware into TAG mode
and provides ranges over a BLE characteristic.

#### Phone and BLE

The tools in the `/phone` directory interact with TriTag and read data
across the BLE interface.

----

## Academic Publications

The PolyPoint project has led to two academic publications, and an invited talk at HotWireless'16.
If you are interested in the theory behind the ranging protocol, please check out our publications:

 - **[SurePoint: Exploiting Ultra Wideband Flooding and Diversity to Provide Robust, Scalable, High-Fidelity Indoor Localization.](http://lab11.eecs.berkeley.edu/content/pubs/kempke16surepoint.pdf)** Benjamin Kempke, Pat Pannuto, Bradford Campbell, and Prabal Dutta. Proceedings of the 14th ACM Conference on Embedded Networked Sensor Systems (SenSys’16).
 - **[PolyPoint: Guiding Indoor Quadrotors with Ultra-Wideband Localization.](http://lab11.eecs.berkeley.edu/content/pubs/kempke15polypoint.pdf)** Benjamin Kempke, Pat Pannuto, and Prabal Dutta. 2015 ACM Workshop on Hot Topics in Wireless (HotWireless’15).

If you use PolyPoint or its derivatives, please use the following citation:

```bibtex
@inproceedings{kempke16surepoint,
	title = {{SurePoint}: Exploiting Ultra Wideband Flooding and Diversity to Provide Robust, Scalable, High-Fidelity Indoor Localization},
	booktitle = {Proceedings of the 14th ACM Conference on Embedded Networked Sensor Systems},
	series = {SenSys'16},
	year = {2016},
	month = {11},
	location = {Stanford, CA, USA},
	conference-url = {http://sensys.acm.org/2016/},
	author = {Kempke, Benjamin and Pannuto, Pat and Campbell, Bradford and Dutta, Prabal},
}
```

repository: resettingmq/polypoint

repo_name: resettingmq/polypoint


text:
---
layout: page
title: Area Chair Symposium
description: Area chair symposium time and details.
invisible: true
---

The RSS Area Chair Symposium will be held at Carnegie Mellon University in
Pittsburgh, Pennsylvania, USA on April 6, 2017.

## Program

        9:00 - 9:20 AM

          Welcome and Overview

          Sidd Srinivasa

        9:20 - 10:40 AM

          New Sensors and Actuators

          Chris Atkeson, Whole-Body Vision

          Robert Howe, Achieving selective kinematics and stiffness in flexible robotics

          Ralph Hollis, An Omnidirectional Mobile Robot with Just Two Moving Parts

          Matei Ciocarlie, Senses and sensing ability for dexterous hands

        10:40 - 11:00 AM

          Coffee Break

        11:00 - 12:20 PM

          Tasks and Autonomy

          Todd Murphey, From Coverage to Robot Art: Specifying Statistically-Defined Tasks

          Nathan Michael, Efficient and Robust Autonomous Inspection in Cluttered and Confined Industrial Environments

          Justus Piater, Visual Task Outcome Verification Using Deep Learning

          Matt Walter, Learning to Follow (and Give) Natural Language Instructions in Unknown Environments

        12:20 - 1:40 PM

          Lunch

        1:40 - 2:40 PM

          Assisting Humans

          Steve Collins, Human-in-the-loop optimization of exoskeleton control

          Guy Hoffman, A Wearable Robotic Forearm

          Henny Admoni, Assistive Robotics Using Natural Human Behavior

        2:40 - 3:00 PM

          Coffee Break

        3:00 - 5:00 PM

          Discussion / Meetings / Free time / Run with Sidd


text:
# Note Taker

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Table of Contents

1. [Description](##description)
2. [Installation Instructions](##installation-instructions)
3. [Usage Information](##usage-information)
4. [Contribution Guidelines](##contribution-guidelines)
5. [Test Instructions](##test-instructions)
6. [Questions](##questions)
7. [License](##license)
8. [Screenshot](##screenshot)

## Description
The goal of this project was to add backend functionality to a webpage using Express.js to allow the retrieving, saving, and deleting of items in a JSON object. The app itself allows the user to create notes, view notes, and delete notes.

## Installation Instructions
A link to the deployed application can be found below and no installation is required. If you would like to run the program locally you will need to use npm to install the packages listed in the package.json before running "nodemon index.js" in your terminal.

## Usage Information
From the home page click the "Get Started" button, you can enter a Note Title and Note Text and click on the save icon at the top right of the window to save the note. You can click on the list of notes on the left side of the screen to display their details, or click on the red trash can to delete them.

## Contribution Guidelines
The project is not currently accepting any community contributions.

## Test Instructions
No test suite is currently included with the application. If you find a bug please send a detailed description to the developer, their information can be found in the Questions section.

## Questions
If you have further questions about the functionality of this application or need clarification regarding certain areas the creator can be contacted at:

Email<EMAIL_ADDRESS>

Github: https://github.com/trev-eck/

## License
This application was developed under the MIT License

## Screenshot
A live version of the application is deployed at: https://te-note-taker.herokuapp.com/

![Screenshot of the deployed application](.\public\assets\images\screenshot.png)

This readme was generated using the ReadME Generator : https://github.com/trev-eck/readme-generator

repository: trev-eck/note-taker

repo_name: trev-eck/note-taker


text:
---
title: "Course notes: Infectious Disease Modelling (Imperial College London via Coursera)"
date: 2023-04-11
permalink: /posts/2023-04-11/idm-notes
categories:
  - Course notes
tags:
  - Infectious Disease Modelling
toc: true
last_modified_at: 2023-04-14
---

This post records the notes when I learnt the [Infectious Disease Modelling (IDM)](https://www.coursera.org/specializations/infectious-disease-modelling#courses) by Nimalan Arinaminpathy.

## Developing the SIR Model
### Backgrounds
#### Solving differential equations using ode() in R

- For a quick introduction to exponential and logistic equations for population growth, visit: https://www.nature.com/scitable/knowledge/library/how-populations-grow-the-exponential-and-logistic-13240157
- For more detailed references on the deSolve package, try searching for deSolve vignettes https://cran.r-project.org/web/packages/deSolve/vignettes/deSolve.pdf

#### Competing Hazards in Compartmental Models
Basically $\frac{a}{a+b+c}$:

#### SIR Model with a Constant Force of Infection
$\lambda$: force of infection

#### SIR Model with a Dynamic Force of Infection

$\lambda = \beta\frac{I}{N}$
$\beta$ is the infection rate, which may be represented as $p \times c$, where $p$ is the chance of getting infection per contact, and $c$ is the number of contacts made per day.

There is a [good post](https://parasiteecology.wordpress.com/2013/10/17/density-dependent-vs-frequency-dependent-disease-transmission/) on difference between Density-dependent and Frequency-dependent Disease Transmission ($\beta\frac{I}{N}$ and $\beta{I}$).

```r
# LOAD THE PACKAGES:

library(deSolve)
library(reshape2)
library(ggplot2)

# MODEL INPUTS:

initial_state_values <- c(S = 10^6-1, I = 1, R = 0)

parameters <- c(beta=1,
                gamma = 0.1)

# TIMESTEPS:

times <- seq(from = 0, to = 60, by = 1)

# SIR MODEL FUNCTION
# We are renaming this to sir_model.
# Remember to include the input arguments,
# differential equations and output objects here.

sir_model <- function(time, state, parameters) {

    with(as.list(c(state, parameters)), {
      N <- S+I+R
      lambda <- beta * (I/(N))
    # The differential equations
      dS <- -lambda * S
      dI <- -gamma * I + lambda * S
      dR <- gamma * I

    return(list(c(dS, dI, dR)))
    })

}

# MODEL OUTPUT (solving the differential equations):

output <- as.data.frame(ode(y = initial_state_values,
                            times = times,
                            func = sir_model,
                            parms = parameters))

# Plot:

output_long <- melt(as.data.frame(output), id = "time")

ggplot(data = output_long,   # specify object containing data to plot
       aes(x = time,
           y = value,
           colour = variable,
           group = variable)) +       # assign columns to axes and groups
  geom_line() +                       # represent data as lines
  xlab("Time (days)")+                # add label for x axis
  ylab("Number of people") +          # add label for y axis
  labs(colour = "Compartment")        # add legend title
```

#### $R_0$ and $R_{eff}$
$R_0=\frac{\beta}{\gamma}$
$R_{eff} = R_0\frac{S}{N}$

### Modifiers of Population Susceptibility

#### Modeling population turnover

$$
\lambda=\beta{\frac{I}{N}} \\
\frac{dS}{dt}=b(S+I+R)-\mu{S}-\lambda{S}\\
\frac{dI}{dt}=\lambda{S}-\mu{I}-\gamma{I}\\
\frac{dR}{dt}=\gamma{I}-\mu{R}
$$

#### A simple model for vaccination
In this simple model, $p$ of the population is immunized.

The critical vaccination threshold $p_c$ would be:

#### Modelling wanning immunity

## Interventions and Calibration
### Treatment and Vaccination
#### Modelling treatment

#### Modelling leaky vaccination

- Vaccine reduces susceptibility
  $R_eff=(1-p)\times R_0 + p \times c_s\times R_0$

- Vaccine reduces susceptibility and infectivity
  $R_eff = (1-p)\times \frac{\beta}{\gamma} + p \times c_s\times \frac{c_i\times \beta}{\gamma}$
  $R_eff = (1-p)\times R_0 + p \times c_s\times c_i \times R_0$

  ```r
  # LOAD THE PACKAGES:
  library(deSolve)
  library(reshape2)
  library(ggplot2)

  # MODEL INPUTS:

  # Specify the total population size
  N <- 1000000

  # Specify the vaccination coverage
  p <- 0.6                                    # 60% coverage

  # Initial number of people in each compartment
  initial_state_values <- c(S = (1-p)*N,  # the unvaccinated proportion of the
                                          # population is susceptible
                            I = 1,        # the epidemic starts with a single
                                          # infected person
                            R = 0,        # there is no prior immunity in
                                          # the population
                            V = p*N,      # a proportion p of the population is
                                          # vaccinated (vaccination coverage)
                            Iv = 0)       # no vaccinated individual has been
                                          # infected at the beginning of the
                                          # simulation

  # Parameters
  parameters <- c(beta = 0.25,     # the infection rate in units of days^-1
                  gamma = 0.1,     # the rate of recovery in units of days^-1
                  c_s = 0.3,       # the reduction in the force of infection
                                  # acting on those vaccinated
                  c_i = 0.5)       # the reduction in the infectivity of
                                  # vaccinated infected people

  # TIMESTEPS:

  # Sequence of timesteps to solve the model at
  times <- seq(from = 0, to = 730, by = 1)   # from 0 to 2 years, daily intervals

  # MODEL FUNCTION:

  vaccine_model <- function(time, state, parameters) {

      with(as.list(c(state, parameters)), {

      # Defining lambda as a function of beta and I:
        lambda <- beta * I/N + c_i * beta * Iv/N
      # the Iv compartment is c_i times less infectious than the I compartment

      # The differential equations
        dS <- -lambda * S
        dI <- lambda * S - gamma * I
        dR <- gamma * I + gamma * Iv            # infected and vaccinated infected
                                                # individuals recover at the same rate
        dV <- -c_s * lambda * V                 # vaccinated people become infected at
                                                # a rate c_s * lambda
        dIv <- c_s * lambda * V - gamma * Iv    # vaccinated people who become infected
                                                # move into the Iv compartment

      # Return the number of people in each compartment at each timestep
      # (in the same order as the input state variables)
      return(list(c(dS, dI, dR, dV, dIv)))
      })

  }

  # MODEL OUTPUT:

  # Solving the differential equations using the ode integration algorithm
  output <- as.data.frame(ode(y = initial_state_values,
                              times = times,
                              func = vaccine_model,
                              parms = parameters))

  # PLOT THE OUTPUT

  # Plot the number of infected people over time
  ggplot(data = output,
        aes(x = time, y = I+Iv)) +   # infected people are in the I and Iv compartment
    geom_line() +
    xlab("Time (days)")+
    ylab("Number of infected people") +
    labs(title = paste("Combined leaky vaccine with coverage of", p*100, "%"))

  ```

### Calibration
#### Automated Least-Squares Calibration
```r
require(deSolve)

SIR_fn <- function(time, state, parameters) {

    with(as.list(c(state, parameters)), {
        N  <- S+I+R

        dS <- -beta*S*I/N
        dI <- beta*S*I/N-gamma*I
        dR <- gamma*I

        return(list(c(dS, dI, dR)))

    })

}

SIR_SSQ <- function(parameters, dat) {  # parameters must contain beta & gamma

    # calculate model output using your SIR function with ode()

    result <- as.data.frame(ode(y = initial_state_values  # vector of initial state
                                                          # values, with named elements
                              , times = times             # vector of times
                              , func = SIR_fn             # your predefined SIR function
                              , parms = parameters)       # the parameters argument
                                                          # entered with SIR_SSQ()
    )

    # SSQ calculation: needs the dat argument (the observed data you are fitting to)
    # assumes the data you are fitting to has a column "I"

    # select only complete cases, i.e. rows with no NAs, from the dataframe
    dat <- na.omit(dat)

    # select elements where results$time is in dat$time
    deltas2 <- (result$I[result$time %in% dat$time]
                - dat$I)^2
    SSQ   <- sum(deltas2)

    return(SSQ)

    }
flu_dat <- data.frame(time = c(1:14),
                      I = c(3, 8, 26, 76, 225, 298, 258, 233, 189, 128, 68, 29, 14, 4))

initial_state_values <- c(S = 762, I = 1, R = 0)

# choose values to start your optimisation
beta_start  <- 1
gamma_start <- 0.5

# times - dense timesteps for a more detailed solution
times <- seq(from = 0, to = 14, by = 0.1)

# optim
# you will need to run the cells to assign your functions first

optimised <- optim(par = c(beta = beta_start
                        , gamma = gamma_start)      # these are the starting beta
                                                    # and gamma that will be fed
                                                    # first, into SSQ_fn
                        , fn = SIR_SSQ
                        , dat = flu_dat  # this argument comes under "..."
                                         # "Further arguments to be passed to fn and gr"
      )

optimised #have a look at the model output
optimised$par

opt_mod <- as.data.frame(ode(y = initial_state_values  # named vector of initial
                                                       # state values
                            , times = times            # vector of times
                            ,  func = SIR_fn           # your predefined SIR function
                            , parms = optimised$par))
## plot your optimised model output, with the epidemic data using ggplot ##
require(ggplot2)

opt_plot <- ggplot()
opt_plot <- opt_plot + geom_point(aes(x = time, y = I)
                                , colour = "red"
                                , shape  = "x"
                                , data = flu_dat)
opt_plot <- opt_plot + geom_line(aes(x = time, y = I)
                                 , colour = "blue"
                                 , data   = opt_mod)
opt_plot
```

#### Likelihoods
```r
# Load the flu dataset of reported cases
reported_data <- read.csv("../Graphics_and_Data/idm2_sir_reported_data.csv")

# PACKAGES
require(deSolve)
require(ggplot2)

# INPUT
initial_state_values <- c(S = 762,
                          I = 1,
                          R = 0)

times <- seq(from = 0, to = 14, by = 0.1)

# SIR MODEL FUNCTION
sir_model <- function(time, state, parameters) {

  with(as.list(c(state, parameters)), {

    N <- S+I+R

    lambda <- beta * I/N

    # The differential equations
    dS <- -lambda * S
    dI <- lambda * S - gamma * I
    dR <- gamma * I

    # Output
    return(list(c(dS, dI, dR)))
  })
}

# DISTANCE FUNCTION

loglik_function <- function(parameters, dat) {   # takes as inputs the parameter values and dataset

   beta <- parameters[1]    # extract and save the first value in the "parameters" input argument as beta
   gamma <- parameters[2]   # extract and save the second value in the "parameters" input argument as gamma

   # Simulate the model with initial conditions and timesteps defined above, and parameter values from function call
   output <- as.data.frame(ode(y = initial_state_values,
                               times = times,
                               func = sir_model,
                               parms = c(beta = beta,       # ode() takes the values for beta and gamma extracted from
                                         gamma = gamma)))   # the "parameters" input argument of the loglik_function()

   # Calculate log-likelihood using code block 4 from the previous etivity, accounting for the reporting rate of 60%:
   LL <- sum(dpois(x = dat$number_reported, lambda = 0.6 * output$I[output$time %in% dat$time], log = TRUE))

   return(LL)
}

# OPTIMISATION

optim(par = c(1.7, 0.1),           # starting values for beta and gamma - you should get the same result no matter
                                   # which values you choose here
      fn = loglik_function,        # the distance function to optimise
      dat = reported_data,         # the dataset to fit to ("dat" argument is passed to the function specified in fn)
      control = list(fnscale=-1))  # tells optim() to look for the maximum number instead of the minimum (the default)
```

## Building on the SIR Model
### Stochastic and Deterministic Models
All the above models are Deterministic Models. We could use Gillespie algorithm to model stochastic SIR model.

### Age-structured model
We can apply contact matrix as a parameter to model the transmission between different age groups.
```r
# INPUT
# Initial state values for a naive population (everyone is susceptible except for 1 index case),
# where the total population size N is (approximately) 1 million, 20% of this are children and 15% are elderly
initial_state_values <- c(S1 = 200000,   # 20% of the population are children - all susceptible
                          S2 = 650000,   # 100%-20%-15% of the population are adults - all susceptible
                          S3 = 150000,   # 15% of the population are elderly - all susceptible
                          I1 = 1,        # the outbreak starts with 1 infected person (can be of either age)
                          I2 = 0,
                          I3 = 0,
                          R1 = 0,
                          R2 = 0,
                          R3 = 0)

# Set up an empty contact matrix with rows for each age group and columns for each age group
contact_matrix <- matrix(0,nrow=3,ncol=3)
# Fill in the contract matrix
contact_matrix[1,1] = 7     # daily number of contacts that children make with each other
contact_matrix[1,2] = 5     # daily number of contacts that children make with adults
contact_matrix[1,3] = 1     # daily number of contacts that children make with the elderly
contact_matrix[2,1] = 2     # daily number of contacts that adults make with children
contact_matrix[2,2] = 9     # daily number of contacts that adults make with each other
contact_matrix[2,3] = 1     # daily number of contacts that adults make with the elderly
contact_matrix[3,1] = 1     # daily number of contacts that elderly people make with children
contact_matrix[3,2] = 3     # daily number of contacts that elderly people make with adults
contact_matrix[3,3] = 2     # daily number of contacts that elderly people make with each other
# The contact_matrix now looks exactly like the one in the etivity instructions. We add this matrix as a parameter below.

# Parameters
parameters <- c(b = 0.05,     # the probability of infection per contact is 5%
                contact_matrix = contact_matrix,   # the age-specific average number of daily contacts (defined above)
                gamma = 1/5)  # the rate of recovery is 1/5 per day

# Run simulation for 3 months
times <- seq(from = 0, to = 90, by = 0.1)

# MODEL FUNCTION
sir_age_model <- function(time, state, parameters) {

  with(as.list(parameters), {

    n_agegroups <- 3                                 # number of age groups
    S <- state[1:n_agegroups]                        # assign to S the first 3 numbers in the initial_state_values vector
    I <- state[(n_agegroups+1):(2*n_agegroups)]      # assign to I numbers 4 to 6 in the initial_state_values vector
    R <- state[(2*n_agegroups+1):(3*n_agegroups)]    # assign to R numbers 7 to 9 in the initial_state_values vector

    N <- S+I+R     # people in S, I and R are added separately by age group, so N is also a vector of length 3

    # Defining the force of infection

    # Force of infection acting on susceptible children
    lambda <- b * contact_matrix %*% as.matrix(I/N)
    # %*% is used to multiply matrices in R
    # the lambda vector contains the forces of infection for children, adults and the elderly (length 3)

    # The differential equations
    # Rate of change in children:
    dS <- -lambda * S
    dI <- lambda * S - gamma * I
    dR <- gamma * I

    # Output
    return(list(c(dS, dI, dR)))
  })
}

# MODEL OUTPUT

output <- as.data.frame(ode(y = initial_state_values,
                            times = times,
                            func = sir_age_model,
                            parms = parameters))
# the output column names are adopted from the names we assigned in the initial_state_values vector

# Turn output into long format
output_long <- melt(as.data.frame(output), id = "time")

# Plot number of people in all compartments over time
ggplot(data = output_long,
       aes(x = time, y = value, colour = variable, group = variable)) +
  geom_line() +
  xlab("Time (days)")+
  ylab("Number of people") +
  labs(colour = "Compartment")
```

### Modelling Vector-Borne Diseases
The structure of a VBD model is shown below:

$a$ is the biting rate of mosquitoes.
$b$ is the probability of infection following a bite.

Vectorial Capacity: The number of secondary cases arising per day from a single infected case in a totally susceptible human population.

- What is $p^n$?
$p$ is the probability of the vector surviving through one day and $n$ is the average duration of the extrinsic incubation period in days, so $p^n$ is the probability of the vector surviving through the extrinsic incubation period.

```r
# INPUT
Nh <- 10000   # total number of hosts
Nv <- 20000   # total number of vectors

initial_state_values <- c(Sh = Nh-0.0028*Nh,
                          Ih = 0.0028*Nh,
                          Rh = 0,
                          Sv = Nv-0.00057*Nv,
                          Iv = 0.00057*Nv)

parameters <- c(a = 1,       # mosquito biting rate per day
                b_v = 0.4,   # probability of infection from an infected host to a susceptible vector
                b_h = 0.4,   # probability of infection from an infected vector to a susceptible host
                u_v = 0.25,  # mortality/recruitment rate of the vector
                r = 0.167)   # recovery rate from dengue in humans

times <- seq(from = 0, to = 90, by = 1)    # simulate for 3 months (90 days)

# SIR MODEL FUNCTION
vbd_model <- function(time, state, parameters) {

  with(as.list(c(state, parameters)), {

    Nh <- Sh + Ih + Rh   # total human population
    Nv <- Sv + Iv        # total vector population

    # The differential equations
    # Host population dynamics:
    dSh <- -a*b_h*Sh*Iv/Nh
    dIh <- a*b_h*Sh*Iv/Nh - r * Ih
    dRh <- r * Ih
    # Vector population dynamics:
    dSv <- u_v * Nv - a*b_v*Sv*Ih/Nh - u_v * Sv
    dIv <- a*b_v*Sv*Ih/Nh - u_v * Iv

    # Output
    return(list(c(dSh, dIh, dRh, dSv, dIv)))
  })
}

```

### Next
Study the [partially observed Markov process (POMP) models and package](http://kingaa.github.io/short-course/).


text:
# Migrate issues from Gitlab to Github

This tool migrates the *issues*, *labels*, and *milestones* from a **GitLab** repository to a **GitHub** repository.

## Requirements

You will need to install a set of Python packages. To do that, run the following command in your terminal:

```bash
sudo pip install -U python-gitlab pygithub
```

## How to run?

1. Make a copy of `template_config.json` and fill in with your repositories information.

2. Run the tool as following:

    ```bash
    ./migrate_issues --config=config.json -vv
    ```

    ... where `config.json` is your new configuration file.

---
***Note:*** You can specify the verbosity level by using the `-v` tag multiple time. There are maximum 3 levels or verbosity.

---

## Usage

    usage: migrate_issues [-h] -c CONFIG_FILE [-v]

    optional arguments:
      -h, --help            show this help message and exit
      -c CONFIG_FILE, --config CONFIG_FILE
                            Path to config file.
      -v                    Increase verbosity of the program.Multiple -v's increase the verbosity level:
                               0 = Errors
                               1 = Errors + Warnings
                               2 = Errors + Warnings + Info
                               3 = Errors + Warnings + Info + Debug


text:
GFNeko
=====

![screenshot2](https://naganeko.github.io/GFNeko/images/shark1.jpg)

![screenshot1](https://naganeko.github.io/GFNeko/images/screenshot.jpg)

Download
------------
https://github.com/choiman1559/GFNeko/releases/latest

Introduction
------------
GF version of [ANeko](https://github.com/lllllT/ANeko)
tested on Android 12 Beta 2.1 and Android 8.1

Build
-----

Prerequisites:

* [Android Studio](https://developer.android.com/studio)

How to Build :
* File -> Open -> Select Project
* Sync Project with Gradle

Then clean, compile and run.

To create skin
--------------

See [how-to-make skin file(korean)](https://gall.dcinside.com/mgallery/board/view/?id=micateam&no=857787) for internal file method.

### Changelogs from legecy GFNeko
 - changed minSDK to 19 (Android 4.4)
 - changed targetSDK to 30 (Android 11)
 - Migrated Support library to AndroidX
 - Changed PreferenceActivity to PreferenceFragmentCompat and AppCompatActivity
 - fixed ACTION_MANAGE_OVERLAY_PERMISSION problem on SDK 23 (Android 6.0) or more
 - Added WRITE_EXTERNAL_STORAGE and READ_EXTERNAL_STORAGE on manifest
 - Added android.permission.MANAGE_EXTERNAL_STORAGE on manifest (for Android 11+)
 - Deleted SkinPreference.java
 - Migrated Eclipse ADT project to Intelij IDEA Gradle style project
 - Deleted behaviour option and added size option
 - Optimize performance

repository: naganeko/GFNeko

gha_language: Java

repo_name: naganeko/GFNeko


text:
---
layout: post
title: SSH anywhere on anything
category:
tags: ssh
permalink: blog/2008/10/ssh-anywhere-on-anything
excerpt: Notice you have a bug in your site but your at work with a proxy in place?
  On your friends computer who doesn't want you installing Putty? Have no fear, consoleFISH
  is here!
date: '2008-10-08 08:16:00'
comments: true
disqus_identifier: ssh-anywhere-on-anything
---

Using AJAX based [consoleFISH](https://www.serfish.com/console/ "consoleFISH") you can log into any server via SSH and have full access to your site over this funky emulated bash terminal. It's so effective I managed to fix the news admin panel for this site (so I could post this article) in less than a minute.

It has a very new version of vim and colours files, text and syntax just like normal.

The downsides however are quite large. There is a captcha that contains obscure badly displayed words that kicks in roughly every 45 seconds unless you 3 euro's a month. Then there's the tin-hat crowd who I am sure will not like the idea of sending ssh passwords (especially server root logins) to a third party.

These downsides are for you to weigh up, but if you have no other way to access SSH, this could be a very handy tool.

Let me know what scrapes this service has got you out of.

extension: markdown


text:
# heapify
Jacob Adam's TDD implementation of binary heap sorting.

## Installation
`npm install`

`gulp specs` or `gulp watch`

## Binary Heap
See [https://en.wikipedia.org/wiki/Binary_heap](https://en.wikipedia.org/wiki/Binary_heap) for more information on what a binary heap is.

repository: gauravspatel/heapify

repo_name: gauravspatel/heapify


text:
---
title: "Applied Genetics, Genomics, and Data Science for the Swine Industry: A Ph.D. Student’s Perspective"
author: "Caleb J. Grohmann"
date: "2021-02-20T02:12:48Z"
tags: [Data Science]
link: "https://bookdown.org/caleb_grohmann/SwineGenomicsDataScience/"
length_weight: "7.6%"
repo: "cjgwx7/phd-bookdown"
pinned: false
---

Experiments using advanced analytical methods for description, prediction, and prescription of data and outcomes within the United States commercial swine industry. [...] This book is meant to document, in an extremely detailed fashion, every research project, experiment, and analysis conducted during my PhD program. The main goal of this book is to provide a seamless interface in which to combine technical and physical programming methods with the results of each analyses and subsequent discussion of these results. The book will be divided into parts, and each part encompasses all analyses ...

gha_language: R


text:
# Kernel debug symbol package (Ubuntu)

## Setup the apt repository for debug symbols

Create an APT repository configuration file according to the following article.

https://wiki.ubuntu.com/Debug%20Symbol%20Packages

## Download debug symbol
Example:

    apt install linux-image-4.15.0-54-generic-dbgsym

Then the following file will be located.

    /usr/lib/debug/boot/vmlinux-4.15.0-54-generic

## Disable KASLR

Add the following option to kernel command line and reboot.

   nokaslr

In Ubuntu, edit `GRUB_CMDLINE_LINUX` in /etc/default/grub and run the following command.

   grub-mkconfig > /boot/grub/grub.cfg

## Enable a debug feature of sysrq

   echo 1 > /proc/sys/kernel/sysrq

or set any value containing 0x8.

Editing /etc/sysctl.d/10-magic-sysrq.conf sets the value on boot.

# Attach to the kernel with GDB

Example:

    gdb /usr/lib/debug/boot/vmlinux-4.15.0-54-generic

    (gdb) target remote localhost:1234

# How to use crash utility on Ubuntu

## Install the package

    apt install crash

## Example to launch in live mode

    crash /usr/lib/debug/boot/vmlinux-4.15.0-54-generic

## Example to show a value of a variable

    crash> p/x jiffies

## Commands
- sym: show an address of a symbol
- rd: read memory content at specified address
- struct: show contents in the specified structure


text:
# Clojure Day2 - Yoda and the Force

## Recursion with loop and recur
- functional lang depend on recursion rather than iteration, e.g. evaluate size of a vector

```
user=> (defn size [v]
  #_=>   (if (empty? v)
  #_=>     0
  #_=>     (inc (size (rest v)))))
#'user/size
user=> (size [1 2 3 42])
4
```

- Clojure does not support implicit tail recursion optimization (JVM limitations)
    - yoo must explicitly recur through the use of loop and recur
    - loop as a let statement
    ```
    (loop [x x-init-value, y, y-init-value] (do-something-with x y))
    ```

- refactor size-function to use `recur`
    - maintain the result in a var called accumulator (`c` maintains a count)
    - tail-optimized call, but stuck with more kludgy lines of code (to get JVM support)
    - but you seldom need `recur` through lazy sequences

```
user=> (defn size [v]
  #_=>   (loop [l v, c 0]
  #_=>   (if (empty? l)
  #_=>     c
  #_=>     (recur (rest l) (inc c)))))
#'user/size
user=> (size [1 2 3 42])
4
```

## Sequences
- wrap all Clojure collections (sets, maps, vectors, etc.), strings and even file system structures (streams, directories)
- provide abstractions for Java containers like collections, arrays and strings
- you can wrap it in a sequence if it supports `first`, `rest` and `cons`

### Tests
- test a sequence via function `predicacte`, takes test-function, sequence and returns boolean
- test-functions `every?`, `not-every?`, `not-any?`, `some nil?`, `number?`, `even?`, `odd?`
- `some` returns first value that is not nil or false: `(some first [[] [1]])` returns 1

```
user=> (every? number? [1 2 3 :four])
false
user=> (not-every? number? [1 2 3 :four])
true
user=> (not-every? odd? [1 2 3 :four])
true
user=> (not-every? odd? [1 3 5])
false
user=> (not-any? number? [:one :two :three])
true
user=> (some nil? [1 2 nil])
true
```

### Changing a Sequence
- `filter` to grab only words with length greater than 4

```
user=> (def words ["luke" "chewie" "han" "lando"])
#'user/words
user=> (filter (fn [word] (> (count word) 4)) words)
("chewie" "lando")
```

- `map` which calls a function on all the items in a collection and returns the result
```
user=> (map (fn [x] (* x x)) [1 1 2 3 5])
(1 1 4 9 25)
```

- list comprehension combines maps and filters (as seen in Erlang and Scala)
    - `[x colors]` binds x to an element from the colors list
    - str is an arbitrary function that's applied to every bound element

```
user=> (def colors ["red" "blue"])
#'user/colors
user=> (def toys ["block" "car"])
#'user/toys
user=> (for [x colors] (str "I like " x))
("I like red" "I like blue")
user=> (for [x colors, y toys] (str "I like " x " " y "s"))
("I like red blocks" "I like red cars" "I like blue blocks" "I like blue cars")
```

- add filter to comprehension
```
user=> (defn small-word? [w] (< (count w) 4))
#'user/small-word?
user=> (for [x colors, y toys, :when (small-word? y)] (str "I like " x " " y "s"))
("I like red cars" "I like blue cars")
```

- `reduce` as equivalent to `foldl`, `foldleft` and `inject` in Erlang, Scala and Ruby
```
user=> (reduce + [1 2 3 4])
10
user=> (reduce * [1 2 3 4 5])
120
```

- `sort` and `sort-by` lists
```
user=> (sort [3 1 2 4])
(1 2 3 4)
user=> (defn abs [x] (if (< x 0) (- x) x))
#'user/abs
user=> (sort-by abs [-1 -4 3 2])
(-1 2 3 -4)
```

## Lazy Evaluation
- infinite numbers are often easier to describe, but you can't actually compute an infinite seq
- with lazy evaluation Clojure's sequence lib computes values only when they are actually consumed

### finite sequence with range
- use range, zero is default lower bound, 1 default increment
```
user=> (range 1 10)
(1 2 3 4 5 6 7 8 9)
user=> (range 1 10 3)
(1 4 7)
user=> (range 10)
(0 1 2 3 4 5 6 7 8 9)
```

### infinite sequence and take
- most basic infinite sequence: infinite sequence of one repeated element via `(repeat 1)`
- `take` a finite part of the infinite sequence
```
user=> (take 3 (repeat "Use the Force, Luke"))
("Use the Force, Luke" "Use the Force, Luke" "Use the Force, Luke")
```

- `take` first 5 elements of the `cycle` from a vector
- `drop` first 2 elements of cycle
```
user=> (take 5 (cycle [:lather :rinse :repeat]))
(:lather :rinse :repeat :lather :rinse)
user=> (take 5 (drop 2 (cycle [:lather :rinse :repeat])))
(:repeat :lather :rinse :repeat :lather)
```

- left-to-right-operator `->>` to apply each function to a result (instead of inside out logic)
```
user=> (->> [:lather :rinse :repeat] (cycle) (drop 2) (take 5))
(:repeat :lather :rinse :repeat :lather)
```

- add some separator via `interpose` (generalized version of Ruby's join)
```
user=> (take 5 (interpose :and (cycle [:lather :rinse :repeat])))
(:lather :and :rinse :and :repeat)
user=> (->> [:lather :rinse :repeat] (cycle) (drop 2) (interpose :and) (take 5))
(:repeat :and :lather :and :rinse)
```

- what if you wanted an interpose that took interposing members from a sequence? - `interleave`
    - even numbers from `(range 2)` are `(0 1 0 1 0 1 0 1)`
    - odd numbers from `(range 3)` are `(0 1 2 0 1 2 0 1 2)`
```
user=> (take 20 (interleave (cycle (range 2)) (cycle (range 3))))
(0 0 1 1 0 2 1 0 0 1 1 2 0 0 1 1 0 2 1 0)
```

- `iterate` function
    - takes a function and starting value
    - applies function (inc / dec) to starting value and successive return values

```
user=> (take 5 (iterate inc 1))
(1 2 3 4 5)
user=> (take 5 (iterate dec 1))
(1 0 -1 -2 -3)
```

- lazy sequence for recursive problems like fibonacci-sequence
    - use fib-pair to compute next fibonacci-pair
    - use map-function with first to only show first value of pair
    - grab number at index 1000, needs BigInt Numbers via `1N`
        - `100_000` still fast, `1000_000` around 1min
    - same for factorial: take n of infinite sequence and multipy them
    - fast until `100_000`

```
user=> (defn fib-pair [[a b]] [b (+ a b)])
#'user/fib-pair
user=> (fib-pair [3 5])
[5 8]
user=> (take 5 (iterate fib-pair [1 1]))
([1 1] [1 2] [2 3] [3 5] [5 8])
user=> (take 5 (map first (iterate fib-pair [1 1])))
(1 1 2 3 5)
user=> (nth (map first (iterate fib-pair [1N 1N])) 500)
225591516161936330872512695036072072046011324913758190588638866418474627738686883405015987052796968498626N

user=> (defn factorial [n] (apply * (take n (iterate inc 1N))))
#'user/factorial
user=> (factorial 5)
120N
user=> (factorial 100)
93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000N
```

## defrecord and protocols
- implement more of Clojure in Clojure itself (rather then java)
- Clojure devs needed a way to build extensions by programming to abstractions rather than to implementations
    - defrecord for types
    - defprotocol which groups functions together around a type
- from Clojure perspective best parts of OO are types and protocols (like java interfaces)
    - worst parts are implementation inheritance
    - defrecord and defprotocol preserve the good parts and leave the rest
- rewrite compass program from Scala in Clojure

### protocol and implementation with record
- Clojure protocol is like a contract / interface
- [compass.clj](Clojure/compass.clj)
- types of this protocol will support a specific set of functions, fields and args
- directions from 0 to 3 are from north to west
- turn functions via remainder-function, to use amount turns on base direction
  - `user=> (turn 3 1)` turn right from west, returns `0` = north
  - `user=> (turn 2 3)` turn 3 x right from south, returns `1` = east
- defrecord implements
  - Compass methods, ignoring `this` and returning new Compass (create new String via `(String. "new string")`)
  - Java Object toString method

```
(defprotocol Compass
  (direction [c])
  (left [c])
  (right [c])
)

(def directions [:north :east :south :west])

(defn turn
  [base amount]
  (rem (+ base amount) (count directions))
)

(defrecord SimpleCompass [bearing]
  Compass
  (direction [_] (directions bearing))
  (left [_] (SimpleCompass. (turn bearing 3)))
  (right [_] (SimpleCompass. (turn bearing 1)))
  Object
  (toString [this] (str "[" (direction this) "]"))
)
```

- usage: load-file and define compass, turn and get new Compass, get bearing and toString
```
user=> (load-file "Clojure/compass.clj")
user.SimpleCompass
user=> (def c (SimpleCompass. 0))
#'user/c
user=> (left c)
#user.SimpleCompass{:bearing 3}
user=> c
#user.SimpleCompass{:bearing 0}

user=> (:bearing c)
0
user=> (str c)
"[:north]"
```

- types work like maps
  - you can prototype new types as maps
  - iteratively convert them to types as your design stabilizes
  - you can also replace types as maps in tests as stubs or mocks
- types play nice with Clojure concurrency constructs (day 3)
- types can interoperate with Java classes and interfaces
  - build native code for JVM without java
  - use `defrecord` and `protocol` to subclass Java types or implement interfaces
  - Java classes can also build on your Clojure types

## Macros
- see Io and Ruby chapters: ruby unless in Messages `(unless test from1)`
  - function will execute `form1` if the `test` is `false`
```
user=> (defn unless [test body] (if (not test) body))
#'user/unless
user=> (unless true (println "Danger, danger Will Robinson"))
Danger, danger Will Robinson
nil

; how it should work
user=> (if (not true) (println "Danger, danger Will Robinson"))
nil
```

- most languages execute params first and then put the results on the call stack
- we don't want to evaluate the block unless the condition is false
- in Io the language circumvented this problem by delaying the execution of the unless message
- in Lisp, we can use macros
  - when we type `(unless test body)`, we want Lisp to translate that to `(if (not test) body)`

### Macro expansion
- a Clojure program executes in 2 stages
- macro expansion translates all macros in the lang to their expanded form
- see command `macroexpand`
  - already used `reader macros`
  - semicolon `;` is a comment
  - single-quote mark `'` is a quote
  - number sign `#` is an anonymous function
- to prevent premature execution, put a quote before expression we want to expand

```
user=> (macroexpand ''something-we-do-not-want-interpreted)
(quote something-we-do-not-want-interpreted)
user=> (macroexpand '#(count %))
(fn* [p1__2405#] (count p1__2405#))
```

- macro expansion lets you treat code like lists
- if you don't want a function to execute right away, quote it
- Clojure will substitute args `test` and `body` without evaluating them, but
  - we have to quote `if` and `not` and package them in lists:  `(if ...)` to `(list 'if ...)`

```
; previously with defn and instant execution
user=> (defn unless [test body] (if (not test) body))
#'user/unless

; now with macro and replacement
user=> (defmacro unless [test body]
  #_=>   (list 'if (list 'not test) body))
#'user/unless

user=> (macroexpand '(unless condition body))
(if (not condition) body)

user=> (unless true (println "No more danger, Will."))
nil
user=> (unless false (println "Now, THIS is the FORCE."))
Now, THIS is the FORCE.
nil
```

- we changed the base definition of the language with our own constrol structure
  - without requiring the language designers to add their own keywords
  - macro expansion may be the most powerful feature of Lisp and a few languages can do it
- secret sauce: expression of data as code, not just a string - code is already in a higher-order data structure

## summary
- learned to use recursion
  - JVM does not support tail-recursion optimization
  - use loop and recur via more invasive syntax
- used sequence to encapsulate access to all of the collections
  - used different functions to mutate, transform and search sequences
  - higher-order-functions added power and simplicity to sequence lib
- lazy sequences to simplify algorithms
  - offered delayed execution
  - potentially significantly improving performance and loosening decoupling
- implementing types with defrecord and protocols
  - full citizens on the JVM
- macros to add features to the language
  - macro expansion occurs before Clojure implements / interprets code
  - implemented unless by using an if function within macro expansion

## Self-Study
- find
  - implementation of some of the commonly used macros in the clojure language
    - https://clojure.org/reference/macros
    - http://bryangilbert.com/post/code/clojure/anatomy-of-a-clojure-macro/
  - an example of defining your own lazy sequence
    - https://clojuredocs.org/clojure.core/lazy-seq
    - http://clojure-doc.org/articles/language/laziness.html
    - https://medium.com/@pwentz/laziness-in-clojure-3d83645bf7f3
    - https://stackoverflow.com/questions/44095400/how-to-understand-clojures-lazy-seq
    - https://github.com/clojure/clojure/blob/206d94c9cfb01f981a157142929c9456c547d6ea/src/jvm/clojure/lang/LazySeq.java#L17
  - the current status of the `defrecord` and `protocol` features (were under development as this book was made)
    - 2013 with type-hints for DAO: https://blog.jayway.com/2013/02/05/learn-clojure-using-records-and-protocols/
    - current with additional metadata: https://clojure.org/reference/protocols
    - deftype, defrecord and reify: https://clojure.org/reference/datatypes
- do
  - implement an unless with an `else` condition using macros

```
user=> (defmacro unless [test body elsebody]
#_=>   (list 'if (list 'not test) body elsebody))
#'user/unless

user=> (macroexpand '(unless codition body elsebody))
(if (not codition) body elsebody)

user=> (unless true (println "unless happened") (println "default happened"))
default happened
nil
user=> (unless false (println "unless happened") (println "default happened"))
unless happened
nil
```

  - write a type using `defrecord` that implements a protocol
    - see [compass.clj](Clojure/compass.clj)?

repository: fbartnitzek/notes

repo_name: fbartnitzek/notes


text:
<img width="600" src="./docs/logo_1.png" />

*****

[![buildkite](https://badge.buildkite.com/e37eaf75ef47a17ecf8d2b451d0175fb22907f5b51c5034334.svg?branch=master)](https://buildkite.com/commun.contracts)
[![GitHub](https://img.shields.io/github/license/cyberway/cyberway.contracts.svg)](https://github.com/cyberway/cyberway.contracts/blob/master/LICENSE)

# Welcome to the CyberWay Commun Application source code repository!

The Commun Application is a platform for creating self-managed communities. Despite the fact that similar platforms already exist in networks, the commun platform in CyberWay has a number of original solutions:

* The community does not have governance. Instead, an elective system of leaders is implemented that operates according to the principles of liquid democracy.
* Monetization implemented by default. All community members are rewarded, including:
  * message authors - for published content;
  * curators - for the ranking (voting) of published content;
  * leaders - for fulfilling their duties stipulated in the rules of the community.
* The rules by which a community operates are public, but may vary from community to community.

Number of communities is not limited. In the future, the platform’s capabilities will be expanded, which will allow users to create new types of communities, such as:
* Private communities in which membership is approved by a leader.
* Paid communities working on a subscription model and/or entry fees.
* Business communities owned by a company with a specific owner and leaders appointed by this owner. Content in such communities is created only by users who have permission to it. In such communities, all profits are distributed between members in accordance with the settings specified by the owner.

## Commun Contracts Description
* [point](https://doxygen.cyberway.io/group__point.html)
* [emit](https://doxygen.cyberway.io/group__emission.html)
* [ctrl](https://doxygen.cyberway.io/group__control.html)
* [list](https://doxygen.cyberway.io/group__list.html)
* [gallery](https://doxygen.cyberway.io/group__gallery.html)
* [publication](https://doxygen.cyberway.io/group__publish.html)
* [social](https://doxygen.cyberway.io/group__social.html)


text:
![Image](./nvim.png?raw=true)

# fork repo

# cd path/where/you/keep/code (ex ~/dotfiles)

# install
for me
```
bash -c "$(curl -H 'Cache-Control: no-cache' -fsSL http://bit.ly/dippindotfiles)"
```

for you
```
export DOTFILES_GH_USER=<username>
export DOTFILES_GH_BRANCH=master
bash -c "$(curl -fsSL https://raw.githubusercontent.com/$DOTFILES_GH_USER/dippin-dotfiles/$DOTFILES_GH_BRANCH/bootstrap.sh)"
```

repository: CodisRedding/dippin-dotfiles

repo_name: CodisRedding/dippin-dotfiles


text:
# BINMAT - The Human Compatible Rulebook

## Credits
'thx alic'

## Index

- [The Binmat Deck](#the-binmat-deck)
- [Game Setup](#game-setup)
- [Game Structure](#game-structure)
- [Gameplay](#gameplay)
- - [The Turn Cycle](#the-turn-cycle)
- - [Drawing a Card](#drawing-a-card)
- - [Playing a Card](#playing-a-card)
- - [Combat](#combat)
- - [The Wild Modifier](#the-wild-modifier)
- [Win Conditions](#win-conditions)
- [Combat Examples and Edge Cases](#combat-examples-and-edge-cases)

## The Binmat Deck

The standard BINMAT deck is composed of seventy-eight (78) cards.
These cards are distributed in six suits, displayed below:

\& - FORM

\% - KIN

\+ - DATA

\! - CHAOS

\^ - VOID

\# - CHOICE

Every suit contains thirteen cards. Nine of these cards are numbered 2 to 10, and are referred to as such.
The other four cards are as follows:

\@ - TRAP

\* - WILD

\? - BOUNCE

\> - BREAK

These cards are known as 'modifiers'.

## Game Setup

To begin the game, first both players shall assume a role. One player is to be the 'attacker', and the other player is to be the 'defender'. These terms will be used for the duration of this rulebook without further explanation.

The attacker and defender should be seated opposite each other, and the area between them is hence known as the 'play area'. The play area should be divided into six parallel 'lanes' which traverse the area from attacker to defender or vice versa.

The BINMAT deck being used for gameplay ([The Binmat Deck](#the-binmat-deck)) should be shuffled, and then dealt as follows:

Deal thirteen face up cards in a deck at the defender's end of the right three lanes.
Deal thirteen face down cards in a deck at the defender's end of the left three lanes.

These decks are referred to as 'lane decks'.

Enough space for another deck should be left behind (defender's perspective) the decks in each lane, as this is the location of the 'lane discard pile'.

Enough space should also be left beside the play area for another deck, the 'attacker deck', and behind it space for the 'attacker discard pile'.

If the competitive rules are being followed, the BINMAT app ([Game Structure](#game-structure)) may now be placed equidistant from the attacker and defender at one side of the play area.

Under competitive rules, each turn is not to exceed a maximum of five seconds. This rule can be ignored for casual play.

If competitive rules are being used, the BINMAT app (available for iOS and Android) provides an effective timer and turn counter. If not, any method of counting down from 110 to 0 can be used.

## Gameplay

### The Turn Cycle
The defender and attacker alternate turns, with defender starting first.
On your turn, you may perform one action or pass.

The actions available are:
- Draw a card. [Drawing a Card](#drawing-a-card)
- Play a card from your hand to a lane's stack. [Playing a Card](#playing-a-card)
- Initiate combat in a lane. [Combat](#combat)

### Drawing a Card

The defender can draw a card from any of the six lane decks.
The attacker can only draw from lane decks without a defender stack in front of them.
The attacker can also draw from a special 'attacker deck' which is to be placed at the side of the play area, in front of the attacker discard pile. This deck is not present at the start of the game, but can be formed via the rules below:

When a draw is attempted from an empty deck, the following takes place:
The deck's corresponding discard pile is shuffled into the deck.
The card can then be drawn from the top of the newly formed deck.

Any deck which has its discard pile shuffled into it is to be placed face down.
This includes previously face-up lane decks.

### Playing a Card

Playing a card is slightly different depending on your role as the attacker or defender.
See the subsections below:

#### DEFENDER:

First, select the card from your hand which you wish to play.
If this card is a number card, BOUNCE modifier (?), TRAP modifier (@) or WILD modifier (*) it can be  placed on any of your six defender stacks. If the defender stack on which you place this card is face up, the card must also be placed face up. If not, it must be placed face down.

If this card is a BREAK modifier (>), it can be placed face-up or face-down on any defender stack which already contains at least one card, and does not contain another face-up break. When you place this card face-up, immediately initiate combat in the lane to which it was played. See [Combat](#combat).

#### ATTACKER:

First, select the card from your hand which you wish to play.
If this card is a number card, TRAP modifier (@) or WILD modifier (*) it can be placed on any of your six attacker stacks.

If this card is a BOUNCE modifier (?), you may perform one of the following:
Place this card face-up on an empty attacker stack. The defender stack in that lane is turned face-up.
Any BOUNCEs in the defender stack are sent to the attacker discard pile, and then the BOUNCE you played is sent to that lane's discard pile.
Place this card face-down to any attacker stack.

If this card is a BREAK modifier (>), it can be played face-up or face-downon any attacker stack which already contains at least one card. When you place this card face-up, immediately initiate combat in the lane to which it was played. This combat has slightly modified calculations, as described in [Combat](#combat).

### Combat

When combat is initiated in a lane, the cards in both attacker and defender stacks are revealed.
- For all present TRAP modifiers in the stack of the player who initiated combat:
- - If the TRAP was turned from face-down to face-up by this revealing, send the top card in your opponent's stack to your discard pile. (lane discard for defender TRAPs, attacker discard for attacker TRAPs)

Now repeat this for all present TRAP modifiers in the stack of the other player.

If a BOUNCE modifier is present in either stack, send the attacker stack to the attacker discard pile.
All present BOUNCE modifiers now go into the opponent's discard pile. (lane discard for defender BOUNCEs, attacker discard for attacker BOUNCEs)

The number cards present in the stack should now have their sum calculated. Any present WILD modifiers should
be resolved now. ([The Wild Modifier](#the-wild-modifier))

If the sum is not now a power of two, the stack has attack power zero. Otherwise, its attack power is the power of two to which the sum is equivalent.

If the attacker stack has a lower attack power, then the attacker stack goes to the lane's discard pile and the defender stack remains in its lane, face up.

If the attacker stack has an attack power equal to or greater than the defender stack, then the following takes place:

- If a BREAK modifier is not present in the attacker stack:
- - Calculate the absolute difference between attack powers, and then add one to it. This is the damage value.
- If a BREAK modifier is present in the attacker stack:
- - The attack power of the attacker stack is now the damage value.

- While the damage value is greater than zero:
- - If there are cards left in the defender's stack, send the most recently played card there to the attacker discard pile.
- - Else if there are not, but there are cards remaining in the lane's lane deck, send the top card from the lane deck to the attacker's hand.
- - Else if there are no cards remaining in the lane deck either, the attacker has won the game. ([Win Conditions](#win-conditions))
- - Subtract one from the damage value.

The attacker stack is now sent to the attacker discard.

### The Wild Modifier

The WILD modifier is applied to a stack during combat resolution.
It brings the sum of its stack up to the next highest power of two.
If there are no number cards in a stack, the first wild is treated as a 2 card, and all other WILDs apply as normal to this value.

### Win Conditions

The game is won by the defender if all 110 turns have elapsed without the attacker achieving victory.
The game can also be won by the defender if the attacker is unable to draw any cards from the lane decks, and
has no cards in attacker stacks or in their hand.
The game is won by the attacker if they deal more damage to a lane deck than the lane deck has cards. This
is mentioned in combat resolution (see [Combat](#combat))

### Combat Examples and Edge Cases
[now a stub]

repository: alicehmd/BINMAT-Rules

repo_name: alicehmd/BINMAT-Rules


text:
# Cordova RTMP and RTSP Live Streaming Plugin
This cordova plugin is use to stream a live video to RTMP or RTSP server.
Library based on [rtmp-rtsp-stream-client-java](https://github.com/pedroSG94/rtmp-rtsp-stream-client-java)

# Install
Latest stable version from npm:
```sh
$ cordova plugin add cordova-rtsp-rtmp-stream
```
Bleeding edge version from Github:
```sh
$ cordova plugin add https://github.com/disono/cordova-rtmp-rtsp-stream
```

# Using the plugin
```sh
// without comment
videoStreamer.streamRTSPAuth('rtsp://your-ip/live/app_name', 'your-username', 'your-password', [success], [failed]);
videoStreamer.streamStop([success], [failed]);

// show comment
videoStreamer.streamRTSPAuth('rtsp://your-ip/live/app_name', 'your-username', 'your-password', function (res)
	// show all the comment form and list if connection and authentication is successful
	if (res.event_name == 'onConnectionSuccess') {
		videoStreamer.commentListShow(true, function (resCom) {

		}, function (e) {

		});
	}
}, function (e) {

});
```

# Methods
```sh
videoStreamer.streamRTSP('uri', [success], [failed]);
videoStreamer.streamRTMP('uri', [success], [failed]);

videoStreamer.streamRTMPAuth('uri', 'your-username', 'your-password', [success], [failed]);
videoStreamer.streamRTSPAuth('uri', 'your-username', 'your-password', [success], [failed]);

// manually stop streaming
videoStreamer.streamStop([success], [failed]);

// comment list (Optional)
videoStreamer.commentListShow(boolean, [success], [failed]);
videoStreamer.commentList([{avatar: 'URI', username: 'Username', content: 'Message/Comment/Content Text'}], [success], [failed]);

// record locally (MP4)
videoStreamer.videoRecord([success], [failed]);
```

# RTMP & RTSP action response
```
onConnectionSuccess: data

onConnectionFailed: void

onDisconnect: void

onAuthError: void

onAuthSuccess: data

onStartStream: data

onStopStream: data

onError: data

onCommentSend: data

onCommentItemSelected: data
```

# Future Features
- [ ] iOS support using HaishinKit.swift (Separate Plugin - RTMP Only)
[https://github.com/disono/cordova-rtmp-ios](https://github.com/disono/cordova-rtmp-ios)

- [x] Support for comment form and comment list (Android)
- [x] Comment form

# Credits
[https://github.com/pedroSG94/rtmp-rtsp-stream-client-java](https://github.com/pedroSG94/rtmp-rtsp-stream-client-java)
```sh
Library for stream in RTMP and RTSP. All code in Java.
```

# License
Cordova RTMP and RTSP Streamer is licensed under the Apache License (ASL) license. For more information, see the LICENSE file in this repository.

# Hire Us!
Do you like my work? I am a Senior Full Stack App Developer (Web, Desktop & Mobile App) & Syadmin, you can hire me, open a issue or contact me!

Additionally you could be interested in check or hire us through our [Webmons Development Studio.](https://webmons.com)

Do you still need more info about me or my work?

You could check my [Linkedin profile](https://www.linkedin.com/in/disono) and [Twitter profile](https://twitter.com/master_archie)

gha_language: CSS


text:
+++
City = "Toronto"
Year = "2016"
date = "2016-03-06T21:28:07-06:00"
type = "event"
title = "Sina Jahan"

+++

### Why We Threw 5 Months of Work in the Trash; or How we Failed at adopting DevOps

**Abstract:**

Last summer we started an engineering enablement engagement in Seattle. Very quickly we decided DevOps enablement had a lot of potential and started our work...5 months later the "DevOps" part of work was shot down by management due to lack of result. We will take a look at three main reasons that we failed. These are pitfalls that can happen in any company and any project.

**Speaker:**

Sina Jahan

I'm a developer at ThoughtWorks. I tend to focus on work in the cloud and continuous delivery space, more recently focusing on the use of microservice architectures. I love learning new things and helping people build better systems. I love presenting ideas, meeting people and learning new things, and I find conferences a great way to help that. I've also written a few articles along the way.

url: https://raw.githubusercontent.com/vjanelle/devopsdays-web/6ef062e067456fcf125e8fd8d1c0b1dd0ef387ae/content/events/2016-toronto/proposals/Why We Threw 5 Months of Work in the Trash or How we Failed at adopting DevOps.md

repository: vjanelle/devopsdays-web

repo_name: vjanelle/devopsdays-web


text:
[![image](https://img.shields.io/pypi/v/zvt.svg)](https://pypi.org/project/zvt/)
[![image](https://img.shields.io/pypi/l/zvt.svg)](https://pypi.org/project/zvt/)
[![image](https://img.shields.io/pypi/pyversions/zvt.svg)](https://pypi.org/project/zvt/)
[![Build Status](https://api.travis-ci.org/zvtvz/zvt.svg?branch=master)](https://travis-ci.org/zvtvz/zvt)
[![codecov.io](https://codecov.io/github/zvtvz/zvt/coverage.svg?branch=master)](https://codecov.io/github/zvtvz/zvt)
[![Downloads](https://pepy.tech/badge/zvt/month)](https://pepy.tech/project/zvt)

**Read this in other languages: [English](README-en.md).**

ZVT is a quant trading platform written after rethinking trading based on [fooltrader](https://github.com/foolcage/fooltrader),
which includes scalable data recorder, api, factor calculation, stock picking, backtesting, and unified visualization layer,
focus on  **low frequency**, **multi-level**, **multi-targets** full market analysis and trading framework.

##  🔖 Useage examples

### Sector fund flow analysis

### Market history pe distribution

### Multi-market pe comparison

### Margin financing trend

### Foreign capital flow (Shanghai / Shenzhen-Hong Kong Stock Connect)

### Dividend comparison

### Dividend financing comparison

### Balance sheet analysis

### Custom factor

## examples
[*code examples*](./zvt/trader/examples)
### Algorithmic trading signals and performance

### Multi-targets transaction

### real time digital currency trading

### stock picker

The entire framework is highly scalable, and only needs to write very little code to expand each module. The extended tutorials for each module are to be improved, and waiting for your contribution.

##  ✨ Features

- **Enrich comprehensive out-of-the-box and updatable data**
    - china market data: stock meta, financial statements, major shareholder behavior, executive transactions, dividend financing details, stock market capital flow, margin financing, dragon and tiger charts, etc.
    - Market pe, pb, capital flow, margin financing, foreign investment trends, etc.
    - crypto currency data
- Standardization of data, multi-data source (provider) cross-validation, completion
- **Simple and extensible data framework**
- **Uniform and simple API, support sql query, support pandas**
- Scalable factor, abstracting a unified calculation for single- and multi-targets operations
- Provides a unified way of visualizing the factor
- **Concise and unified visual analysis method**
- Support multi-targets, multi-factor, multi-level backtesting
- Real-time visualization of factors, trading signals and strategies
- Support a variety of real trading (implementation)

##  🔰 install

### quick start
#### 1.clone

```
git clone https://github.com/zvtvz/zvt.git
```

setup virtual env(python>=3.6),install requirements
```
pip3 install -r requirements.txt
```

#### 2.import the project(pycharm is good for it,vscode is ok too)

unzip data sample for the tests
```
python3 init_data_sample.py

pytest tests
```

#### 3.download the data and run
change DATA_PATH（default datasample is just for testing）
```
DATA_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'data'))
```

eastmoney: https://pan.baidu.com/s/1CMAlCRYwlhGVxS6drYUEgA 提取码: q2qn
netease: https://pan.baidu.com/s/1kMhEVO0kH_Pn6wXKyqvJEA 提取码: ijxg
sina: https://pan.baidu.com/s/1eusW65sdK_WE4icnt8JS1g 提取码: uux3
joinquant: https://pan.baidu.com/s/1ijrgjUd1WkRMONrwRQU-4w 提取码: dipd

unzip them to DATA_PATH

run the main entry app
```
python3 index.py
```

for updating the data,please refer to [recorders](./zvt/recorders)

## detailed documentation

[http://zvt.foolcage.com](http://zvt.foolcage.com)
[https://zvtvz.github.io/zvt](https://zvtvz.github.io/zvt)
> docs is waiting for your contribution,especially english docs

## 💌 buy me a cup of coffee

If you think the project is helpful to you, you can buy me a cup of coffee

## 💡 contribution

Looking forward to more developers participating in the development of zvt, I will promise Reivew PR as soon as possible and respond promptly. But submit PR please make sure

1. Pass all unit tests, if it is new, please add unit test to it
2. Compliance with development specifications
3. Update the corresponding document if needed

Developers are also welcome to provide more examples for zvt to complement the documentation, located at [zvt/docs] (https://github.com/zvtvz/zvt/docs)

## Contact information
QQ group:300911873
check http://www.imqq.com/html/FAQ_en/html/Discussions_3.html

wechat Public number (some tutorials would be here):

## Thanks


text:
sweikenb/php-library
====================
This php-library collects some usefull php classes you may use for your daily work.

License: [MIT](https://raw.github.com/sweikenb/php-library/master/LICENSE)
Packagist: [sweikenb/php-library](https://packagist.org/packages/sweikenb/php-library)

repository: basecom/php-library

repo_name: basecom/php-library


text:
---
aliases:
- /2015/05/27/summer-2015-from-the-2nd-to-the-3rd-international

tags:
- Reading Groups
- Summer Reading Groups
date: 2015-05-27
status: publish
title: 'Summer 2015: From the 2nd to the 3rd International'

---
Recommended preliminary background reading

* J. P. Nettl, ["The German Social Democratic Party 1890--1914 as a Political Model"](/file/readings/readings/nettljp_spd.pdf) (1965)

Week 1
--

Karl **Kautsky*, [The Class Struggle](https://www.marxists.org/archive/kautsky/1892/erfurt/)* (1892)

Week 2
--

**Kautsky*, [The Road to Power](https://www.marxists.org/archive/kautsky/1909/power/)* (1909)

Week 3
--

[The Organisational Structure of the Communist Parties, the Methods and Content of Their Work: Theses](https://www.marxists.org/history/international/comintern/3rd-congress/party-theses.htm)

[The 21 Conditions of Admission into the Communist International](http://digital.library.pitt.edu/u/ulsmanuscripts/pdf/31735061539171.pdf#page=27)

Leon **Trotsky*, The First Five Years of the Communist International* (1924)

2 vols. [[Volume I](https://www.marxists.org/archive/trotsky/1924/ffyci-1/) [[Volume II](https://www.marxists.org/archive/trotsky/1924/ffyci-2/index.htm)

Recommended selections (\*)

**Volume I
[\* Author's 1924 Introduction \*](https://www.marxists.org/archive/trotsky/1924/ffyci-1/intro.htm)

**I. The First World Congress
\* 1. [Manifesto of the Communist International to the Workers of the World \*](https://www.marxists.org/archive/trotsky/1924/ffyci-1/ch01.htm)

2. [Report on the Communist Party of the Soviet Union and the Red Army](https://www.marxists.org/archive/trotsky/1924/ffyci-1/ch02.htm)

3. [Order of the Day Number 83 to the Red Army and Navy](https://www.marxists.org/archive/trotsky/1924/ffyci-1/ch03.htm)

**II. From the First to the Second World Congress
\* 4. [To Comrades of the Spartacus League \*](https://www.marxists.org/archive/trotsky/1924/ffyci-1/ch04.htm)

\* 5. [A Creeping Revolution \*](https://www.marxists.org/archive/trotsky/1924/ffyci-1/ch05.htm)

6. [Great Days](https://www.marxists.org/archive/trotsky/1924/ffyci-1/ch06.htm)

7. [En Route: Thoughts on the Progress of the Proletarian Revolution](https://www.marxists.org/archive/trotsky/1924/ffyci-1/ch07.htm)

8. [French Socialism on the Eve of Revolution](https://www.marxists.org/archive/trotsky/1924/ffyci-1/ch08.htm)

9. [Jean Longuet](https://www.marxists.org/archive/trotsky/1924/ffyci-1/ch09.htm)

10. [On the Coming Congress of the Comintern](https://www.marxists.org/archive/trotsky/1924/ffyci-1/ch10.htm)

**III. The Second World Congress
\* 11. [Speech on Comrade Zinoviev's Report on the Role of the Party \*](https://www.marxists.org/archive/trotsky/1924/ffyci-1/ch11.htm)

\* 12. Manifesto of the Second World Congress \*

[\* Part I \*](https://www.marxists.org/archive/trotsky/1924/ffyci-1/ch12.htm)

[\* Part II \*](https://www.marxists.org/archive/trotsky/1924/ffyci-1/ch12b.htm)

**IV. From the Second to the Third World Congress
13. [On the Policy of the KAPD (Communist Workers Party of Germany)](https://www.marxists.org/archive/trotsky/1924/ffyci-1/ch13.htm)

14. [Speech Delivered at the Second World Conference of Communist Women](https://www.marxists.org/archive/trotsky/1924/ffyci-1/ch14.htm)

15. [Letter to Comrade Monatte](https://www.marxists.org/archive/trotsky/1924/ffyci-1/ch15.htm)

16. [Letter to Comrades Cachin and Frossard](https://www.marxists.org/archive/trotsky/1924/ffyci-1/ch16.htm)

17. [On L'Humanité, the Central Organ of the French Party](https://www.marxists.org/archive/trotsky/1924/ffyci-1/ch17.htm)

**V. The Third World Congress
18. [The Red Army to the General Staff of the Revolution](https://www.marxists.org/archive/trotsky/1924/ffyci-1/ch18.htm)

\* 19. Report on the World Economic Crisis and the New Tasks of the Communist International \*

[\* Part I \*](https://www.marxists.org/archive/trotsky/1924/ffyci-1/ch19.htm)

[\* Part II \*](https://www.marxists.org/archive/trotsky/1924/ffyci-1/ch19b.htm)

20. [Summary Speech](https://www.marxists.org/archive/trotsky/1924/ffyci-1/ch20.htm)

\* 21. [Theses of the Third World Congress on the International Situation and the Tasks of the Comintern \*](https://www.marxists.org/archive/trotsky/1924/ffyci-1/ch21.htm)

22. [Speech on the Italian Question at the Third Congress of the Communist International](https://www.marxists.org/archive/trotsky/1924/ffyci-1/ch22.htm)

23. [Speech on Comrade Radek's Report on "Tactics of the Comintern" at the Third Congress](https://www.marxists.org/archive/trotsky/1924/ffyci-1/ch23.htm)

24. [Speech on Comrade Lenin's Report: "Tactics of the Russian Communist Party"](https://www.marxists.org/archive/trotsky/1924/ffyci-1/ch24.htm)

**VI. From the Third to the Fourth World Congress
25. [The Main Lesson of the Third Congress](https://www.marxists.org/archive/trotsky/1924/ffyci-1/ch25.htm)

26. [Report on "The Balance Sheet" of the Third Congress of the Communist International](https://www.marxists.org/archive/trotsky/1924/ffyci-1/ch26.htm)

27. [Summary Speech](https://www.marxists.org/archive/trotsky/1924/ffyci-1/ch27.htm)

**Appendix
**Towards the First World Congress
1. [May Day and the International](https://www.marxists.org/archive/trotsky/1924/ffyci-1/app01.htm)

\* 2. [To the Spartacus League of Germany and the Communist Party of German Austria \*](https://www.marxists.org/archive/trotsky/1924/ffyci-1/app02.htm)

\* 3. [Order Out of Chaos \*](https://www.marxists.org/archive/trotsky/1924/ffyci-1/app03.htm)

**The First World Congress
4. [Invitation to the First World Congress](https://www.marxists.org/archive/trotsky/1924/ffyci-1/app04.htm)

**From the First to the Second World Congress
5. [A Letter to Our French Comrades](https://www.marxists.org/archive/trotsky/1924/ffyci-1/app05.htm)

**From the Second to the Third World Congress
6. [A Letter to a French Syndicalist About the Communist Party](https://www.marxists.org/archive/trotsky/1924/ffyci-1/app06.htm)

7. [Vergeat, Lepetit and Lefebvre](https://www.marxists.org/archive/trotsky/1924/ffyci-1/app07.htm)

8. [The March Movement in Germany](https://www.marxists.org/archive/trotsky/1924/ffyci-1/app08.htm)

9. [The March Revolutionary Movement in Germany (Personal Notes)](https://www.marxists.org/archive/trotsky/1924/ffyci-1/app09.htm)

10. [May Day Manifesto of the ECCI](https://www.marxists.org/archive/trotsky/1924/ffyci-1/app10.htm)

\* 11. [The Unemployed and the Trade Unions \*](https://www.marxists.org/archive/trotsky/1924/ffyci-1/app11.htm)

**Volume II
**From the Third to the Fourth World Congress
\* 1. A School of Revolutionary Strategy (*July 1921*) \*

[\* Part I \*](https://www.marxists.org/archive/trotsky/1924/ffyci-2/01.htm)

[\* Part II \*](https://www.marxists.org/archive/trotsky/1924/ffyci-2/01b.htm)

2. [From the ECCI to the Central Committee of the French Communist Party](https://www.marxists.org/archive/trotsky/1924/ffyci-2/02.htm) (*June 25, 1921*)

3. [From the ECCI to the Marseilles Convention of the French Communist Party](https://www.marxists.org/archive/trotsky/1924/ffyci-2/03.htm) (*December 1921*)

4. [Speech on Comrade Zinoviev's Report "The Tactics of the Comintern" at the Eleventh Party Conference](https://www.marxists.org/archive/trotsky/1924/ffyci-2/04.htm) (*December 1921*)

\* 5. [Summary Speech at the Eleventh Party Conference](https://www.marxists.org/archive/trotsky/1924/ffyci-2/05.htm) (*December 1921*) \*

\* 6. [Flood-tide](https://www.marxists.org/archive/trotsky/1924/ffyci-2/06.htm) (*December 25, 1921*) \*

\* 7. [Paul Levi and Some 'Lefts'](https://www.marxists.org/archive/trotsky/1924/ffyci-2/07.htm) (*January 6, 1922*) \*

\* 8. [On the United Front](https://www.marxists.org/archive/trotsky/1924/ffyci-2/08.htm) (*March 2, 1922*) \*

9. [Resolution of the ECCI on the French Communist Party](https://www.marxists.org/archive/trotsky/1924/ffyci-2/09.htm) (*March 2, 1922*)

10. [The Communists and the Peasantry in France](https://www.marxists.org/archive/trotsky/1924/ffyci-2/10.htm) (*April 29, 1922*)

11. [The Lessons of May Day](https://www.marxists.org/archive/trotsky/1924/ffyci-2/11.htm) (*May 10, 1922*)

12. [From the ECCI to the Central Committee of the French Communist Party](https://www.marxists.org/archive/trotsky/1924/ffyci-2/12.htm) (*May 12, 1922*)

13. [French Communism and the Position of Comrade Rappoport](https://www.marxists.org/archive/trotsky/1924/ffyci-2/13.htm) (*May 23, 1922*)

14. [To Comrade Ker](https://www.marxists.org/archive/trotsky/1924/ffyci-2/14.htm) (*June 6, 1922*)

15. [Resolution of the ECCI on the French Communist Party](https://www.marxists.org/archive/trotsky/1924/ffyci-2/15.htm) (*June 11, 1922*)

16. [To Comrade Treint](https://www.marxists.org/archive/trotsky/1924/ffyci-2/16.htm) (*July 28, 1922*)

17. [From the ECCI to the Seine Federation of the French Communist Party](https://www.marxists.org/archive/trotsky/1924/ffyci-2/17.htm) (*Summer 1922*)

18. [From the ECCI to the Paris Convention of the French Communist Party](https://www.marxists.org/archive/trotsky/1924/ffyci-2/17b.htm) (*September 13, 1922*)

19. [From the ECCI to the Paris Convention of the French Communist Party](https://www.marxists.org/archive/trotsky/1924/ffyci-2/18.htm) (*October 6, 1922*)

**The Fourth World Congress
\* 20. [The Fifth Anniversary of the October Revolution and the Fourth World Congress of the Communist International](https://www.marxists.org/archive/trotsky/1924/ffyci-2/18b.htm) (*October 20, 1922*) \*

21. [Speech in Honour of the Communist International](https://www.marxists.org/archive/trotsky/1924/ffyci-2/19.htm) (*November 7, 1922*)

\* 22. The New Economic Policy of Soviet Russia and the Perspectives of the World Revolution (*November 14, 1922*) \*

[\* Part I \*](https://www.marxists.org/archive/trotsky/1924/ffyci-2/20.htm)

[\* Part II \*](https://www.marxists.org/archive/trotsky/1924/ffyci-2/20b.htm)

\* 23. [The Economic Situation of Soviet Russia From the Standpoint of the Socialist Revolution](https://www.marxists.org/archive/trotsky/1924/ffyci-2/21.htm) (theses) (*December 1, 1922*) \*

24. [Resolution on the French Question](https://www.marxists.org/archive/trotsky/1924/ffyci-2/22.htm) (*December 2, 1922*)

25. [A Militant Labour Program for the French Communist Party](https://www.marxists.org/archive/trotsky/1924/ffyci-2/23.htm)(*December 5, 1922*)

26. [Resolution of the French Commission](https://www.marxists.org/archive/trotsky/1924/ffyci-2/23b.htm) (*December 2, 1922*)

**After the Fourth Congress
\* 27. [Political Perspectives](https://www.marxists.org/archive/trotsky/1924/ffyci-2/24.htm) (*November 1922*) \*

28. [Report on the Fourth World Congress](https://www.marxists.org/archive/trotsky/1924/ffyci-2/24b.htm) (*December 28, 1922*)

29. [Preface to **The Communist Movement in France**](https://www.marxists.org/archive/trotsky/1924/ffyci-2/25.htm) (*March 25, 1923*)

30. [Is the Slogan of 'The United States of Europe' a Timely One?](https://www.marxists.org/archive/trotsky/1924/ffyci-2/25b.htm) (*June 30, 1923*)

31. [Can a Counter-Revolution or a Revolution be Made on Schedule?](https://www.marxists.org/archive/trotsky/1924/ffyci-2/25c.htm) (*September 23, 1923*)

\* 32. [To Comrade McKay](https://www.marxists.org/archive/trotsky/1924/ffyci-2/25d.htm) (*March 13, 1923*) \*

Week 4
--

**Trotsky*, [The Third International After Lenin](https://www.marxists.org/archive/trotsky/1928/3rd/)* (1928)

Week 5
--

C.L.R. **James*, [The World Revolution 1917-36](https://www.marxists.org/archive/james-clr/works/world/)* (1937)


text:
# To-Do-List
training task from hyperskill.org

### Example

1) Today's tasks
2) Week's tasks
3) All tasks
4) Missed tasks
5) Add task
6) Delete task
0) Exit
> 4

Missed tasks:
1. Learn the for-loop. 19 Apr

1) Today's tasks
2) Week's tasks
3) All tasks
4) Missed tasks
5) Add task
6) Delete task
0) Exit
> 6

Choose the number of the task you want to delete:
1. Learn the for-loop. 19 Apr
2. Learn the basics of SQL. 29 Apr
> 1
The task has been deleted!

1) Today's tasks
2) Week's tasks
3) All tasks
4) Missed tasks
5) Add task
6) Delete task
0) Exit
> 4

Missed tasks:
Nothing is missed!

1) Today's tasks
2) Week's tasks
3) All tasks
4) Missed tasks
5) Add task
6) Delete task
0) Exit
> 0

Bye!

repository: UnderAnder/To-Do-List

repo_name: UnderAnder/To-Do-List


text:
---
layout: "unit"
title: "Guide Entry 11.04.05"
path: "/curriculum/guides/2011/4/11.04.05.x.html"
unitTitle: "The Future of Nuclear Energy: Forbidden Joules"
unitAuthor: "Kenneth William Spinka"
keywords: ""
recommendedFor: "Recommended for Mathematics and Physics, grades 9-12"
---

Guide Entry to 11.04.05:

What happens inside a nuclear power plant is part marvel, part mystery – and occasionally a source of misery. Imagine tracing a volt of electricity back through the wall outlet, all the way across miles of power lines to the nuclear reactor from which it was generated. The nuclear reactor would be adjacent to a spark-producing generator, a generator-revolving turbine, a turbine-revolving steam jet, and finally the nuclear reactor core that heats water into steam from radioactive uranium. While some water is destined to become steam, other water in the reactor serves as a liquid coolant for the management of nuclear fission, preventing radioactive material from overheating and reaching critical limits.

On March 11, 2011, the world witnessed catastrophic consequences at the Fukushima-Daiichi nuclear facility in Japan, after the most powerful earthquake ever recorded and the ensuing tsunami irreversibly damaged the nuclear plant and several of its reactor units. Among the tragically resulting events, water drained from the reactor core, initiating an uncontrollable increase in core temperatures, resulting in overheating, a partial nuclear meltdown, and the evacuation of tens of thousands of Japanese citizens from the surrounding area. As of March 1, 2011, there were 443 operating nuclear power reactors spread across the planet in 47 different countries. Atomic energy accounts for 14 percent of the world's electrical production.

While the portion of electricity generated from nuclear energy varies dramatically by country, the percentage reaches as high as 76.2 for Lithuania and 75.2 for France. The United States is also substantially invested in nuclear energy generated electricity: 104 nuclear power plants supply approximately 20 percent of the electricity consumed in the United States, or about as much as the electricity used in California, Texas and New York, the three states with the most people. In this curriculum unit, the potential of nuclear power plants will be explored and evaluated by comparing and contrasting the benefits and risks associated with what is contained and what is released from atomic reactions within nuclear reactors.

(Recommended for Mathematics and Physics, grades 9-12)