text:
# Bluetooth Audio ALSA Backend

[![Build Status](https://github.com/Arkq/bluez-alsa/actions/workflows/build-and-test.yaml/badge.svg)](https://github.com/Arkq/bluez-alsa/actions/workflows/build-and-test.yaml)

This project is a rebirth of a direct integration between [BlueZ](http://www.bluez.org/) and
[ALSA](https://www.alsa-project.org/). Since BlueZ >= 5, the build-in integration has been removed
in favor of 3rd party audio applications. From now on, BlueZ acts as a middleware between an
audio application, which implements Bluetooth audio profile, and a Bluetooth audio device.

The current status quo is, that in order to stream audio from/to a Bluetooth device, one has to
install [PulseAudio](https://www.freedesktop.org/wiki/Software/PulseAudio), or use BlueZ < 5.
However, BlueZ version 4 is considered to be deprecated, so the only reasonable way to achieve
this goal is to install PulseAudio.

With this application (later named as BlueALSA), one can achieve the same goal as with PulseAudio,
but with less dependencies and more bare-metal-like. BlueALSA registers all known Bluetooth audio
profiles in BlueZ, so in theory every Bluetooth device (with audio capabilities) can be connected.
In order to access the audio stream, one has to connect to the ALSA PCM device called `bluealsa`.
Please note that this PCM device is based on the [ALSA software PCM I/O
plugin](https://www.alsa-project.org/alsa-doc/alsa-lib/pcm_external_plugins.html) - it will not be
available in the [ALSA Kernel proc
interface](https://www.kernel.org/doc/html/latest/sound/designs/procfile.html).

## Installation

```sh
autoreconf --install
mkdir build && cd build
../configure --enable-aac --enable-ofono --enable-debug
```

or if you intend to stream audio from a Linux distribution using PulseAudio < 13.0 (see [this
issue](https://github.com/Arkq/bluez-alsa/issues/13))

```sh
../configure --enable-aac --enable-ofono --enable-debug --disable-payloadcheck
```

then

```sh
make && make install
```

Dependencies:

- [alsa-lib](https://www.alsa-project.org/)
- [bluez](http://www.bluez.org/) >= 5.0
- [glib](https://wiki.gnome.org/Projects/GLib) with GIO support
- [sbc](https://git.kernel.org/cgit/bluetooth/sbc.git)
- [docutils](https://docutils.sourceforge.io) (when man pages build is enabled with
  `--enable-manpages`)
- [fdk-aac](https://github.com/mstorsjo/fdk-aac) (when AAC support is enabled with `--enable-aac`)
- [lc3plus](https://www.iis.fraunhofer.de/en/ff/amm/communication/lc3.html) (when LC3plus support
  is enabled with `--enable-lc3plus`)
- [libldac](https://github.com/EHfive/ldacBT) (when LDAC support is enabled with `--enable-ldac`)
- [libopenaptx](https://github.com/pali/libopenaptx) (when apt-X support is enabled and
  `--with-libopenaptx` is used)
- [mp3lame](https://lame.sourceforge.net/) (when MP3 support is enabled with `--enable-mp3lame`)
- [mpg123](https://www.mpg123.org/) (when MPEG decoding support is enabled with `--enable-mpg123`)
- [openaptx](https://github.com/Arkq/openaptx) (when apt-X support is enabled with
  `--enable-aptx` and/or `--enable-aptx-hd`)

Dependencies for client applications (e.g. `bluealsa-aplay` or `bluealsa-cli`):

- [libdbus](https://www.freedesktop.org/wiki/Software/dbus/)

Dependencies for `bluealsa-rfcomm` (when `--enable-rfcomm` is specified during configuration):

- [readline](https://tiswww.case.edu/php/chet/readline/rltop.html)

Dependencies for `hcitop` (when `--enable-hcitop` is specified during configuration):

- [libbsd](https://libbsd.freedesktop.org/)
- [ncurses](https://www.gnu.org/software/ncurses/)

For a comprehensive installation guide, please look at the [Installation from
source](https://github.com/Arkq/bluez-alsa/wiki/Installation-from-source) bluez-alsa wiki page. If
you've found something missing or incorrect, fill free to make a wiki contribution. Alternatively,
if you are using Debian-based distribution, take a look at the
[build-and-test.yaml](.github/workflows/build-and-test.yaml) GitHub workflow file, it might give
you a hint about required packages.

## Configuration & Usage

The main component of BlueALSA is a program called `bluealsa`. By default, this program shall be
run as a root during system startup. It will register `org.bluealsa` service in the D-Bus system
bus, which can be used for accessing configured audio devices. In general, BlueALSA acts as a
proxy between BlueZ and ALSA.

For details of command-line options to `bluealsa`, consult the [bluealsa man
page](./doc/bluealsa.8.rst).

In order to stream audio to the e.g. Bluetooth headset, firstly one has to connect the device. The
most straightforward method is to use BlueZ CLI utility called `bluetoothctl`. When the device is
connected one can use the `bluealsa` virtual PCM device as follows:

```sh
aplay -D bluealsa:DEV=XX:XX:XX:XX:XX:XX,PROFILE=a2dp Bourree_in_E_minor.wav
```

Setup parameters of the bluealsa PCM device can be set in the local `.asoundrc` configuration file
like this:

```sh
cat ~/.asoundrc
defaults.bluealsa.service "org.bluealsa"
defaults.bluealsa.device "XX:XX:XX:XX:XX:XX"
defaults.bluealsa.profile "a2dp"
defaults.bluealsa.delay 10000
```

BlueALSA also allows to capture audio from the connected Bluetooth device. To do so, one has to
use the capture PCM device, e.g.:

```sh
arecord -D bluealsa capture.wav
```

Using this feature, it is possible to create Bluetooth-powered speaker. It is required to forward
audio signal from the BlueALSA capture PCM to some other playback PCM (e.g. build-id audio card).
In order to simplify this task, there is a program called `bluealsa-aplay`, which acts as a simple
BlueALSA player. Connect your Bluetooth device (e.g. smartphone) and do as follows:

```sh
bluealsa-aplay XX:XX:XX:XX:XX:XX
```

For details of command-line options to `bluealsa-aplay`, consult the [bluealsa-aplay man
page](./doc/bluealsa-aplay.1.rst).

In addition to A2DP profile, used for high quality audio, BlueALSA also allows to use phone audio
connection via SCO link. One can use either build-in HSP/HFP support, which implements only audio
related part of the specification, or use [oFono](https://01.org/ofono) service as a back-end. In
order to open SCO audio connection one shall switch to `sco` profile like follows:

```sh
aplay -D bluealsa:DEV=XX:XX:XX:XX:XX:XX,PROFILE=sco Bourree_in_E_minor.wav
```

The list of available BlueALSA PCMs (provided by connected Bluetooth devices with audio
capabilities) can be obtained directly from [BlueALSA D-Bus API](doc/bluealsa-api.txt) or using
`bluealsa-aplay` as a convenient wrapper as follows:

```sh
bluealsa-aplay -L
```

In order to control input or output audio level, one can use provided `bluealsa` control plugin.
This plugin allows adjusting the volume of the audio stream or simply mute/unmute it, e.g.:

```sh
amixer -D bluealsa sset '<control name>' 70%
```

where the control name is the name of a connected Bluetooth device with a control element suffix,
e.g.:

```sh
amixer -D bluealsa sset 'Jabra MOVE v2.3.0 - A2DP' 50%
```

For more advanced ALSA configuration, consult the [asoundrc on-line
documentation](https://www.alsa-project.org/main/index.php/Asoundrc) provided by the AlsaProject
wiki page.

## Troubleshooting

1. Using BlueALSA alongside with PulseAudio.

   Due to BlueZ limitations, it seems, that it is not possible to use BlueALSA and PulseAudio to
   handle Bluetooth audio together. BlueZ can not handle more than one application which registers
   audio profile in the Bluetooth stack. However, it is possible to run BlueALSA and PulseAudio
   alongside, but Bluetooth support has to be disabled in the PulseAudio. Any Bluetooth related
   module has to be unloaded - e.g. `bluetooth-discover`, `bluez5-discover`.

2. ALSA thread-safe API (alsa-lib >= 1.1.2, <= 1.1.3).

   Starting from ALSA library 1.1.2, it is possible to enable thread-safe API functions. It is a
   noble change, but the implementation leaves a lot to be desired. This "minor" change does not
   affect hardware audio devices (because for hardware devices, this change is disabled), but it
   affects A LOT all software plug-ins. Random deadlocks are inevitable. My personal advice is to
   disable it during alsa-lib configuration step (`./configure --disable-thread-safety`), or if
   it is not possible (installation from a package repository), disable it via an environmental
   variable, as follows: `export LIBASOUND_THREAD_SAFE=0`.

3. Couldn't acquire D-Bus name: org.bluealsa

   It is not possible to run more than one instance of the BlueALSA server per D-Bus interface. If
   one tries to run second instance, it will fail with the `"Couldn't acquire D-Bus name:
   org.bluealsa"` error message. This message might also appear when D-Bus policy does not allow
   acquiring "org.bluealsa" name for a particular user - by default only root is allowed to start
   BlueALSA server.

4. Couldn't get BlueALSA PCM: PCM not found

   In contrast to standard ALSA sound cards, BlueALSA does not expose all PCMs right away. In the
   first place it is required to connect remote Bluetooth device with desired Bluetooth profile -
   run `bluealsa --help` for the list of available profiles. For querying currently connected audio
   profiles (and connected devices), run `bluealsa-aplay --list-devices`. The common misconception
   is an attempt to use A2DP playback device as a capture one in case where A2DP is not listed in
   the "List of CAPTURE Bluetooth Devices" section.

   Additionally, the cause of the "PCM not found" error might be an incorrect ALSA PCM name. Run
   `bluealsa-aplay --list-pcms` for the list of currently available ALSA PCM names - it might give
   you a hint what is wrong with your `.asoundrc` entry. Also, take a look at the "[Using the
   bluealsa ALSA pcm plugin](https://github.com/Arkq/bluez-alsa/wiki/Using-the-bluealsa-ALSA-pcm-plugin)"
   bluez-alsa wiki page.

## Resources

1. [Bluetooth Adopted Specifications](https://www.bluetooth.com/specifications/adopted-specifications)
2. [Bluetooth Design Guidelines](https://developer.apple.com/hardwaredrivers/BluetoothDesignGuidelines.pdf)
3. [RTP Payload Format for MPEG-4](https://tools.ietf.org/html/rfc6416)
4. [Coding of MPEG-4 Audio](https://www.iso.org/standard/42739.html)
5. [ALSA project library reference](https://www.alsa-project.org/alsa-doc/alsa-lib/index.html)

repository: vraoresearch/bluez-alsa

repo_name: vraoresearch/bluez-alsa


text:
# Flow Cytometry, version 0.0.1

UW BIOFAB Flow Cytometry protocols and libraries [[Download](flow-cytometry.aq)] [[Github Repo](https://github.com/klavinslab/flow-cytometry)]

© University of Washington

### Maintainer
- Ben Keller<EMAIL_ADDRESS>
### Authors
  - Ben Keller, University of Washington
  - Devin Strickland, University of Washington
  - Erriberto Lopez, University of Washington
  - Abe Miller, University of Washington

### Acknowledgements

### Details
This workflow and these documents were automatically generated from
[Aquarium](http://www.aquarium.bio) version <%= Bioturk::Application.config.aquarium_version %> and
[aquadoc](https://github.com/klavinslab/aquadoc) version 1.0.2.
Make sure that you are running the same or a newer version of Aquarium before you attempt to
import workflow.

license: MIT

repository: klavinslab/flow-cytometry

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: klavinslab/flow-cytometry


text:
# go-mirror-archlinux
A go project to quickly setup an Archlinux mirror with automatic updating.

You can skip everything below by running `docker run -d -p 4000:8081 belval/go-mirror-archlinux:0.1`

## Requirements

- rsync
    - `pacman -S rsync` (Arch)
    - `apt install rsync` (Ubuntu)

## Installation

Run `install_or_update.sh` as root. It will create a user and a service (go-mirror-archlinux). The whole thing can take sometime to get online since the initial clone is a bit long.

Edit `/etc/go-mirror-archlinux/config.json` to change the following parameters if the default configuration is suitable for you.

|||
|:-----|-----|
| PORT | The port the mirror will be running on. |
| REPO_DIRECTORY | The directory in which the 50GB-ish of content will be. |
| PRIMARY_SERVER | The server you will be syncing from. A exhaustive list can be found [here]()|
| BACKUP_SERVER | In case the primary one fails. |
| BANDWITDH_LIMIT_KB | The bandwith limit, in KB |
| SYNC_INTERVAL_HOURS | How often to sync from the Tier 1 servers. Should be at least once a day. |
| SYNC_ISO | Sync the "iso" folder |
| SYNC_OTHER | Sync the "other" folder |
| SYNC_SOURCES | Sync the "sources" folder |
|||

repository: Belval/go-mirror-archlinux

repo_name: Belval/go-mirror-archlinux


text:
---
author: Elliot Forbes
date: 2017-09-18T19:47:29+01:00
desc: An absolute beginners introduction to the Python programming language
series: python
image: python.svg
tags:
  - beginner
title: Getting Started With Python
twitter: https://twitter.com/Elliot_F
authorImage: https://images.tutorialedge.net/authors/profile.jpeg
weight: 1
---

> This tutorial uses Python version 3.6

## Introduction

In this course we’ll be taking a look at the absolute basics of the Python
programming language and cover everything you need to get up and running
creating your own basic Python programs.

The full text version of this course can be found by clicking on the Python
Programming Course card on the homepage of my site.

## Installing Python

Let’s dive in. So before we can get started working with the Python programming
language you’ll first need to install the latest version of Python onto your
local development machine. For the purpose of this video series we shall be
using version 3.6.2.

Navigate to the downloads page of [www.python.org](https://www.python.org) and download
the appropriate version now.

Once you’ve successfully installed Python you should then be able to call
‘python’ from a terminal on your development machine. As I have multiple
versions of Python installed on my local machine I’ve installed it as python3.6
but if this is your first time using the language then you may only have to call
python.

Execute the python command now. This should open up Python’s interactive shell
which allows you to quickly get up and running writing very small Python
programs.

## Our First Program

To get us started and give us a feel for the language we are going to create a
customary Hello World program that simply prints out hello world to the console.
With python we can do this in one line of code. Type `print(‘Hello World’)` and
then press enter.

Your console should look something like this:

```py
 $ python3.6
Python 3.6.0 (v3.6.0:41df79263a11, Dec 22 2016, 17:23:13)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> print('Hello World')
Hello World
```

When we press enter after writing this line of code python’s interactive shell
will then read this and try to execute it to the best of its abilities. If
everything has gone to plan then you should see `Hello World` successfully
printed out below.

## Conclusion

Congratulations, you have embarked on your first step towards becoming a Python
programmer and have successfully written and executed your first Python program.

In the next tutorial we'll be looking at how you can define functions and work
with variables in Python and start to craft more complex and larger programs.

> **Next Tutorial in Series** -
> [Functions and Variables in Python](/python/python-functions-and-variables/)

branch_name: refs/heads/main

gha_license_id: MIT


text:
# A.L.I.C.E beta v2 (Current)
This is the current development of project ALICE, the bot to beat the turing test. This version uses the Bot UI Framework to better handle conversations between ALICE and the human. A lot more still has to be done but this is the initial commit to the now open-source project. Stay tuned for more info, and check the demo here: http://chukwumaokere.com/alicebetav2/

### View the Bot UI github here: https://github.com/botui/botui
### Documentation
https://docs.google.com/document/d/1pdfVK21o8bffv2uxhfs1y_OkTh3DTUG_1zL0l8otQpM/edit
https://docs.google.com/document/d/1ZhedOCc3FF8ZA4V3UiLfPE4wO_F80xZdKVMa9ay7GUQ/edit


text:
# Contributing

Thank you for your interest in contributing! Feel free to put up a PR for any issue or feature request.
Even if you have little to no experience with React, I'll be more than happy to help. Please follow
blow steps to begin your contribution 🎉 🎊

## Setup
1. `Fork` the repo
2. `Clone` your fork
3. Make a branch for your bug fix or feature
3. Run `npm install`
4. Run `npm start` and open `localhost:3000` in a browser
5. Work your magic and make your changes
6. Run `npm run build` to kick off a production build and make sure nothing is broken
7. Commit your changes and reference the issue/feature you're addressing (for example: `git commit -am 'Commit message. Closes #1'`)
8. Push your branch to your fork
9. Create a pull request from your branch on your fork to `master` on this repo
10. Have your branch get merged in and celebrate 🔥 🎉 🎊

If you experience any issues or problems at any point, please don't hesitate to file an issue or send me a message!

repository: kennyxcao/react-redux-boilerplate

repo_name: kennyxcao/react-redux-boilerplate


text:
# nswag

[![Docker Automated build](https://img.shields.io/docker/build/countingup/nswag.svg)](https://hub.docker.com/r/countingup/nswag/builds/)

.NET Core + [NSwag](https://github.com/RicoSuter/NSwag).

Built on top of mcr.microsoft.com/dotnet/core/runtime:2.1.

The container exposes [nswag as an executable](https://github.com/RicoSuter/NSwag/wiki/CommandLine).

## Build locally

```
$ cd docker-nswag
$ docker build -t countingup/nswag .
```

## Run (will pull from dockerhub)

```
$ docker run -it countingup/nswag help
```

repository: vaclavpetr/docker-nswag

repo_name: vaclavpetr/docker-nswag


text:
# Writing instrumentation

**Warning**: The repository is still in the process of migrating to the structure described here.

Any time we want to add OpenTelemetry support for a new Java library, e.g., so usage
of that library has tracing, we must write new instrumentation for that library. Let's
go over some terms first.

**Library instrumentation**: This is logic that creates spans and enriches them with data
using library-specific monitoring APIs. For example, when instrumenting an RPC library,
the instrumentation will use some library-specific functionality to listen to events such
as the start and end of a request and will execute code to start and end spans in these
listeners. Many of these libraries will provide interception type APIs such as the gRPC
`ClientInterceptor` or servlet's `Filter`. Others will provide a Java interface whose methods
correspond to a request, and instrumentation can define an implementation which delegates
to the standard, wrapping methods with the logic to manage spans. Users will add code to their
apps that initialize the classes provided by library instrumentation, and the library instrumentation
can be found inside the user's app itself.

Some libraries will have no way of intercepting requests because they only expose static APIs
and no interception hooks. For these libraries it is not possible to create library
instrumentation.

**Java agent instrumentation**: This is logic that is similar to library instrumentation, but instead
of a user initializing classes themselves, a Java agent automatically initializes them during
class loading by manipulating byte code. This allows a user to develop their apps without thinking
about instrumentation and get it "for free". Often, the agent instrumentation will generate
bytecode that is more or less identical to what a user would have written themselves in their app.

In addition to automatically initializing library instrumentation, agent instrumentation can be used
for libraries where library instrumentation is not possible, such as `URLConnection`, because it can
intercept even the JDK's classes. Such libraries will not have library instrumentation but will have
agent instrumentation.

## Folder Structure

Please also refer to some of our existing instrumentation for examples of our structure, for example,
[aws-sdk-2.2](../../instrumentation/aws-sdk/aws-sdk-2.2).

When writing new instrumentation, create a new subfolder of `instrumentation` to correspond to the
instrumented library and the oldest version being targeted. Ideally an old version of the library is
targeted in a way that the instrumentation applies to a large range of versions, but this may be
restricted by the interception APIs provided by the library.

Within the subfolder, create three folders `library` (skip if library instrumentation is not possible),
`javaagent`, and `testing`.

For example, if we are targeting an RPC framework `yarpc` at version `1.0` we would have a tree like

```
instrumentation ->
    ...
    yarpc-1.0 ->
        javaagent
            yarpc-1.0-javaagent.gradle
        library
            yarpc-1.0-library.gradle
        testing
            yarpc-1.0-testing.gradle
```

and in the top level `settings.gradle`

```groovy

include 'instrumentation:yarpc-1.0:javaagent'
include 'instrumentation:yarpc-1.0:library'
include 'instrumentation:yarpc-1.0:testing'
```

## Writing library instrumentation

Begin by writing the instrumentation for the library in `library`. This generally involves defining a
`Tracer` and using the typed tracers in our `instrumentation-common` library to create and annotate
spans as part of the implementation of an interceptor for the library. The module should generally
only depend on the OpenTelemetry API, `instrumentation-common`, and the instrumented library itself.
[instrumentation-library.gradle](../../gradle/instrumentation-library.gradle) needs to be applied to
configure build tooling for the library.

## Writing instrumentation tests

Once the instrumentation is completed, we add tests to the `testing` module. Tests will
generally apply to both library and agent instrumentation, with the only difference being how a client
or server is initialized. In a library test, there will be code calling into the instrumentation API,
while in an agent test, it will generally just use the underlying library's API as is. Create tests in an
abstract class with an abstract method that returns an instrumented object like a client. The class
should itself extend from `InstrumentationSpecification` to be recognized by Spock and include helper
methods for assertions.

After writing a test or two, go back to the `library` package, make sure it has a test dependency on the
`testing` submodule and add a test that inherits from the abstract test class. You should implement
the method to initialize the client using the library's mechanism to register interceptors, perhaps
a method like `registerInterceptor` or wrapping the result of a library factory when delegating. The
test should implement the `LibraryTestTrait` trait for common setup logic. If the tests pass,
library instrumentation is working OK.

## Writing Java agent instrumentation

Now that we have working instrumentation, we can implement agent instrumentation so users of the agent
do not have to modify their apps to use it. Make sure the `javaagent` submodule has a dependency on the
`library` submodule and a test dependency on the `testing` submodule. Agent instrumentation defines
classes to match against to generate bytecode for. You will often match against the class you used
in the test for library instrumentation, for example the builder of a client. And then you could
match against the method that creates the builder, for example its constructor. Agent instrumentation
can inject byte code to be run after the constructor returns, which would invoke e.g.,
`registerInterceptor` and initialize the instrumentation. Often, the code inside the byte code
decorator will be identical to the one in the test you wrote above - the agent does the work for
initializing the instrumentation library, so a user doesn't have to.
You can find a detailed explanation of how to implement a javaagent instrumentation
[here](writing-instrumentation-module.md).

With that written, let's add tests for the agent instrumentation. We basically want to ensure that
the instrumentation works without the user knowing about the instrumentation. Add a test that extends
the base class you wrote earlier, but in this, create a client using none of the APIs in our project,
only the ones offered by the library. Implement the `AgentTestTrait` trait for common setup logic,
and try running. All the tests should pass for agent instrumentation too.

Note that all the tests inside the `javaagent` module will be run using the shaded `-javaagent`
in order to perform the same bytecode instrumentation as when the agent is run against a normal app.
This means that the javaagent instrumentation will be inside the javaagent (inside of the
`AgentClassLoader`) and will not be directly accessible to your test code. See the next section in
case you need to write unit tests that directly access the javaagent instrumentation.

## Writing Java agent unit tests

As mentioned above, tests in the `javaagent` module cannot access the javaagent instrumentation
classes directly.

Ideally javaagent instrumentation is just a thin wrapper over library instrumentation, and so there
is no need to write unit tests that directly access the javaagent instrumentation classes.

If you still want to write a unit test against javaagent instrumentation, add another module
named `javaagent-unit-tests`. Continuing with the example above:

```
instrumentation ->
    ...
    yarpc-1.0 ->
        javaagent
            yarpc-1.0-javaagent.gradle
        javaagent-unit-tests
            yarpc-1.0-javaagent-unit-tests.gradle
        ...
```

## Various instrumentation gotchas

### Instrumenting code that is not available as a maven dependency

If instrumented server or library jar isn't available from a maven repository you can create a
module with stub classes that define only the methods that you need for writing the integration.
Methods in stub class can just `throw new UnsupportedOperationException()` these classes are only
used to compile the advice classes and won't be packaged into agent. During runtime real classes
from instrumented server or library will be used.

Create a module called `compile-stub` and add `compile-stub.gradle` with following content
```
apply plugin: "otel.java-conventions"
```
In javaagent module add compile only dependency with
```
compileOnly project(':instrumentation:xxx:compile-stub')
```

repository: XiaoMi/mone

gha_language: Java

repo_name: XiaoMi/mone


text:
# Exercise Files with Github

By raybo ([@planetoftheweb](https://github.com/planetoftheweb))

---

# Goal

Be comfortable delivering exercise files on Github

(within the next year)

> > Author Notes:

So the goal of the training today is to get you comfortable delivering exercise files through Github.

This has been a long process that we've been testing and developing for several years.

The ultimate goal is to deliver all technology courses in this manner inside of the next year.

---

# Project Log

- Prototyping, Legal, Docs
- Producer Training
- Select Producers/Authors
- All Tech Library
- Ongoing Process

> > Author Notes:

It's taken years to get the project to where it's currently at. It's been a grass roots effort that started with a handful of authors finding different ways to work with Github, then moved on to creating a consistent prototype

Today, we're starting to train producers and get them involved in how the process works so that they're comfortable using the process and implementing it into their workflow.

Next, we'll identify a handful of producer who can be leaders and Instructors that would be great testers for the process. So far, this process has been designed by authors, legal and management, so we need to test our assumptions and make changes to the process.

Once we validate our process, then we can expand the process to additional Producers and authors.

The ultimate goal is that within a year, all technology content will use the process.

Because this project relies on software and methodologies that are constantly change, consider this process more of a living process. Github is improving their product rapidly with CI/CD features like Actions and tighter deployment integration. So instead of being set in stone.

---

# Why Github

- [Industry Standard](https://github.com/about)
- [Part of the Family](https://blogs.microsoft.com/blog/2018/06/04/microsoft-github-empowering-developers/)
- [Rich Interactive Features](https://github.com/features)
- Future Capabilities

> > Author Notes:

Github is the biggest social hub for source code on the internet.

GitHub is part of the Microsoft family, just like LinkedIn.

Github also gives both the teacher and the student additional capabilities and features. We'll talk about those in a moment.

Publishing course files on Gihub also gives us the ability to have a modern, interactive and social platform to publish content in and it will open up what we can do to deliver practice based technology learning content.

---

# Basic Features

- [Start](https://github.com/planetoftheweb/bootstrap4/blob/03_07b/builds/bootstrap/index.html)/[End](https://github.com/planetoftheweb/bootstrap4/blob/03_07b/builds/bootstrap/index.html) Snapshots
- Distributed Environment
- Works with any filetypes
- Stores only changes in files

> > Author Notes:

Git lets you create snapshots of your code at different times in the development process. We use this feature to store the state of the beginning of each video we record as well as the end of each video. This allows authors to freeze each state of the project as they record.

Git is also a distributed environment, that means that when someone downloads the repository, they have a copy of the environment the teacher uses, duplicating the same build tools and modules they use to run the softare.

Git handles any file type; text, code, scripts, config, data (json, xml). It works with binary files too; images, database, media etc. Maximum file size per file is 100MB.

It handles file and folder renames and relocations. In essense, Git creates an invisible .git folder that stores the changes between the files, so it's super efficient and creates tiny folders without making us create different folders for different start and end states like we do in exercise files. You can also hide certain folders like the node_modules folders or build folders, making the files even smaller.

---

# Bonus Features

- [Versioning/Updating](https://github.com/LinkedInLearning/svelte-firstlook-2824055/blob/master/package.json)
- [Diffing](https://github.com/linkedInLearning/svelte-firstlook-2824055/compare/01_06b..01_06e)
- [Wiki](https://github.com/LinkedInLearning/svelte-firstlook-2824055/wiki/01_04-Looping-through-data)
- [Zip Files](https://github.com/LinkedInLearning/svelte-firstlook-2824055/archive/master.zip)
- [Starring](https://github.com/planetoftheweb/sassEssentials/stargazers), [Forking](https://github.com/planetoftheweb/sassEssentials/network/members), [Deployments](https://pages.github.com/)

> > Author Notes:

Let's briefly talk about some of the features that are available to us as a result of using Github.

Instead of telling users to go to a site and install a copy of a framework, we can include a package.json file and package-lock.json file which lock-in the version of the modules a project uses. The project is also easier to update because we can push changes to the repository's branches quickly.

One of my favorite features of this process is that Github provides a visual diffing of branches, which lets you look at the differences between the beginning and ending version of code. That makes it easier to record a course, but also gives users the ability to compare their own code with a branch.

Github also provides a Wiki, which can have color coded snippets of code that you can point to. This can also be a quick way to publish simple blog type content to the project. Everything is kept safe by giving us control over the repositories in a central LinkedIn account.

Repositories are search engine indexed, so this allows pointing back to our courses from within Github as well as being able to track the usage of repositories using stats like Stars, Forks and a full analytics package.

Github even lets you create deployments of your projects and you can even combine things like Now or Netlify that give you multiple deployments per commit so you can not only show someone the code for a project, but deploy a sample site of how the code looks.

---

# What do you need?

- [Github Account](https://github.com/join)
- [Two-factor Authentication](https://github.com/settings/security)
- [Node.js](https://nodejs.org/en/)
- [Git/Gitbash](https://git-scm.com/downloads)
- [Terminal](https://hyper.is)

> > Author Notes:

To get started, you need a Github account of course.

It's company policy as a LinkedIn employee that Github users must have two-factor authentication turned on when using Github, so make sure you've set that up.

If you're doing any type of web work, you'll probably want to make sure you have Node.js installed (most repos require running build tool installations.)

Github is nothing without Git, which is the version control system it is based on, so make sure you have git installed on your machine.

You'll also need a terminal in order to run Github commands, so make sure it's set up.

---

# Github Process

---

# Github Roles

1. [Github Admin](https://github.com/linkedInLearning) (Samara)
1. Producer
1. Instructor
1. QA Tester

> > Author Notes:

There are four distinct roles in the process. One Github Admin is the manager for the how the other roles interact with the repos within our Github Organization. We gave an Enterprise account where all repos are published. This allows us to have control over the repositories.

Producers create the original repositories by sending a request to the Admin. They also instructs the QA team to request access to the LiL Private repo. Producers may also create the repositories for other authors. This is probably the least defined role currently.

Instructors use the repositories to create the courses and then push the content into the brances. Staff Instructors can handle some of the producer responsibilities as well.

---

# Producers

1. Make sure Instructors
have a Github Account
1. Send an email to:
[ldc-prod-assets@linkedin.com](mailto://ldc-prod-assets@linkedin.com).

```text
Course Name:
Course ID:
Repo Name:
Producer GitHub Account Name:
Author GitHub Account Name:
```

---

# Repo Names

The repo names should have an identifier, a short name (i.e. bootstrap4), a short identifier (i.e. “esst” for “Essential Training”) and the course ID at the end. For example, a course for Bootstrap Essential Training with a course id of 123456 would have a name

`bootstrap4-esst-123456`

> > Author Notes:

Once the request is processed, a new private repo will be created under the LinkedIn Learning GitHub organization. You and the author will receive an email invitation to the repository. The repository will include a number of files that will need to be in the final repository.

---

# What's In the Repo

- [CONTRIBUTING](https://github.com/LinkedInLearning/github-producer-training-01/blob/master/CONTRIBUTING.md), [LICENSE](https://github.com/LinkedInLearning/github-producer-training-01/blob/master/LICENSE), [NOTICE](https://github.com/LinkedInLearning/github-producer-training-01/blob/master/NOTICE)

- [README.md](https://github.com/LinkedInLearning/github-producer-training-01/blob/master/README.md)
- [.gitignore](https://github.com/LinkedInLearning/github-producer-training-01/blob/master/.gitignore) sample
- [.github](https://github.com/LinkedInLearning/github-producer-training-01/tree/master/.github) folder

> > Author Notes:

The default template has a number of boilerplate files, including a file detailing how to make contributions (we don't accept those), a license (default is a standard LinkedIn License, if you need a non-standard license, you'll need to request one from the Admin) and a Notice.

There is also a template for a README.md file. Feel free to change that, but do include installation instructions. This file might be something that we update right before the course launches.

`.gitignore` is a special git file that prevents certain files from being copied to the github. This should at minimum contain the node_modules folder, but you can add other folders here as the project dictates.

`.github` file contains special files that are used by github to provide special information. You might see something like an issue template, so that if a user starts an issue, they are guided as to what information to provide before an issue is submitted.

---

# Using the Repo

1. Fork the repo
1. Clone Repo
1. Record the course
1. Pull Request changes

> > Author Notes:

To get started with recording, the Instructor may fork the repository into their own account or their local machine.

Now, the instructor clones the repo to their recording computer.

The instructor records the course creating branches along the way at the beginning and end of each video.

Once recording is complete, the Instructor issues a pull request to the original repository and merges all of the changes.

---

# Course recording

```bash
1. git add --all
2. git commit -m "MY FIRST COMMIT"
3. git checkout -b 02_01b
4. git checkout -b 02_01e
# Record movie as normal.
5. git add –all && git commit -m "RECORDED 02_01 SUCCESSFULLY"
6. git checkout master
7. git merge 02_01b && git merge 02_01e
# Return to step 3 for the next movie.
8. git push --all
```

> > Author Notes:

This procedure creates a branch structure where the master branch holds the final state of the exercise files and each movie has its own branch off master with each branch holding a sub-branch with the end state of the current movie.

`git add --all` In the master branch, add files and libraries as required for the starting point of the first movie with exercise files for the movie you are currently recording.

`git commit -m "MY FIRST COMMIT"` Commit starting point to master branch.

`git checkout -b 02_01b` Create and checkout a branch for the current movie. Branch name will be in the format XX_YY format where XX is chapter number with leading 0's and YY is movie number, so chapter 2 movie 1 has the branch name 02_01

`git checkout -b 02_01e` Create and checkout a new branch for the finished version of the movie with the format XX_YYe (e means this is the end state for the current video)

Record movie as normal.

git add –all && git commit -m "RECORDED 02_01 SUCCESSFULLY" If recording is successful and exercise files are complete, add all of the changes and commit them to the finished branch. Otherwise, you may use git checkout .to revert the files to their starting state and record again.

`git checkout master` Checkout master branch.

`git merge 02_01e` with master branch.

Return to step 3 for the next movie.

`git push --all` Push the finished branches to repo

---

# Record Complete

- Clean up branches
- `$ git remote add upstream GITHUBURL`
- `git push –-mirror upstream`

---

# Producer

- Verify integrity, LICENSE
- Notify Admin: make repo public
- Update README.md

---

# Additional Information

- [Training Teams Channel](https://teams.microsoft.com/l/team/19%3a767edc0a4b544a549d6b61cc7599a0a8%40thread.skype/conversations?groupId=a5162fcd-0eb9-41e6-a103-c4035631df33&tenantId=72f988bf-86f1-41af-91ab-2d7cd011db47)
- [Roles Documentation](https://microsoft.sharepoint.com/:w:/t/GithubProducerTraining/EVmS63aUXqFLqTdlTvi6RrUBMIUSo6bJrVpBYVqYNQxQdw?e=gtDQav)
- [Why Use Github](https://microsoft.sharepoint.com/:w:/t/GithubProducerTraining/EbNBOcGHDYxMoRtnzd-ZDrkB12H1OAi7qxqKwW4MTGToBg?e=KDDSKG)
- [Instructor Docs](https://microsoft.sharepoint.com/:w:/t/GithubProducerTraining/EcMdVQgz5DFCmKm9H6bdrcsBPVwZ1diA4rjecVAiylkmNg?e=Tbqo1K)
- [Producer Docs](https://microsoft.sharepoint.com/:w:/t/GithubProducerTraining/EdJSLo5wV0hEo03uIgyqedQBSx2vBqvSSQGkcQc2w7wItg?e=wEo8dZ)

---

# Courses

- [Learning Git and Github](https://www.linkedin.com/learning/learning-git-and-github/welcome?u=104)
- [Github Essential Training](https://www.linkedin.com/learning/github-essential-training/)
- [Git Essential Training](https://www.linkedin.com/learning/git-essential-training-the-basics/)

---

# Let's do this

- [Use Template](https://github.com/planetoftheweb/producer-template)
- [Download Sample Content](https://github.com/planetoftheweb/producer-training/archive/master.zip)
- Add contents of producer-training

---

# Process

```bash
1. git add --all
2. git commit -m "MY FIRST COMMIT"
3. npm install
4. npm start
5. git checkout -b 01_01b
6. git checkout -b 01_01e
# Add newslide.md file to docs/slides folder
7. git add –all && git commit -m "Added Slide"
8. git checkout master
9. git merge 01_01e
# Record two more branches 01_02b 01_02e
10. git push --all
# Publish the link to repo on Teams
# Bonus: If you want to see your slideshow
# turn on Github Pages using master/docs
# in project/settings
```

repository: planetoftheweb/producer-training

repo_name: planetoftheweb/producer-training


text:
# MyPortfolio Theme

NOTICE: Due to the theme different structure (allowing more than 1 section for the posts, and the homepage sections defined in "data" directory instead of content), the "exampleSite" doesn't respect the "classic" Hugo structure, and is thus not working correctly. The "Professional" and "Personal" links and sections are not available and don't allow to see the demo site properly.
To visualise a working example of the theme, you are invited to take a look at the site pointed by "Home" link, showcasing my own (unfinished) protfolio website.

"MyPortfolio Theme" is a portfolio for developers or creatives to showcase their projects.
It is based on the [HUGO "Creative" theme](//github.com/digitalcraftsman/hugo-creative-theme) by [digitalcraftsman](//github.com/digitalcraftsman), itself based on the [original Bootstrap theme](//github.com/IronSummitMedia/startbootstrap-creative) by [David Miller](//github.com/davidtmiller).

The main feature of this theme is the possibility to have more than one portfolio section.
It can be used to showcase several portfolios, typically convenient for polyvalent individuals or companies.
One could for example have different portfolios depending on the type of work, such as "Technical", "Artistic", "Experimental", etc.
Another could have different portfolios grouping his work into "Profesional", "Personal" and "Academic".

Noteworthy features of this Hugo theme are:

* Configurable home page (sections order and presence, and their content)
* Possibility to have arbitrary number of content/projects sections
* Responsive portfolio grids with hover effect
* Can be used as a professional showcase, a personal one, or both
* Image gallery with easy and intuitive navigation controls (*)
* Dynamic generation of pages based on data content
* Easy site navigation via header navigation bar
* Possibility to display siblings, children posts and children lists independently for each page, with associated orders
* Easy content navigation via sidebar: hierarchy (siblings and parents), and taxonomies (tags and categories)
* Customisable CSS to override default values (such as main theme colours, fonts, etc.)
* Easy copyright image labelling per image or per project
* 404 page

(*) Thanks to [liwenyip](//github.com/liwenyip) for the [PhotoSwipe](https://photoswipe.com) gallery integration in Hugo: [hugo-easy-gallery](//github.com/liwenyip/hugo-easy-gallery)

![Hugo MyPortfolio Theme Screenshot](https://github.com/2-REC/hugo-myportfolio-theme/blob/master/images/screenshot.png)

## Theme structure and layout

As in the "Creative" theme, the theme's homepage holds the different sections. Its layout is a typical vertical single page, with a floating navigation bar on top.

The structure and layout of the each section is described hereafter.

### HOME

The welcome section, at the top of the homepage.

### ABOUT

The introduction/presentation section.
It is based on the "Biography" section of the ["Academic" theme](//github.com/gcushen/hugo-academic).

### SERVICES

Section presenting the services that can be provided, listed in categories and sub-categories.

### SKILLS

Section typically providing a link to a downloadable resume, as well as listing the different tags and categories that are found in the different projects sections.

### PROJECTS

Section serving as a portfolio, displaying a set of project categories (can be companies, technologies, etc.), linking to individual pages containing projects listing.
It is based on the "Creative" theme "Portfolio" section, but with links to other pages instead of pop-up windows.

The section can be present more than once if several portfolio are to be showcased. It could for example be used to display a "profesional" portfolio as well as a "personal" one.

### CONTACT

Section providing the contact information.

## Installation

Inside the folder of your Hugo site run:

    $ cd themes
    $ git clone https://github.com/2-REC/hugo-myportfolio-theme

For more information read the official [setup guide](//gohugo.io/overview/installing/) of Hugo.

## Getting started

After installing the "MyPortfolio" Theme successfully it requires just a few more steps to get the site running.

### The config file

In the [`exampleSite`](//github.com/2-REC/hugo-myportfolio-theme/tree/master/exampleSite) folder of this theme there is a [`config.toml`](
//github.com/2-REC/hugo-myportfolio-theme/blob/master/exampleSite/config.toml) file.

Copy this file in the root folder of the Hugo site.
Strings and values can be changed in order to customize the website.

Settings about the different sections in the homepage as well as the navigation menu are defined in this file.
Details about each parameter and their role can be found in the file itself.

Additionally to the configuration file, data files (located in the "data" folder) are required for the different sections of the homepage. The required data files are the folowing:

* about.yaml
* contact.yaml
* home.yaml
* services.yaml
* skills.yaml

The files can also be in JSON format, but need to have the same names.
The "Projects" section(s) can be optional, but it is advised to have at least one (it is a "Portfolio" theme after all ...).
However, if there are no projects sections, the "projects" entry of the "[params.navigation.links]" can be removed.

The following paragraphs detail the required data for each of the sections.

### HOME: Set the homepage header

The content of the top section of the homepage is fetched from the "home" data file.

The different parameters that can be used are:

* "title": The title for the website. Typically your name or company name.
* "subtitle": A subtitle. Typically the kind of services or specialty you provide.
* "background": The image used for the background.
* "text": A short phrase to draw attention and make the visitor to see more.
* "button_text": The text displayed on the scrolling button.

All the parameters are optional - if not defined, it will not be added to the page content.

### ABOUT: Introduce yourself

The content of the "ABOUT" section of the homepage is fetched from the "about" data file.

The different parameters that can be used are:

* "title": The title of the section. Typically "ABOUT" would be used.
* "avatar": The image used for the avatar.
* "short_text": A short text briefly describing the company or person.
* "long_text": A longer text providing more detailled information, and potentially links to the other sections.

All the parameters are optional - if not defined, it will not be added to the page content.

### SERVICES: Add your services

The content of the "SERVICES" section of the homepage is fetched from the "services" data file.

The different parameters that can be used are:

* "title": The title of the section. Typically "SERVICES" would be used.
* "background_image": The image used for the background.
* "services": List of services. At least one must be provided.
    Each service has a set of subfields:
    - "name": The name of the service.
    - "icon": The icon used for the service.
    - "icon_pack": The icon package/family (look at icons documentation).
    - "text": A text describing the service.
    - "list": A list of sub-services displayed as bullet points.

All the parameters except "services" are optional - if not defined, it will not be added to the page content.
The "services" list parameter must exist and contain at least one element.

### SKILLS: Show your skills

The content of the "SKILLS" section of the homepage is fetched from the "skills" data file.

The different parameters that can be used are:

* "title": The title of the section. Typically "SKILLS" would be used.
* "tags_label": Label used for the tags found in the content sections.
* "categories_label": Label used for the categories found in the content sections.
* "text": Text describing the content of the page.
* "download":
    * "button_text": Text used for the button.
    * "filename": Name of the file to download. The file must be in "static/files".
    * "icon": The icon used for the button.
    * "icon_pack": The icon package/family (look at icons documentation).

All the parameters except "text" are optional - if not defined, it will not be added to the page content.

### PROJECTS: Create a portfolio (or more)

This section serves as a showcase for a "Portfolio" of projects.
It is composed of a grid representing a set of subsections, each grouping "Projects" into "Categories".

It is based on the "Portfolio" section of the CREATIVE theme, but with an additional level of categories above the projects level. Also, instead of opening a pop-up window when selecting an element in the grid, it opens a new page displaying the contained projects.

A portfolio section "Projects" is defined in the Homepage via the "config.toml" configuration file. Additionaly to the entry specified in the file, a directory with the same name must exist at the top level of the website file structure, containing its associated "_index.md" file.

As an example, to have two sections for a professional portfolio and a personal porfolio, the following entry could be added to the "[params.projects]" group in "config.toml" file:

    categories = [ "pro", "perso" ]

It will create 2 projects sections identified by "pro" and "perso" respectively.
The values specified have to correspond to directories existing in the "content" directory of the website ("content/pro" and "content/perso").

In order to have the two sections accessible via the main navigation bar (at the top of the screen), entries also need to be added to the "[params.navigation.links]" group in "config.toml" file:

    projects = [
        { section = "pro", label = "PROFESSIONAL" },
        { section = "perso", label = "PERSONAL" }
    ]

It will create 2 projects sections links labelled "PROFESSIONAL" and "PERSONAL", pointing to the "pro" and "perso" sections respectively (the values specified for the "section" keys need to correspond to the sections identification values).

![Section Screenshot](https://github.com/2-REC/hugo-myportfolio-theme/blob/master/images/section.png)

A section is composed of "subsections" (typically categories, companies, technologies, etc.) grouping projects together. A subsection is defined by a subdirectory in a section directory also containing its associated "_index.md" file. Each subsection will be automatically added in the section menu.
Sectikns and subsections correspond to list pages in the Hugo jargon.

![List Screenshot](https://github.com/2-REC/hugo-myportfolio-theme/blob/master/images/list.png)

Subsections are in turn composed of "projects", each one defined by a post file or by a directory in case it is a bundle - containing more than a file, and generally images (the directiry must contain a "index.md" file in order to be considered as a post entry).

![Project Screenshot](https://github.com/2-REC/hugo-myportfolio-theme/blob/master/images/project.png)

For each post ("project"), "tags" and "categories" should be specified, in order to allow easy keywords filtering (the taxonomy pages resulting in the filtering results will automatically be generated by Hugo).

There can be more than one main projects sections. Different categories could for example be "Development", "Design", "Music", etc. Another set of categories could be "Profesional", "Personal", "Freelance", etc.

### CONTACT: Add contact information

The content of the "CONTACT" section of the homepage is fetched from the "contact" data file.

The different parameters that can be used are:

* "title": The title of the section. Typically "CONTACT" would be used.
* "background_image": The image used for the background.
* "photo": The image used for the avatar.
* "description": A short text typically with a call to action.
* "email": Email information.
    * "address: Email address.
    * "link": Whereas the address can be used as a link.
    * "icon": The icon used next to the address.
    * "icon_pack": The icon package/family (look at icons documentation).
* "social": List of social network icons/links.
    * "icon": The icon used for the button.
    * "icon_pack": The icon package/family (look at icons documentation).
    * "link": The link to the social network profile page.

All the parameters are optional - if not defined, it will not be added to the page content.

### Run the website

In order to see your site in action, run Hugo's built-in local server.

    $ hugo server

In the browser, enter [`localhost:1313`](http://localhost:1313) in the address bar.

## Going further

### Customise the appearance - CSS Override

A set of CSS rules are used to define the appearance of the website.
To make the website look more personal or to make it fit with the colour schemes of your company/brand, some CSS variables can be directly overridden using extra custom files (and thus not requiring to change anything in the code or main CSS file).

In order to use custom files, simply add the files in the "static/css" directory, and specify their name (with extension) in the "custom_css" array variable in the "config.toml" file.

The CSS variables that can be overridden are listed in the "custom.css" file (in "static/css"). The file indicates for each variable the default value that will be used. These values are defined either in the "default.css" file, or directly hardcoded in the website's main CSS file ("theme.css") in case they're not defined elsewhere. The provided "custom.css" file can be used as template file, by uncommenting the desired variables.

## Contributing

If you have found a bug, or have an idea for a new feature, please feel free to use the [issue tracker](//github.com/2-REC/hugo-myportfolio-theme/issues) to let me know.
You can also make directly a [pull request](//github.com/2-REC/hugo-myportfolio-theme/pulls).

Please create a separate branch for your pull request.

## License

This theme is released under the Apache License 2.0 For more information read the [license](//github.com/2-REC/hugo-myportfolio-theme/blob/master/LICENSE).

## Acknowledgements

Thanks to:

* [digitalcraftsman](//github.com/digitalcraftsman) for creating the Creative theme
* [Steve Francia](//github.com/spf13) for creating Hugo and the awesome community around the project
* [David Miller](//github.com/davidtmiller) for creating the original theme
* [liwenyip](//github.com/liwenyip) for the PhotoSwipe gallery integration in Hugo
* [PhotoSwipe](https://photoswipe.com) for the gallery functionality


text:
# x509-certificate-parser

This vanilla Javascript library allows you to parse information from x.509 certificates to the following output.

```json
{
  "encryptionAlgo": "sha256WithRSAEncryption-PKCS",
  "countryName-X509": "FI",
  "stateOrProvinceName-X509": "Uusimaa",
  "localityName-X509": "Helsinki",
  "organizationName-X509": "Aalto University",
  "organizationalUnitName-X509": "Smartcom",
  "commonName-X509": "JaanTaponen",
  "emailAddress-PKCS"<EMAIL_ADDRESS>  "UTCTime": "2021-04-17 12:11:39 UTC",
}
```
The wrapper code can be found in the [certInfo.js](./certInfo.js) but optionally you can add the following script tag to your HTML

```console
<script type="text/javascript" src="https://raw.githubusercontent.com/AaltoSmartCom/x509-certificate-parser/master/certificate-parser-min.js"></script
```

and then call the ```function decodeCert(cert)``` function with your encoded certificate.

gha_language: JavaScript


text:
# Safe K8s Deployment using Gatekeeper & Open Policy Agent

## Introduction

This demo shows how to enforce security policies for K8s deployments using [Open Policy Agent](https://www.openpolicyagent.org),
and the corresponding [Gatekeeper](https://github.com/open-policy-agent/gatekeeper) project.

For details on the demo application see [hello spring boot application](../step1-hello-spring-boot).

### Open Policy Agent

Before diving into the Kubernetes part with [Gatekeeper](https://github.com/open-policy-agent/gatekeeper)
let's look into [Open Policy Agent](https://www.openpolicyagent.org) how open policies work in general.

OPA decouples policy decision-making from policy enforcement.
When your software needs to make policy decisions it queries OPA and supplies structured data (e.g., JSON) as input.
OPA works similar to a BPM engine, or a state machine by decoupling processes from input and output data.

![opa](images/opa.png)

(Source: https://www.openpolicyagent.org)

Policies in OPA are written using OPA's own language called [Rego](https://www.openpolicyagent.org/docs/latest/policy-language).

```
package kubernetes.admission

deny[msg] {
  input.request.kind.kind == "Pod"
  image := input.request.object.spec.containers[_].image
  not startswith(image, "myreg.com/")
  msg := sprintf("image '%v' comes from untrusted registry", [image])
}
```

This example checks if the container image to be deployed on a K8s cluster origins from
a trusted container registry called (_myreg.com_).

To evaluate and play with [Rego](https://www.openpolicyagent.org/docs/latest/policy-language) you can use [The Rego Playground](https://play.openpolicyagent.org)

### Gatekeeper

[Gatekeeper](https://github.com/open-policy-agent/gatekeeper) installs an [admission controller](https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/) on K8s that contains
the [Open Policy Agent](https://www.openpolicyagent.org) to enforce policies for deployments on the Kubernetes cluster.

![opa](images/gatekeeper.png)

(Source: https://www.openpolicyagent.org)

## Lab

To install [Gatekeeper](https://github.com/open-policy-agent/gatekeeper) just follow
the [installation instructions](https://github.com/open-policy-agent/gatekeeper#deploying-a-release-using-prebuilt-image)
or use the script _deploy-gatekeeper.sh_ in this folder.

Rego policies cannot be deployed directly into a K8s cluster, instead [Gatekeeper](https://github.com/open-policy-agent/gatekeeper)
uses the [OPA Constraint Framework](https://github.com/open-policy-agent/frameworks/tree/master/constraint).

Here you first deploy a constraint template and then a corresponding constraint using the template.
In this step we will enforce that all Pod specifications require to include a _security context_ disallowing
privilege escalation by setting _allowPrivilegeEscalation_ to _false_.

To enforce this, please execute the script _deploy-constraint.sh_ in this folder.

## Deploy the application (will be denied)

First we want to see the [Gatekeeper](https://github.com/open-policy-agent/gatekeeper) in action so that
our deployment is denied because of allowing privilege escalation.
The corresponding container image is pulled from [andifalk/hello-rootless-jib](https://cloud.docker.com/repository/registry-1.docker.io/andifalk/hello-rootless-jib) docker hub repository.

The application is deployed using the following deployment yaml file _k8s/deploy_denied.yaml_:

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: hello-opa-gatekeeper-denied
  name: hello-opa-gatekeeper-denied
spec:
  replicas: 1
  selector:
    matchLabels:
      app: hello-opa-gatekeeper-denied
  template:
    metadata:
      labels:
        app: hello-opa-gatekeeper-denied
    spec:
      automountServiceAccountToken: false
      securityContext:
        runAsNonRoot: true
      containers:
      - image: andifalk/hello-rootless-jib:latest
        name: hello-opa-gatekeeper-denied
        resources:
          limits:
            cpu: "1"
            memory: "512Mi"
          requests:
            cpu: "0.5"
            memory: "256Mi"
        securityContext:
          readOnlyRootFilesystem: true
          allowPrivilegeEscalation: true
          privileged: false
          runAsNonRoot: true
          capabilities:
            drop:
              - ALL
        readinessProbe:
          httpGet:
            path: /
            port: 8080
          initialDelaySeconds: 5
          periodSeconds: 5
        livenessProbe:
          httpGet:
            path: /actuator/health
            port: 8080
          initialDelaySeconds: 10
          periodSeconds: 5
        volumeMounts:
          - name: tmp-volume
            mountPath: /tmp
      restartPolicy: Always
      volumes:
        - name: tmp-volume
          emptyDir: {}
```

You will get an error message from the [Gatekeeper](https://github.com/open-policy-agent/gatekeeper)
denying the deployment.

```
admission webhook "validation.gatekeeper.sh" denied the request: [denied
      by psp-allow-privilege-escalation-container] Privilege escalation container
      is not allowed: hello-opa-gatekeeper-denied'
```

## Deploy the application (will be deployed successfully)

Now we want to see that [Gatekeeper](https://github.com/open-policy-agent/gatekeeper) accepts our
deployment because of disallowing privilege escalation now.
The corresponding container image is pulled from [andifalk/hello-rootless-jib](https://cloud.docker.com/repository/registry-1.docker.io/andifalk/hello-rootless-jib) docker hub repository.

The application is deployed using the following deployment yaml file _k8s/deploy.yaml_:

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: hello-opa-gatekeeper
  name: hello-opa-gatekeeper
spec:
  replicas: 1
  selector:
    matchLabels:
      app: hello-opa-gatekeeper
  template:
    metadata:
      labels:
        app: hello-opa-gatekeeper
    spec:
      automountServiceAccountToken: false
      securityContext:
        runAsNonRoot: true
      containers:
      - image: andifalk/hello-rootless-jib:latest
        name: hello-opa-gatekeeper
        resources:
          limits:
            cpu: "1"
            memory: "512Mi"
          requests:
            cpu: "0.5"
            memory: "256Mi"
        securityContext:
          readOnlyRootFilesystem: true
          allowPrivilegeEscalation: false
          privileged: false
          runAsNonRoot: true
          capabilities:
            drop:
              - ALL
        readinessProbe:
          httpGet:
            path: /
            port: 8080
          initialDelaySeconds: 5
          periodSeconds: 5
        livenessProbe:
          httpGet:
            path: /actuator/health
            port: 8080
          initialDelaySeconds: 10
          periodSeconds: 5
        volumeMounts:
          - name: tmp-volume
            mountPath: /tmp
      restartPolicy: Always
      volumes:
        - name: tmp-volume
          emptyDir: {}
```

This should now be deployed without any error.


text:
### [CVE-2017-10194](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-10194)
![](https://img.shields.io/static/v1?label=Product&message=SSM%20-%20(hot-tamale)%20ILOM%3A%20Integrated%20Lights%20Out%20Manager&color=blue)
![](https://img.shields.io/static/v1?label=Version&message=%3C%203.2.6%20&color=brighgreen)
![](https://img.shields.io/static/v1?label=Vulnerability&message=Easily%20exploitable%20vulnerability%20allows%20high%20privileged%20attacker%20with%20network%20access%20via%20HTTP%20to%20compromise%20Oracle%20Integrated%20Lights%20Out%20Manager%20(ILOM).%20%20Successful%20attacks%20of%20this%20vulnerability%20can%20result%20in%20%20unauthorized%20read%20access%20to%20a%20subset%20of%20Oracle%20Integrated%20Lights%20Out%20Manager%20(ILOM)%20accessible%20data.&color=brighgreen)

### Description

Vulnerability in the Oracle Integrated Lights Out Manager (ILOM) component of Oracle Sun Systems Products Suite (subcomponent: System Management). The supported version that is affected is Prior to 3.2.6. Easily exploitable vulnerability allows high privileged attacker with network access via HTTP to compromise Oracle Integrated Lights Out Manager (ILOM). Successful attacks of this vulnerability can result in unauthorized read access to a subset of Oracle Integrated Lights Out Manager (ILOM) accessible data. CVSS 3.0 Base Score 2.7 (Confidentiality impacts). CVSS Vector: (CVSS:3.0/AV:N/AC:L/PR:H/UI:N/S:U/C:L/I:N/A:N).

### POC

#### Reference
- http://www.oracle.com/technetwork/security-advisory/cpuoct2017-3236626.html

#### Github
No PoCs found on GitHub currently.

repository: trickest/cve

gha_language: HTML

repo_name: trickest/cve


text:
---
description: This page describes the waste management plan for the CCC
---

# Local Waste Management

## **Medical Waste Disposal**

We need to connect to the IMA.

* Medical waste - IMAGE, thru IMA
* Food waste- use the services of the councillor/ panchayat member to get the _kudumbashree_ units to handle it
* Plastics- segregated and dealt with by the _kudumbashree_ units
* Other waste- incinerator  We need to follow the process given by IMA and then IMA will collect the waste from the CCC daily.

## General Waste

Food waste and non food waste has to be separated and collected.

repository: coronasafe/model

repo_name: coronasafe/model


text:
---
layout:     post
title:      Basketball
comments: true
date:       2016-07-1  15:31:19
summary:    A few thoughts on the current predicament of the game
categories: Introduction
---

![desk](http://i.cdn.turner.com/nba/nba/media/bulls/jordan_090909.jpg)

Hello.

My mind wanders off to **basketball** a lot in the past few days.
Maybe it's the fact that one of the greatest NBA Finals ever to be played just got over .Or maybe it has something to do with my playing the game on a regular basis these past 10 days.

I think a lot about explosiveness and how I can get faster and move quickly off my feet. You might think I'm too entrenched in myself. You might be right.

I never appreciated the ability to burst off from 0-60 in matter of seconds. Two players come to mind that have that ability in spades.*Kyrie Irving* and *Russell Westbrook*, especially the latter one.
 Kyrie has a lot of skill built into his game and combined with the amount of effort he puts in to perfecting his body to undergo the rigors of a regular season bouncing around with freaks of nature demands appreciation. Russell on the other hand is an athletic freak of nature who will break you down physically.
 He reminds me of a quicker , slightly less stronger Lebron in some aspects.

 Anyway, I think jumping jacks and high intensity sprints are the way to go to improve quickness. Along with suicides , this could really boost up my athleticism.
 I'm guessing 10 suicides and 10 sprints should do the trick every day.
 This patched along with driving layups could really turn me into a point guardy type of player.
 I think of myself as a wing player, and I'm looking to change that.

 Might also try to learn the windmill, but then again you need a good jump for that. I wonder whether I can reach 30-35 inches on my vertical..

 Thoughts for another day

 Cheerio

 {% if page.comments %}

 Please enable JavaScript to view the comments powered by Disqus.

 {% endif %}


text:
---
layout:     post
title:      LeetCode 239 Sliding Window Maximum (Python)
number:     239
level:      Hard
lcurl:      sliding-window-maximum
youtube:    W2zQSExW04s
bilibili1:  //player.bilibili.com/player.html?aid=287949414&bvid=BV1Bf4y1v758&cid=260875513&page=1
xigua:
date:       2020-11-28
author:     小明MaxMing
header-img: img/post-bg-coffee.jpeg
catalog: false
tags:
    - Sliding Window
---

### 题目

You are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position.

Return the max sliding window.

### 解题思路

使用一个双向队列来维护滑动窗口的最大值，保持降序，队首元素为当前最大值，如果超出范围出队

### 代码
```python
from collections import deque
class Solution:
    def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]:
        n = len(nums)
        res = []
        q = deque()
        for i in range(n):
            while q and nums[q[-1]] < nums[i]:
                q.pop()
            q.append(i)
            if q[0] == i - k:
                q.popleft()
            if i >= k - 1:
                res.append(nums[q[0]])
        return res
```


text:
First of all our data in in unusable format. We have to convert it into usable form by making a file with adjacency list.
So we form the final file using a mapper and reducer and convert the original file into a file with adjacency list, which is named as road.txt.
We have considered the weight of each edge to be 1 for this part.
We use the mapper1.py and reducer1.py in Graph Generator folder to process the original data into useful data.

We have not only calculated the distance from the source node but also the path that is followed by the edges to reach the destination using the minimum distance!!
Output.txt contains multiple columns. The first column conatins the destination node.
We consider 0 to be the source node for this part.
The second column is the shortest distance from 0 to the destination node. Or in other words, the second number in a line is the minumum distance from 0 to the node which is the first number of the line.
Further some columns contain the adjacency list of the node in column 1 separated by commas.
The last column shows the path that is followed to calculate the minimum distance.
So, we have also calculated an extra metric, the path!

ALGORITHM:
We have considered the distance between nodes that are not in the adjacency list of 0 to be at a distance of 2000000, which is the representation of infinite.
And all the nodes connected to 0 are considered to be at a distance 1.
We use parallel BFS and Dijkstra to calculate the distance. When some node is discovered using parallel BFS, we update it's distance from 2000000 to it's calculated current distance.
We iteratively compute each node's distance to the source node (0 in this case) and we stop when all the nodes are visited.
We update the distance of each children from 0 with parent distance + parent-child distance.
The node is selected according to the lowest distance of previous node.

If some line is showing it's second number to be 2000000, it means that this node has still not been discovered in the parallel BFS.

Following is the command that was used to execute the operations:
chmod a+x launch_local.sh
./launch_local.sh road.txt [-v]

I terminated the operation after the program ran for 6 hours and was showing for no signs of stopping.
The output is stored in output.txt0 and we have the intial 8 or 9 lakhs of lines. We can continue this on a stronger computer or EMR.


text:
# Trello Power-Up On Heroku

This is a sample [Power-Up](https://developers.trello.com/power-ups/intro) built for the Trello platform and intended to be hosted on Heroku.

[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/trello/power-up-on-heroku&env[PORT]=80)

## Running Locally

Make sure you have [Node.js](http://nodejs.org/) and the [Heroku Toolbelt](https://toolbelt.heroku.com/) installed.

```sh
$ git clone git@github.com:trello/power-up-on-heroku.git # or clone your own fork
$ cd power-up-on-heroku
$ npm install
$ npm start
```

Your app should now be running on [localhost:5000](http://localhost:5000/).

## Deploying via Heroku CLI

Ensure that you have [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli) installed.

```
$ heroku create
$ git push heroku master
$ heroku open
```

repository: trello/power-up-on-heroku

repo_name: trello/power-up-on-heroku


text:
# TennisBallTracker
OpenCV (C++) project to track a tennis ball and keep it in the center of a mobile camera platform

<img src="https://i.imgur.com/JE6bA1c.gif"/>

### Completion

![40%](https://progress-bar.dev/40)

### Requirements

##### Software

* OpenCV

##### Electrical

* RaspberryPi
* Nema 17 Stepper Motor
* 12V Power Supply
* 3.3V USB Power Supply
* DRV 8825
* 1mF Capacitor
* 1 kOhm Resistor x 2
* Limit swich x 2

##### Hardware

* See Solidworks assembly

### Completed Features

* Initial mobile platform design
* OpenCV code to track a tennis ball
* Electrical schematic and parts list

### Remaining Features

* Buy and assemble mobile platform
* Add movement logic
* Add limit logic
* Stop if ball is too far away or not found

### License

MIT (C) 2019

repository: seanziegler/TennisBallTracker

repo_name: seanziegler/TennisBallTracker


text:
---
title: 1. Registering an Action
---

An action is technically a class, derived from the
[AnAction](upsource:///platform/editor-ui-api/src/com/intellij/openapi/actionSystem/AnAction.java)
class.
To update the state of the action, the method `AnAction.update(AnActionEvent)` is called by the IntelliJ Platform framework.
The object of type
[AnActionEvent](upsource:///platform/editor-ui-api/src/com/intellij/openapi/actionSystem/AnActionEvent.java)
passed to this method carries the information about the current context for the action,
and in particular, the specific presentation which needs to be updated.

### 1.1. Creating actions

To create a new action we need to extend the [AnAction](upsource:///platform/editor-ui-api/src/com/intellij/openapi/actionSystem/AnAction.java)
class. As an example we will do that in the `SimplePopDialogAction` class in the `register_actions` code sample.

```java
public class SimplePopDialogAction extends AnAction {
}
```

**Note** the `SimplePopDialogAction` does not have class fields of any kind. This is because an instance of `AnAction` class
exists for the entire lifetime of the application. If `AnAction` class uses a field to store data which has a shorter
lifetime, and doesn't clear this data promptly, the data will be leaked. For example, any `AnAction` data that exists
only within the context of a `Project` will cause the `Project` to be kept in memory after the user has closed it.

### 1.2. Overriding actionPerformed()

The [AnAction](upsource:///platform/editor-ui-api/src/com/intellij/openapi/actionSystem/AnAction.java)
class is abstract, and classes that extend it must override the `AnAction.actionPerformed(AnActionEvent)` method.
This method should contain the code to be executed when the action has been invoked.
In this case `SimplePopDialogAction.actionPerformed(AnActionEvent)` doesn't do anything yet.

```java
public class SimplePopDialogAction extends AnAction {
  @Override
  public void actionPerformed(@NotNull AnActionEvent anActionEvent) {
    // Using the event, create and show a dialog
  }
}
```

### 1.3. Registering actions

To register a newly created action, an `<action>` attribute should be added to the `<actions>` section of the plugin configuration file
[plugin.xml](https://github.com/JetBrains/intellij-sdk-docs/blob/master/code_samples/register_actions/resources/META-INF/plugin.xml).
IntelliJ IDEA has an embedded inspection that spots unregistered actions. Here is an example using the `SimplePopDialogAction` class:

!["Action never used" inspection](img/action_never_used.png)

To register `SimplePopDialogAction` and set up its attributes press ***Alt + Enter*** while the caret is placed on the action's declaration.

Then fill out the **New Action** form to set up `SimplePopDialogAction`'s parameters such as: the action's name and description,
a UI component the action is bound to, the visual position of the menu item the action is bound to, and a shortcut for invoking the action.
In this case `SimplePopDialogAction` would be available in the **Tools Menu**, it would be placed on top, and would have no shortcuts.

![New Action](img/new_action.png)

In this example, after completing the **New Action** form and applying the changes, the `<actions>` section of the plugin's `plugins.xml` file
would now contain:

```xml
<actions>
    <!-- Add your actions here -->
    <action id="org.jetbrains.tutorials.actions.SimplePopDialogAction"
            class="org.jetbrains.tutorials.actions.SimplePopDialogAction" text="Simple Action"
            description="IntelliJ Action System Demo">
      <add-to-group group-id="ToolsMenu" anchor="first"/>
    </action>
</actions>
```
This declaration is adequate, but as we'll see in the next section there are more elements that can be added to the declaration.

### 1.4. Setting attributes manually

You can configure additional attributes of the action by adding them to the **New Action** form or by editing its registration in the plugin.xml file.
Please refer to the [Action System documentation](../../basics/action_system.md#registering-actions) for the full list
of supported attributes.

The `<action>` declaration for `SimplePopDialogAction` in the register_actions
[plugin.xml](https://github.com/JetBrains/intellij-sdk-docs/blob/master/code_samples/register_actions/resources/META-INF/plugin.xml)
file actually contains elements for `<keyboard-shortcut>` and `<mouse-shortcut>`. The full declaration is:

```xml
<action id="org.jetbrains.tutorials.actions.SimpleAction" class="org.jetbrains.tutorials.actions.SimplePopDialogAction"
        text="Simple Action" description="IntelliJ Action System Demo">
  <keyboard-shortcut first-keystroke="control alt A" second-keystroke="C" keymap="$default"/>
  <mouse-shortcut keystroke="control button3 doubleClick" keymap="$default"/>
  <add-to-group group-id="ToolsMenu" anchor="first"/>
</action>
```
The [plugin.xml](https://github.com/JetBrains/intellij-sdk-docs/blob/master/code_samples/register_actions/resources/META-INF/plugin.xml)
file contains copious comments about the declaration.

After performing the steps described above we need to compile and run the plugin to the newly created action available as a Tools Menu item:

!["Register action" quick fix](img/tools_menu_item_action.png)

### 1.5. Performing an action

In order to make the action do something we need to add code to the `SimplePopDialoigAction.actionPerformed(AnActionEvent)` method.
The following code gets information from the `anActionEvent` input parameter and constructs a simple message dialog.
A generic icon, and the `description` and `text` attributes from the invoking menu action are displayed.

For demonstration purposes the `AnActionEvent.getData()` method tests if a [Navigatable](upsource:///platform/core-api/src/com/intellij/pom/Navigatable.java)
object is available, meaning e.g. an element has been selected in the editor. If so, information about
the selected element is opportunistically added to the dialog.

```java
@Override
public void actionPerformed(@NotNull AnActionEvent anActionEvent) {
    // Using the event, create and show a dialog
    Project currentProject = anActionEvent.getProject();
    StringBuffer dlgMsg = new StringBuffer(anActionEvent.getPresentation().getText() + " Selected!");
    String dlgTitle = anActionEvent.getPresentation().getDescription();
    // If an element is selected in the editor, add info about it.
    Navigatable nav = anActionEvent.getData(CommonDataKeys.NAVIGATABLE);
    if (nav != null) {
      dlgMsg.append(String.format("\nSelected Element: %s", nav.toString()));
    }
Messages.showMessageDialog(currentProject, dlgMsg.toString(), dlgTitle, Messages.getInformationIcon());
}
```

### 1.6. Setting up an action's visibility and availability

To control the action's visibility and availability we need to override the `AnAction.update(AnActionEvent)` method.
The default implementation of this method does nothing, which means the action is always disabled.
Override this method to provide the ability to dynamically change action's state and(or) presentation depending on the context.

In this example the `SimplePopDialogAction.actionPerformed(AnActionEvent)` method relies on a `Project`
object being available. So the `SimplePopDialogAction.update(AnActionEvent)` method disables
the action for contexts where a`Project` object isn't defined:

```java
@Override
public void update(AnActionEvent anActionEvent) {
    // Set the availability based on whether a project is open
    Project project = anActionEvent.getProject();
    anActionEvent.getPresentation().setEnabledAndVisible(project != null);
}
```

Parameter `anActionEvent` carries information on the invocation place and data available. Note the `update()` method does
not check to see if a [Navigatable](upsource:///platform/core-api/src/com/intellij/pom/Navigatable.java) object is available
before enabling `SimplePopDialogAction`. This is done for the purposes of demonstration code.

**Note** This method can be called frequently: for instance, if an action is added to a toolbar, it will be updated twice a second.
This means that this method is supposed to _work really fast_; no real work should be done at this phase.
For example, checking selection in a tree or a list, is considered valid but working with the file system is not.
If you cannot understand the state of the action fast you should do it in the
[AnActionEvent](upsource:///platform/editor-ui-api/src/com/intellij/openapi/actionSystem/AnActionEvent.java)
method and notify the user that the action cannot be executed if it's the case.

After compiling and running the plugin project and invoking the action, the dialog will pop up:

![Action performed](img/action_performed.png)

repository: salious/intellij-sdk-docs

repo_name: salious/intellij-sdk-docs


text:
---
layout: NotesPage
title: Topology and Smooth Manifolds
permalink: /work_files/research/math/proofs
prevLink: /work_files/research/dl/cv.html
---

<div markdown="1" class = "TOC">
# Table of Contents

  * [Introduction and Definitions](#content1)
  {: .TOC1}
  * [Manifolds](#content2)
  {: .TOC2}
</div>

***
***

## Introduction and Definitions
{: #content1}

1. **Power Sets:**{: style="color: SteelBlue"}{: .bodyContents1 #bodyContents11}
    :   __Lemma:__ the size of the power set of a set of size $$n$$ is $$2^n$$
    :   __Proof:__
        Assume that we n

2. **Topological Space:**{: style="color: SteelBlue"}{: .bodyContents1 #bodyContents12}


text:
---
title: Church Hymnal 1941 - 201-300
metadata:
    description: |
        Church Hymnal 1941 - 201-300
    keywords:  |
        Church Hymnal 1941, adventhymnals, advent hymnals, 201-300
    author: Brian Onang'o
---

#### Advent Hymnals
## Church Hymnal 1941 - 201-300

# Index of Titles
# | Title
-- |-------------
201|[Soon May the Last Glad Song Arise](/church-hymnal/201-300/201-210/Soon-May-the-Last-Glad-Song-Arise)
202|[O What Their Joy Must Be](/church-hymnal/201-300/201-210/O-What-Their-Joy-Must-Be)
203|[The Word Can Make Me Whole](/church-hymnal/201-300/201-210/The-Word-Can-Make-Me-Whole)
204|[Come, Gracious Spirit](/church-hymnal/201-300/201-210/Come,-Gracious-Spirit)
205|[Come, Holy Spirit, Come](/church-hymnal/201-300/201-210/Come,-Holy-Spirit,-Come)
206|[Holy Spirit, Light Divine](/church-hymnal/201-300/201-210/Holy-Spirit,-Light-Divine)
207|[Let Thy Spirit, Blessed Saviour](/church-hymnal/201-300/201-210/Let-Thy-Spirit,-Blessed-Saviour)
208|[Lord, I Hear of Showers of Blessing](/church-hymnal/201-300/201-210/Lord,-I-Hear-of-Showers-of-Blessing)
209|[Come, Holy Spirit](/church-hymnal/201-300/201-210/Come,-Holy-Spirit)
210|[O for That FLame of Living Fire](/church-hymnal/201-300/201-210/O-for-That-FLame-of-Living-Fire)
211|[Holy Spirit, Faithful Guide](/church-hymnal/201-300/211-220/Holy-Spirit,-Faithful-Guide)
212|[Hover O'er Me, Holy Spirit](/church-hymnal/201-300/211-220/Hover-O'er-Me,-Holy-Spirit)
213|[Spirit Divine](/church-hymnal/201-300/211-220/Spirit-Divine)
214|[Our Blessed Redeemer](/church-hymnal/201-300/211-220/Our-Blessed-Redeemer)
215|[Gracious Spirit, Love Divine](/church-hymnal/201-300/211-220/Gracious-Spirit,-Love-Divine)
216|[Holy Spirit, Lamp of Light](/church-hymnal/201-300/211-220/Holy-Spirit,-Lamp-of-Light)
217|[O Word of God Incarnate](/church-hymnal/201-300/211-220/O-Word-of-God-Incarnate)
218|[Break Thou the Bread of Life](/church-hymnal/201-300/211-220/Break-Thou-the-Bread-of-Life)
219|[Holy Bible, Book Divine](/church-hymnal/201-300/211-220/Holy-Bible,-Book-Divine)
220|[I Love the Sacred Book](/church-hymnal/201-300/211-220/I-Love-the-Sacred-Book)
221|[Return, O Wanderer](/church-hymnal/201-300/221-230/Return,-O-Wanderer)
222|[Just as I Am](/church-hymnal/201-300/221-230/Just-as-I-Am)
223|[Come, Ye Disconsolate](/church-hymnal/201-300/221-230/Come,-Ye-Disconsolate)
224|[I Hear Thy Welcome Voice](/church-hymnal/201-300/221-230/I-Hear-Thy-Welcome-Voice)
225|[I Heard the Voice of Jesus Say](/church-hymnal/201-300/221-230/I-Heard-the-Voice-of-Jesus-Say)
226|[I Heard the Voice of Jesus Say_1](/church-hymnal/201-300/221-230/I-Heard-the-Voice-of-Jesus-Say_1)
227|[Behold the Saviour at the Door](/church-hymnal/201-300/221-230/Behold-the-Saviour-at-the-Door)
228|[Almost Persuaded](/church-hymnal/201-300/221-230/Almost-Persuaded)
229|[Lord, We Come With Hearts Aflame](/church-hymnal/201-300/221-230/Lord,-We-Come-With-Hearts-Aflame)
230|[I Gave My Life for Thee](/church-hymnal/201-300/221-230/I-Gave-My-Life-for-Thee)
231|[O Jesus, Thou Art Standing](/church-hymnal/201-300/231-240/O-Jesus,-Thou-Art-Standing)
232|[Flee as a Bird](/church-hymnal/201-300/231-240/Flee-as-a-Bird)
233|[Jesus, to Thee I Now Can Fly](/church-hymnal/201-300/231-240/Jesus,-to-Thee-I-Now-Can-Fly)
234|[Depth of Mercy!](/church-hymnal/201-300/231-240/Depth-of-Mercy!)
235|[We Stand in Deep Repentance](/church-hymnal/201-300/231-240/We-Stand-in-Deep-Repentance)
236|[Lord, at Thy Feet](/church-hymnal/201-300/231-240/Lord,-at-Thy-Feet)
237|[Jesus, Full of All Compassion](/church-hymnal/201-300/231-240/Jesus,-Full-of-All-Compassion)
238|[Chief of Sinners](/church-hymnal/201-300/231-240/Chief-of-Sinners)
239|[Low at Thy Pierced Feet](/church-hymnal/201-300/231-240/Low-at-Thy-Pierced-Feet)
240|[Show Pity, Lord](/church-hymnal/201-300/231-240/Show-Pity,-Lord)
241|[From Every Stormy Wind](/church-hymnal/201-300/241-250/From-Every-Stormy-Wind)
242|['Tis by the Faith of Joys](/church-hymnal/201-300/241-250/'Tis-by-the-Faith-of-Joys)
243|[Come, O Thou Traveler ](/church-hymnal/201-300/241-250/Come,-O-Thou-Traveler-)
244|[O Could Our Thoughts](/church-hymnal/201-300/241-250/O-Could-Our-Thoughts)
245|[O for a Faith](/church-hymnal/201-300/241-250/O-for-a-Faith)
246|[My Faith Looks Up to Thee](/church-hymnal/201-300/241-250/My-Faith-Looks-Up-to-Thee)
247|[Toil On a Little Longer](/church-hymnal/201-300/241-250/Toil-On-a-Little-Longer)
248|['Tis My Happiness Below](/church-hymnal/201-300/241-250/'Tis-My-Happiness-Below)
249|[If Through Unruffled Seas](/church-hymnal/201-300/241-250/If-Through-Unruffled-Seas)
250|[When, My Saviour, Shall I Be](/church-hymnal/201-300/241-250/When,-My-Saviour,-Shall-I-Be)
251|[I Ask Not, Lord, for Less](/church-hymnal/201-300/251-260/I-Ask-Not,-Lord,-for-Less)
252|[My Spirit on Thy Care](/church-hymnal/201-300/251-260/My-Spirit-on-Thy-Care)
253|[The Tempter to My Soul](/church-hymnal/201-300/251-260/The-Tempter-to-My-Soul)
254|[Sometimes a Light Surprises](/church-hymnal/201-300/251-260/Sometimes-a-Light-Surprises)
255|[How Firm a Foundation](/church-hymnal/201-300/251-260/How-Firm-a-Foundation)
256|[I Am Trusting Thee](/church-hymnal/201-300/251-260/I-Am-Trusting-Thee)
257|[Call Jehovah Thy Salvation](/church-hymnal/201-300/251-260/Call-Jehovah-Thy-Salvation)
258|[I Need Thee Every Hour](/church-hymnal/201-300/251-260/I-Need-Thee-Every-Hour)
259|[All the Way](/church-hymnal/201-300/251-260/All-the-Way)
260|[The Lord's My Shepherd](/church-hymnal/201-300/251-260/The-Lord's-My-Shepherd)
261|[A Mighty Fortress](/church-hymnal/201-300/261-270/A-Mighty-Fortress)
262|[Lord of Our Life](/church-hymnal/201-300/261-270/Lord-of-Our-Life)
263|[Courage, Brother](/church-hymnal/201-300/261-270/Courage,-Brother)
264|[To Thee, O Dear Saviour](/church-hymnal/201-300/261-270/To-Thee,-O-Dear-Saviour)
265|[My Life Flows On](/church-hymnal/201-300/261-270/My-Life-Flows-On)
266|[I Will Follow Thee](/church-hymnal/201-300/261-270/I-Will-Follow-Thee)
267|[Jesus, I My Cross Have Taken](/church-hymnal/201-300/261-270/Jesus,-I-My-Cross-Have-Taken)
268|[Blessed Jesus, Meek and Lowly](/church-hymnal/201-300/261-270/Blessed-Jesus,-Meek-and-Lowly)
269|[Take My Heart, O Father](/church-hymnal/201-300/261-270/Take-My-Heart,-O-Father)
270|[Give Thy Youth to God](/church-hymnal/201-300/261-270/Give-Thy-Youth-to-God)
271|[Not I, but Christ](/church-hymnal/201-300/271-280/Not-I,-but-Christ)
272|[Have Thine Own Way, Lord](/church-hymnal/201-300/271-280/Have-Thine-Own-Way,-Lord)
273|[Take My Life and Let It Be](/church-hymnal/201-300/271-280/Take-My-Life-and-Let-It-Be)
274|[Must Jesus Bear the Cross Alone?](/church-hymnal/201-300/271-280/Must-Jesus-Bear-the-Cross-Alone)
275|[Deeper Yet](/church-hymnal/201-300/271-280/Deeper-Yet)
276|[My Jesus, I Love Thee](/church-hymnal/201-300/271-280/My-Jesus,-I-Love-Thee)
277|[Fade, Fade Each Earthly Joy](/church-hymnal/201-300/271-280/Fade,-Fade-Each-Earthly-Joy)
278|[I Lay My Sins on Jesus](/church-hymnal/201-300/271-280/I-Lay-My-Sins-on-Jesus)
279|[Live Out Thy Life Within Me](/church-hymnal/201-300/271-280/Live-Out-Thy-Life-Within-Me)
280|[Beneath the Cross of Jesus](/church-hymnal/201-300/271-280/Beneath-the-Cross-of-Jesus)
281|[There Lives a Voice Within Me](/church-hymnal/201-300/281-290/There-Lives-a-Voice-Within-Me)
282|[Thine Forever](/church-hymnal/201-300/281-290/Thine-Forever)
283|[Saviour! Thy Dying Love](/church-hymnal/201-300/281-290/Saviour!-Thy-Dying-Love)
284|[Make Me a Captive, Lord](/church-hymnal/201-300/281-290/Make-Me-a-Captive,-Lord)
285|[I Give My Heart to Thee](/church-hymnal/201-300/281-290/I-Give-My-Heart-to-Thee)
286|[I Come to Thee, O Father](/church-hymnal/201-300/281-290/I-Come-to-Thee,-O-Father)
287|[Saviour, Blessed Saviour](/church-hymnal/201-300/281-290/Saviour,-Blessed-Saviour)
288|[O Jesus, I Have Promised](/church-hymnal/201-300/281-290/O-Jesus,-I-Have-Promised)
289|[Weary of Earth](/church-hymnal/201-300/281-290/Weary-of-Earth)
290|[O Lamb of God! Still Keep Me](/church-hymnal/201-300/281-290/O-Lamb-of-God!-Still-Keep-Me)
291|[Come, Thou Fount of Every Blessing](/church-hymnal/201-300/291-300/Come,-Thou-Fount-of-Every-Blessing)
292|[O How Happy Are They](/church-hymnal/201-300/291-300/O-How-Happy-Are-They)
293|[Awake! Jerusalem, Awake!](/church-hymnal/201-300/291-300/Awake!-Jerusalem,-Awake!)
294|[Lift Up Your Heads](/church-hymnal/201-300/291-300/Lift-Up-Your-Heads)
295|[Amazing Grace](/church-hymnal/201-300/291-300/Amazing-Grace)
296|[We Sing the Praise](/church-hymnal/201-300/291-300/We-Sing-the-Praise)
297|[Let Heaven Highest Praises Bring](/church-hymnal/201-300/291-300/Let-Heaven-Highest-Praises-Bring)
298|[Hark, My Soul! It Is the Lord](/church-hymnal/201-300/291-300/Hark,-My-Soul!-It-Is-the-Lord)
299|[There Is a Land of Pure Delight](/church-hymnal/201-300/291-300/There-Is-a-Land-of-Pure-Delight)
300|[Jerusalem the Golden](/church-hymnal/201-300/291-300/Jerusalem-the-Golden)

repository: GospelSounders/adventhymnals

repo_name: GospelSounders/adventhymnals


text:
# printf

This library provides a single method that takes a format string and arg list
that would be used in functions like printf and returns a formatted string. It
is expected that the arg list be created in *C* code using `va_start`.

I created this lib specifically to help in wrapping c libraries that expect
printf-style function callbacks.

repository: jameslzhu/alpm

gha_language: Rust

gha_license_id: NOASSERTION

repo_name: jameslzhu/alpm


text:
# go-cache
Library for caching

## Usage
```go
package main

import "github.com/tico8/go-cache"

func main() {
  opt := cache.Option{
    ThresholdAccess: 0,
    ThresholdAccessCount: 0,
  }
  c := cache.New(opt)

  key := "testKey"
  value := "testValue"

  c.Set(key, value, time.Duration(10)) // expiration is 10 sec (default is 1 hour)
  resultValue, found := c.Get(key)
  c.Del(key)
}
```

## Option
* ThresholdSize
Total size of cache
* ThresholdAccess
If it is accessed within N seconds, priority +1
* ThresholdAccessCount
If it is accessed more than N times, priority +1

## Optimizing of cache
If the size of cache is greater than the ThresholdSize value, it is possible to optimize caching .
Lower priority cache is deleted by optimizer.
```go
package main

import "github.com/tico8/go-cache"

func main() {
  opt := cache.Option{
    ThresholdAccess:<PHONE_NUMBER>, // 1 sec
    ThresholdAccessCount: 100, // 100 times
  }
  c := cache.New(opt)

  // Manually
  c.Optimize()

  // Executed in the 10 second intervals
  c.RunOptimizer(10)

  // Stop
  c.StopOptimizer()
}
```