text:
# Changelog

## Unreleased

## 0.9.1 - 2020-10-07

- API
    - BREAKING CHANGE: SpanId, TraceId and TraceFlags are no longer used as instances, but only contain helper methods for managing conversion between Strings, bytes and other formats. SpanId and TraceId are now natively String-typed, and the TraceFlags is a single byte.
    - BREAKING CHANGE: Propagators now only expose a singleton instance.
    - BREAKING CHANGE: The LabelConsumer and AttributeConsumer are now first-class interfaces, and the underlying consumer interface has had the key made additionally generic. Please prefer using the specific interfaces, rather than the underlying `ReadableKeyValuePairs.KeyValueConsumer`.
    - BREAKING CHANGE: Minimum JDK version has been updated to 8, with Android API level 24.
    - BREAKING CHANGE: Metric Instrument names are now case-insensitive.
    - BREAKING CHANGE: The type-safety on Attributes has been moved to a new AttributeKey, and the AttributeValue wrappers have been removed. This impacts all the semantic attribute definitions, and the various APIs that use Attributes.
    - BREAKING CHANGE: The obsolete HTTP_STATUS_TEXT semantic attribute has been removed.
    - BREAKING CHANGE: The type of the REDIS_DATABASE_INDEX semantic attribute has been changed to be numeric.
    - BREAKING CHANGE: Constant Labels have been removed from metric Instrument definitions.
    - BREAKING CHANGE: The number of available Span Status options has been greatly reduced (from 16 to 3).
    - BREAKING CHANGE: Constant labels have been removed from metric Instrument definitions.
    - BREAKING CHANGE: The only way to specify span parenting is via a parent Context
    - BREAKING CHANGE: The default TextMapPropagator is now a no-op in the API
    - BREAKING CHANGE: CorrelationContext has been renamed to Baggage
    - BREAKING CHANGE: Null-valued span attribute behavior has been changed to being "unspecified".
    - BREAKING CHANGE: Link and Event interfaces have been removed from the API
    - BREAKING CHANGE: The Status object has been removed from the API, in favor of StatusCanonicalCode
    - BUGFIX: the `noParent` option on a Span was being ignored if it was set after setting an explicit parent.
    - BUGFIX: Attributes and Labels now preserve the latest added entry when an existing key has been used.
    - BUGFIX: Updated some of the W3C traceparent validation logic to better match the spec.
    - FaaS semantic attributes have been added
    - Semantic attribute for "exception.escaped" added

- SDK
    - BREAKING CHANGE: The names of the Sampler.Decision enum values, returned by the Sampler interface, have changed.
    - `OpenTelemetrySdk.forceFlush()` now returns a CompletableResultCode
    - BREAKING CHANGE: The `ProbabilitySampler` has been renamed to `TraceIdRatioBased`
    - BREAKING CHANGE: The environment variables/system properties for specifying exporter and span processor configuration have been updated to match the specification.
    - BREAKING CHANGE: Exported zipkin attributes have been changed to match the specification.
    - BREAKING CHANGE: Metric Descriptor attributes have been flattened into the MetricData for export.
    - BREAKING CHANGE: The OpenTelemetrySdk class now returns a TraceSdkManagement interface, rather than the concrete TracerSdkProvider.
    - BUGFIX: Zipkin span durations are now rounded up to 1 microsecond, if less than 1.
    - BUGFIX: The insecure option for OTLP export now does the correct thing.
    - Added a configuration option for disabling SPI-provided ResourceProviders
    - New incubator module with helper classes for working with SpanData
    - AWS resources now include the `cloud.provider` attribute.

- Extensions
    - BREAKING CHANGE: Propagators now only expose a singleton instance.
    - The auto-config extension has been moved to the instrumentation project.
    - New incubator module with some utilities for mutating SpanData instances.
    - The AWS Resource extension will now pull in EKS Resource attributes.
    - New pre-release extension for handling logging natively.

Many thanks to all who made this release possible:

@bogdandrutu @Oberon00 @jkwatson @thisthat @anuraaga @jarebudev @malafeev @quijote @JasonXZLiu @zoercai @eunice98k @dengliming @breedx-nr @iNikem @wangzlei @imavroukakis

## 0.8.0 - 2020-09-01

- Extensions:
    - Updated metrics generated by the runtime_metrics module to match the proposed semantic conventions.
- API:
    - BREAKING CHANGE: Renamed HttpTextFormat to TextMapPropagator
    - Added a toBuilder method to the Attributes class
    - Added method to create an Attributes Builder from ReadableAttributes
    - Updates to the Attributes' null-handling to conform to the specification
    - TraceState validations were updated to match the W3C specification
    - recordException Span API now has an additional overload to support additional attributes
- SDK:
    - BUGFIX: Bound instruments with no recordings no longer generate data points.
    - BREAKING CHANGE: The Exporter interfaces have changed to be async-friendly.
    - BREAKING CHANGE: The parent context passed to the Sampler will no longer be nullable, but instead an invalid context will be passed.
    - BREAKING CHANGE: The SpanProcessor now takes a ReadWriteSpan for the onStart method
    - BREAKING CHANGE: ResourceConstants changed to ResourceAttributes
    - BREAKING CHANGE: ParentOrElse Sampler changed to be called ParentBased
    - Default Resource include the SDK attributes
    - ResourceProvider SPI to enable custom Resource providers
    - The individual pieces of the SDK are not published as individual components, in addition to the whole SDK artifact.
    - Zipkin and Jaeger exporters now include the InstrumentationLibraryInfo attributes.
    - The OTLP protobufs were updated to version 0.5.0 and the OTLP exporters were updated accordingly.

- Many thanks for contributions from @anuraaga, @dengliming, @iNikem, @huntc, @jarebudev, @MitchellDumovic, @wtyanan, @williamhu99, @Oberon00, @thisthat, @malafeev, @mateuszrzeszutek, @kenfinnigan

## 0.7.1 - 2020-08-14

- BUGFIX: OTLP Span Exporter: fix splitting metadata key-value substring with more than one '=' sign

## 0.7.0 - 2020-08-02

NOTE: This release contains non-backward-compatible breaking SDK changes

- Added an InMemoryMetricExporter
- Added a toBuilder method to Labels
- Added some semantic attribute constants
- New ZPages extension module with TraceZ and TraceConfigZ pages implemented
- Some overloads added for setting the parent Context
- Some performance improvements in HttpTraceContext implementation
- Removed null checks from the Trace APIs
- The bare API will no longer generate Trace and Span IDs when there is no parent trace context.
- Null Strings are no longer valid keys for Attributes
- BREAKING CHANGE: The Sampler API was changed
- Default endpoint is now set for the OTLP exporters
- BREAKING CHANGE: Jaeger exporter env vars/system properties were updated
- Resource attributes may now be set with a System Property as well as the environment variable.
- Added a propagator for Lightstep OpenTracing propagator
- The ZipkinSpanExporter now defaults to using the OkHttpSender
- The default Sampler in the SDK is now the ParentOrElse sampler
- BUGFIX: SpanWrapper SpanData implementation is now truly Immutable
- Added some simple logging for failed export calls
- Quieted the noisy B3 propagator
- Public constants were added for exporter configuration options
- Added a new configuration option to limit the size of Span attributes
- Many thanks for contributions from @anuraaga, @dengliming, @iNikem, @wtyanan, @williamhu99, @trask, @Oberon00, @MitchellDumovic, @FrankSpitulski, @heyams, @ptravers, @thisthat, @albertteoh, @evantorrie, @neeraj97,

## 0.6.0 - 2020-07-01

NOTE: This release contains non-backward-compatible breaking API and SDK changes

- Introduction of immutable Attributes for SpansEvents, Links and Resources
- Introduction of immutable Labels for Metric Instruments and Recordings
- BUGFIX: make sure null Points are not propagated to metric exporters
- Added a propagator for AWS X-Ray
- BUGFIX: IntervalMetricReader now handles exceptions thrown by metric exporters
- Renamed contrib modules to "extensions" (Note: this changes the published artifact names, as well)
- Converted CorrelationContext entry keys and values to simple Strings
- Enhanced OTLP exporter configuration options
- Added new SDK Telemetry Resource populator
- Introduced an new MultiTracePropagator to handle multiple propagation formats
- Added new AWS Resource populators
- Added an extension to populate span data into log4j2 log formats.
- Changed the MinMaxSumCount aggregations for ValueRecorders to always aggregate deltas, rather than cumulative
- Updated the OTLP protobuf and exporter to version 0.4.0 of the OTLP protobufs.

## 0.5.0 - 2020-06-04

TODO: fill this out

- Add helper API to get Tracer/Meter

## 0.4.0 - 2020-05-04
- Initial implementation of the Zipkin exporter.
- **Breaking change:** Move B3 propagator to a contrib package
- Add support for Jaeger propagator
- Start implementing support for configuring exporters using Config pattern with support to load from environment variables and system properties.
- Add support to flush the entire SDK processors and exporter pipelines.
- Mark all threads/pools as daemon.
- Add support for Jaeger remote sampler.

## 0.3.0 - 2020-03-27
- Initial Java API and SDK for context, trace, metrics, resource.
- Initial implementation of the Jaeger exporter.
- Initial implementation of the OTLP exporters for trace and metrics.


text:
# Debeasy

A really easy way to read the properties of a Debian/Ubuntu (DEB format)
package file. In this way, it's the Debian/Ubuntu companion to
[jordansissel's arr-pm gem](https://github.com/jordansissel/ruby-arr-pm).

## Usage

    require 'debeasy'
    pkg = Debeasy.read("/path/to/package.deb")
    puts pkg.architecture
    => x86_64

All the attributes are the same ones you'd get from `aptitude show`, except
for the purposes of access hyphens (`-`) get replaced with underscores (`_`),
and everything is lowercased.

To see the available fields on a package, do:

    require 'debeasy'
    pkg = Debeasy.read("/path/to/package.deb")
    puts pkg.fields

You can read a field either by calling the method with the field name,
or by using hash access syntax:

    # Equivalent
    pkg.installed_size
    pkg["installed_size"]

You can also read the preinst, prerm, postinst, and postrm scripts
from the package:

    pkg.preinst_contents
    pkg.prerm_contents
    pkg.postinst_contents
    pkg.postrm_contents

You can read the entire filelist of a package:

    pkg.filelist

## Installation

Add this line to your application's Gemfile:

    gem 'debeasy'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install debeasy

## Installation on Mac OS X

You may (read: will) run into problems getting the `libarchive` gem to
install on Mac OS X. The way to fix this seems to be to tell `bundler` to
supply an option to the `libarchive` build process so it can find `libarchive.h`.

First install libarchive with brew:

    brew install libarchive

Now configure `bundler`:

    bundle config build.libarchive "--with-opt-dir=/usr/local/opt/libarchive"

Now do `bundle install` as normal.

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

license: MIT

repository: andytinycat/debeasy

branch_name: refs/heads/master

extension: md

gha_language: Ruby

license_type: permissive

repo_name: andytinycat/debeasy


text:
### [CVE-2017-16945](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-16945)
![](https://img.shields.io/static/v1?label=Product&message=n%2Fa&color=blue)
![](https://img.shields.io/static/v1?label=Version&message=n%2Fa&color=blue)
![](https://img.shields.io/static/v1?label=Vulnerability&message=n%2Fa&color=brighgreen)

### Description

The standardrestorer binary in Arq 5.10 and earlier for Mac allows local users to write to arbitrary files and consequently gain root privileges via a crafted restore path.

### POC

#### Reference
- http://packetstormsecurity.com/files/146159/Arq-5.10-Local-Privilege-Escalation.html
- https://m4.rkw.io/blog/two-local-root-privesc-bugs-in-arq-backup--510.html
- https://www.exploit-db.com/exploits/43926/

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

repository: trickest/cve

branch_name: refs/heads/main

gha_language: HTML

gha_license_id: MIT

repo_name: trickest/cve


text:
# Platzigram

Platzigram built on the basis of the django course is made in Django with html templates applying all the concepts made in the course.

## Installation

Clone the Github project:

1.-git clone --> [git@github.com:streadier-dev/django-project.git]

2.-Install [Python3](https://www.python.org/ftp/python/3.8.2/python-3.8.2.exe)

3.-Activate the environment with the following command
```bash
source .venv/Scripts/activate
```
4.-Install Django:
```bash
pip install django
```
5.-Install dependency Pillow:
```bash
pip install Pillow
```
## License
[MIT](https://choosealicense.com/licenses/mit/)

repository: streadier-dev/django-project

repo_name: streadier-dev/django-project


text:
# GLU-MachineLearning
An example using ml5.js and p5.js for beginners.

to run example, terminal command:

node index

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

An experiment using simple technology.

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

Artificial intelligence (AI)
Machine Learning (ML)
Deep Learning (DL)

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

Machine learning is an application of artificial intelligence (AI) that provides systems the ability to automatically learn and improve from experience without being explicitly programmed.

Machine learning focuses on the development of computer programs that can access data and use it to learn for themselves.

The process of learning begins with observations or data, such as examples, direct experience, or instruction, in order to look for patterns in data and make better decisions in the future based on the examples that we provide. The primary aim is to allow the computers to learn automatically without human intervention or assistance and adjust actions accordingly.

Supervised Machine Learning algorithms
Unsupervised Machine Learning algorithms
Semi-supervised Machine Learning algorithms
Reinforcement machine learning algorithms

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

This example makes use of ml5.js and p5.js (and tf.js)

p5.js (processing) is a JavaScript library for creative coding, with a focus on making coding accessible and inclusive.
ml5.js (machine learning) is a JavaScript library that provides access to machine learning algorithms and models in the browser, building on top of TensorFlow.js with no other external dependencies.
tf.js (tensorflow) is a JavaScript library for training and deploying models in the browser and on Node.js.

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

Machine learning algorithms:

Neural Network
Models (pretrained)
Data sets

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

Linear regression

Mobile.net

repository: martijnkunstman/GLU-MachineLearning

gha_language: JavaScript

repo_name: martijnkunstman/GLU-MachineLearning


text:
# CePopulationGenetics-nf
archive of Stefan Z. CePopulationGenetics-nf repo with Tim C. edits

### Script versions
Two nextflow scripts are present in the repo.
- **cepopgen-nf.nf** is the original script.
- **cepopgen_TAC.nf** is the edited script.
    - The pruned VCF used to perform the PCA is now output into `EIGESTRAT/INPUTFILES/PCA.vcf.gz`
    - The `eigenstrat_input.pedsnp` file now contains the correct snps.

### Usage notes
As of 20210801 only the PCA profile is recommended. To compare version outputs, run command with different `.nf` scripts.
```
nextflow run cepopgen_TAC.nf --out_base=163_PCA_0.1_hawaii_TAC --anc=XZ1516 --snv_vcf=../../Tim/Hawaii_popgen/20210120_Tim_Hawaii/popgen-20210120/WI.20210121.hard-filter.ref_strain_SNPs_only_fixup.vcf.gz -profile pca --pops=input_files/WI_20210121_163_Hawaii.tsv --eigen_ld=0.1
```

repository: AndersenLab/CePopulationGenetics-nf

repo_name: AndersenLab/CePopulationGenetics-nf


text:
[Chickenpox](http://www.nhs.uk/conditions/chickenpox/Pages/Introduction.aspx)
causes red spots that turn to blisters. They can be itchy. They eventually scab
and fall off. Some children have a few spots, while others have them all over
their body.

### Blisters on hands and feet and in the mouth

repository: nhsuk/betahealth

branch_name: refs/heads/develop

repo_name: nhsuk/betahealth


text:
---
layout: post
title:  "Vulnhub - tr0ll"
date:   2017-04-11 16:00:00 +0100
categories: vulnhub tr0ll
image:
  feature: troll.jpg
  credit:
  creditlink:
---

This details my attempts at breaking into the [tr0ll VM](https://www.vulnhub.com/entry/tr0ll-1,100/) from Vulnhub.

Having never attempted any VM's like this before I resolved to do a cursory read over the solution before actually attempting as otherwise I knew I was going to get stuck very fast.  After some reading I decided this would be a good first try and decided to attempt it a week later when most of the solution had left my head.  However, a large number of the gotchas I still remember when attempting this box.

Firstly, I installed a Kali VM and a copy of the tr0ll VM and set both on the VMWare Host Only network.  This ensures that both are assigned ip addresses.

So that became the first step. I needed to find the ip address to connect to.  For this I used the arp-scan command which gave me a list of all ip's on the network.

![We got ya!](/assets/images/tr0ll/1.png)

So .129 is going to the be the IP of our target machine.  Okay we've done that but where do we go from here?  Well might as well see if it has a web page.  Let's check out if we get anything over http.

![Haha...very funny](/assets/images/tr0ll/2.png)

So, realising that was a dead end I opened up nmap and set it to scan.  Nmap's been a staple in pretty much every course I've attended over the last few months and I'm always shocked at the amount of information it can uncover.  Even though it's only three services, the amount of info kinda blows my mind.

![The Keys to the Kingdom](/assets/images/tr0ll/3.png)

Well there's a robot.txt exposed pretty immediately, with the /secret web directory exposed.  So lets have a look in there.

![Yes](/assets/images/tr0ll/5.png)

Hilarious!  Well, one other exposed service is ftp which allows anonymous access.  I hadn't heard much about this before so tried anonymous:anonymous which worked, but reading into it more fully apparently pretty much anything works here.

![Going Deeper](/assets/images/tr0ll/6.png)

All that the ftp directory exposed was a file called lol.pcap, so I downloaded that and fired up wireshark.  All that followed was idle browsing through the packets which appeared to be exposing the details of a directory, but the most interesting part came up around packet 40, with a long string of text.  This was one of the longer packets by far so popped out almost instantly.

![Going Harder](/assets/images/tr0ll/7.png)

So not much of interest except sup3rs3cr3tdirlol.  I'd love to say I realised this was a web directory immediately but I did remember that in a previous walkthrough this VM had an annoying habit of directing you to a variety of web pages, so I popped this into the web browser and lo and behold.

![Going Stronger](/assets/images/tr0ll/8.png)

All we have in here is an executable roflmao, which I downloaded to my Kali VM, tried to run before seeing 'Permission denied'.  I know I could just edit the permissions manually quite easily but not really remembering how to do that and not wanting to google, I decided to just open it in a text editor.

![Parting the red sea](/assets/images/tr0ll/9.png)

And here we have the next piece of the puzzle.  'Find address 0x0856BF to continue'.  Remembering the whole part about the crazy web directories I popped that one in my web browser.

![Am I 1337 now!?](/assets/images/tr0ll/10.png)

I forgot to screenshot this but the folder 'this_folder_contains_the_password' has a file called 'Pass.txt' with one string in it, and the good_luck folder contains a 'which_one_lol.txt' file with a list of users.

![I...actually believe you](/assets/images/tr0ll/11.png)

Full disclosure, I knew from before that 'Pass.txt' itself was the password so didn't waste a lot of time here but I know if I hadn't I would've been stuck here for a very long time.  Knowing that I loaded up hydra and tried to brute force the ssh credentials, because what else were these going to be.  There's one service still enabled and it feels like it flows well narratively.

Long story short I couldn't get Hydra working but after googling around, I found out about a similar tool called medusa.  Passing in the list of users and 'Pass.txt' as the password I got the credentials.  overflow:Pass.txt

![More of a script kiddie!](/assets/images/tr0ll/12.png)

And with that I logged in via ssh, got root access and lived happily ever after.  I almost wish it was that easy.

!['So are you MSDOSing them?' - REDACTED 2017](/assets/images/tr0ll/13.png)

And we're in!  The next few minutes were just spent poking around trying to find something interesting until I found an interesting little python file.

![  Turns out we can ssh back in just fine but get booted off every 5 minutes.  In the end not a major showblocker but this became very frustrating as time went on.

I wanted to find out what was booting me off so I went for a bit of a search in the logs in /var/log.  If I'd been more knowledgeable about what I was looking for this would've been faster but eventually I found a reference to another python file.

![oh nooo](/assets/images/tr0ll/16.png)

It seems to be referencing a cron job so I wondered if that was what was booting me off.  First things first, I had to find the file.

![Permission Denied](/assets/images/tr0ll/17.png)

Knowing where it was, we had to check to make sure we could actually edit it and lo and behold, it's owned by root but I seem to be able to edit this.

![Spread open](/assets/images/tr0ll/18.png)

At this point I remembered that this must be the script that some other walkthrough edited to run as root.  Because if this is run as root in the cron job then I can use it elevate my permission

![Sysadmin's hate him!](/assets/images/tr0ll/19.png)

This didn't work for ages...and I'm sure you can see why.

After a long time debugging and trying a variety of different commands I googled the answer.  I forgot sudo.  I felt quite thick right here but prepended sudo to the command and waited for the box to root itself.  After a few minutes, I was booted again and...

![  I popped into /root and grabbed my proof

![FeelsGoodMan](/assets/images/tr0ll/21.png)

This was pretty enjoyable but I was definitely helped by knowing many of the major issues beforehand. I look forward to trying different VM's over the coming weeks and honing my skills.


text:
## [1.2.0](https://github.com/mixmaxhq/git-hooks/compare/v1.1.1...v1.2.0) (2020-12-03)

### Features

* make this module public ([ad3a6db](https://github.com/mixmaxhq/git-hooks/commit/ad3a6db042903078c1765fd3afa03d3c7f704296))

### [1.1.1](https://github.com/mixmaxhq/git-hooks/compare/v1.1.0...v1.1.1) (2020-07-10)

### Bug Fixes

* **commit-msg:** use correct name for command invocation ([183eac4](https://github.com/mixmaxhq/git-hooks/commit/183eac441bd29fa35c482dcf97d801a3cc7d6fa2))

## [1.1.0](https://github.com/mixmaxhq/git-hooks/compare/v1.0.1...v1.1.0) (2020-02-19)

### Features

* add info to help recover commit message ([907a7e8](https://github.com/mixmaxhq/git-hooks/commit/907a7e859da97a2b360807ecacca2525aa87ce07))

### Bug Fixes

* correctly re-throw unknown exceptions ([67bf6f2](https://github.com/mixmaxhq/git-hooks/commit/67bf6f213e80d225a4f35c502cffa68b80cec517))
* handle missing symbolic ref ([#12](https://github.com/mixmaxhq/git-hooks/issues/12)) ([eb41e80](https://github.com/mixmaxhq/git-hooks/commit/eb41e80c3155727101f29e1a1fa8050c53c8b320))

### [1.0.1](https://github.com/mixmaxhq/git-hooks/compare/v1.0.0...v1.0.1) (2020-02-01)

### Bug Fixes

* handle missing configuration ([4f3051d](https://github.com/mixmaxhq/git-hooks/commit/4f3051d22e140d2eb0a78709ba4b0f7cb803b7ea))

## 1.0.0 (2020-01-31)

### Features

* initial release ([#6](https://github.com/mixmaxhq/git-hooks/issues/6)) ([7e62282](https://github.com/mixmaxhq/git-hooks/commit/7e622828722a89352b0449796d567ed66b91b296))

repository: erik-krogh/git-hooks

repo_name: erik-krogh/git-hooks


text:
scheduler
=========

This application currently uses SQLite, which requires no setup. It uses
factory_girl, minitest-spec-rails, and guard for automated testing.

`rake db:setup` should create the database and seed it using `db/seeds.rb`,
which will add two vendors, several activities and schedules. Faker could also
be used, but hasn't been added.

API Documentation
-----------------

### Vendors actions

To get Vendors:

GET "/vendors", the response will be

    { "vendors": [ list_of_vendors ] }

To show a Vendor:

GET "/vendors/123/show", the response will be

    { "vendor": [{"id": 123,
    "name": "Joe the Surf Instructor" }]}

Create a Vendor:

POST to "/vendors" with

    { "vendor": { "name": "Dana" } }

  The response will be a serialized vendor if successful or errors if not.

### Activities actions

Creating an activity requires an admin namespace.

POST to "/admin/activities" with

    { "activity": { "name": "Surfing" }}

To get Activities:

GET "/activities?date\_start=2014-01-01&date\_end=2014-01-31" to get all
activities in the month of January.

The response will look like:

    {"activities"=>[{"id"=>1, "name"=>"Surfing Lesson",
     "schedules"=>[{"id"=>1, "date"=>"2014-01-15", "time_start"=>"2000-01-01T20:00:00Z",
     "time_end"=>"2000-01-01T20:00:00Z", "quantity"=>8, "activity_id"=>1, "reserved"=>0,
     "sold_out"=>false, "available"=>true}]}]}

GET "/activities" alone will return all activities.

### Schedules actions

Admin Tasks:

Creating a schedule:

    POST to "/admin/schedules" with params["schedule"] object that has
    the date, time_start, time_end, quantity, activity_id, and price.

To make a schedule unavailable:

    PATCH to "/admin/schedules/123/change_availability"
    with {"schedule": { "available": false" }}

The `change_availability` action will only accept available as the permitted
parameter.

User tasks

To get Schedules for an activity:

    GET "/activities/123/schedules"

To obtain a schedule information (the nesting is shallow, there is always
   one unique schedule so we don't need to have the activity\_id, but we do
   include the activity information):

    GET "/schedules/123"

Sometimes a schedule is not available, but can be viewed. To know whether
   it is available or not, check `response["schedule"]["available"]`.

### Creating a booking

To create a Booking:

POST to "/bookings" with

    { booking: { schedule_id: 123 },
      travelers: [{ name: "Benjamin" }, { name: "Jonathan" }] }

It will return the booking or a JSON error.

repository: alanjcfs/scheduler

repo_name: alanjcfs/scheduler


text:
# Dungeons and Dragons name generator
The name is pretty self explanatory, I guess. This is a project for generating new
dungeons and dragons character names. I decided that a fun way to do this was to
use an LSTM char-rnn and train it on data from [this site](http://www.dnd.kismetrose.com/).
Don't use keras as much as tensorflow, so writing this was made a lot easier when having
[this project](https://github.com/ekzhang/char-rnn-keras) as a reference.

## Installation
Things you'll need

- Python (should work on any version >=2.7 .... hopefully)

To install run `pip install -r requirements.txt` or `pip3 install -r requirements.txt`

## How to use
In order to run, simply call `python generate.py`

The generator comes with a few extra arguments in order to specify certain constraints you put on generation.

With this generator you can specify three things:
- `--seed` is the starting character(s) you'd like the generator to use when making a name. If you leave this empty, the generator will choose a random capital letter to start every name it generates.
- `--numnames` is the number of names you'd like to generate, if you want to generate a batch.
- `--maxlen` this is the constraint on maximum length of a name. I find it's better not to touch this, but included it as an option anyways.

Here's one more example for using all of the above arguments: `python generate.py --seed J --numnames 10 --maxlen 10`

This sample will make 10 names starting with the letter J and will cut them off at a max of 10 characters long

### Disclaimer
Not all names are guaranteed to be unique at the moment, sorry.


text:
---
layout: post
title:  "Prof. Fu-Guo Xie's colloquium talk 03/03/2022"
date:   2022-03-03
author: Lijing Shao
categories: activities
---

## Prof. Dr. Fu-Guo Xie (SHAO)

#### Hot accretion flow: progress and application

Hot accretion flow is widely believed to be essential for our understanding of low-luminosity AGNs (LLAGNs) and black hole X-ray binaries (BHBs) in their hard (and quiescent) state. In this talk, I will first review the current status of accretion theory. The progresses viewed from fundamental physics perspective are angular momentum transport, turbulent heating mechanism, and outflow/wind; from accretion mode perspective include magnetic-arrested disk (MAD) and high-\dot{M} hot accretion flow. Applications of these progresses in LLAGNs and BHBs will also be addressed. More specificly, I will use both the index-lumonosity correlation and the radio-X-ray correlation as tools to probe the change in accretion mode. I will also discuss the radiative properties (efficiency and SED) of MAD.
[[link](http://kiaa.pku.edu.cn/info/1024/8130.htm)]

**Place**: Zoom Link: https://zoom.us/j/89093214828?pwd=TmxISnBxeG8xV2lEMTVUY1RMbVJCdz09 Meeting ID: 890 9321 4828 Passcode: 033141

**Time**: Thursday, March 3, 2022 - 3:30PM to Thursday, March 3, 2022 - 4:30PM

gha_language: SCSS


text:
![npm](https://img.shields.io/npm/dm/analytics?style=flat-square) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/analytics?style=flat-square) ![GitHub](https://img.shields.io/github/license/davidwells/analytics?style=flat-square)

A lightweight analytics abstraction library for tracking page views, custom events, & identify visitors.

Designed to work with any [third-party analytics tool](https://getanalytics.io/plugins/) or your own backend.

[Read the docs](https://getanalytics.io/) or view the [live demo app](https://analytics-demo.netlify.com)

## Table of Contents

Click to expand

- [Features](#features)
- [Why](#why)
- [Install](#install)
- [Usage](#usage)
- [Demo](#demo)
- [API](#api)
  - [Configuration](#configuration)
  - [analytics.identify](#analyticsidentify)
  - [analytics.track](#analyticstrack)
  - [analytics.page](#analyticspage)
  - [analytics.user](#analyticsuser)
  - [analytics.reset](#analyticsreset)
  - [analytics.ready](#analyticsready)
  - [analytics.on](#analyticson)
  - [analytics.once](#analyticsonce)
  - [analytics.getState](#analyticsgetstate)
  - [analytics.storage](#analyticsstorage)
  - [analytics.storage.getItem](#analyticsstoragegetitem)
  - [analytics.storage.setItem](#analyticsstoragesetitem)
  - [analytics.storage.removeItem](#analyticsstorageremoveitem)
  - [analytics.plugins](#analyticsplugins)
  - [analytics.plugins.enable](#analyticspluginsenable)
  - [analytics.plugins.disable](#analyticspluginsdisable)
- [Events](#events)
- [Analytic plugins](#analytic-plugins)
- [Community Plugins](#community-plugins)
- [Creating analytics plugins](#creating-analytics-plugins)
  - [React to any event](#react-to-any-event)
  - [Custom methods](#custom-methods)
- [Plugin Naming Conventions](#plugin-naming-conventions)
- [Debugging analytics](#debugging-analytics)
- [TypeScript support](#typescript-support)
- [Contributing](#contributing)
- [Setup & Install dependencies](#setup--install-dependencies)
- [Development](#development)

## Features

- [x] [Extendable](#analytic-plugins) - Bring your own third-party tool & plugins
- [x] Test & debug analytics integrations with time travel & offline mode
- [x] Add functionality/modify tracking calls with baked in lifecycle hooks
- [x] Isomorphic. Works in browser & on server
- [x] Queues events to send when analytic libraries are loaded
- [x] Conditionally load third party scripts
- [x] Works offline
- [x] [TypeScript support](https://getanalytics.io/tutorials/typesafe-analytics/)

##  Why

Companies frequently change analytics requirements based on evolving needs. This results in a lot of complexity, maintenance, & extra code when adding/removing analytic services to a site or application.

This library aims to solves that with a simple pluggable abstraction layer.

![how analytics works](https://user-images.githubusercontent.com/532272/68093602-42036880-fe4c-11e9-8bb9-008045da8a32.gif)

**Driving philosophy:**

- You should never be locked into an analytics tool
- DX is paramount. Adding & removing analytic tools from your application should be easy
- Respecting visitor privacy settings & allowing for opt-out mechanisms is crucial
- A pluggable API makes adding new business requests easy

To add or remove an analytics provider, adjust the `plugins` you load into `analytics` during initialization.

## Install

This module is distributed via [npm](https://npmjs.com/package/analytics), which is bundled with [node](https://nodejs.org/) and should be installed as one of your project's dependencies.

```bash
npm install analytics --save
```

Or as a script tag:

```html
<script src="https://unpkg.com/analytics/dist/analytics.min.js"></script>
```

## Usage

```js
import Analytics from 'analytics'
import googleAnalytics from '@analytics/google-analytics'
import customerIo from '@analytics/customerio'

/* Initialize analytics */
const analytics = Analytics({
  app: 'my-app-name',
  version: 100,
  plugins: [
    googleAnalytics({
      trackingId: 'UA-121991291',
    }),
    customerIo({
      siteId: '123-xyz'
    })
  ]
})

/* Track a page view */
analytics.page()

/* Track a custom event */
analytics.track('userPurchase', {
  price: 20,
  item: 'pink socks'
})

/* Identify a visitor */
analytics.identify('user-id-xyz', {
  firstName: 'bill',
  lastName: 'murray',
  email<EMAIL_ADDRESS>})
```

  Node.js usage

  For ES6/7 javascript you can `import Analytics from 'analytics'` for normal node.js usage you can import like so:

  ```js
  const { Analytics } = require('analytics')
  // or const Analytics = require('analytics').default
  const googleAnalytics = require('@analytics/google-analytics')
  const customerIo = require('@analytics/customerio')

  const analytics = Analytics({
    app: 'my-app-name',
    version: 100,
    plugins: [
      googleAnalytics({
        trackingId: 'UA-121991291',
      }),
      customerIo({
        siteId: '123-xyz'
      })
    ]
  })

  /* Track a page view */
  analytics.page()

  /* Track a custom event */
  analytics.track('userPurchase', {
    price: 20,
    item: 'pink socks'
  })

  /* Identify a visitor */
  analytics.identify('user-id-xyz', {
    firstName: 'bill',
    lastName: 'murray',
    email<EMAIL_ADDRESS>  })
  ```

  Browser usage

  When importing global `analytics` into your project from a CDN, the library exposes via a global `_analytics` variable.

  Call `_analytics.init` to create an analytics instance.

  ```html
  <script src="https://unpkg.com/analytics/dist/analytics.min.js"></script>
  <script>
    const Analytics = _analytics.init({
      app: 'my-app-name',
      version: 100,
      plugins: []
    })

    /* Track a page view */
    Analytics.page()

    /* Track a custom event */
    Analytics.track('userPurchase', {
      price: 20,
      item: 'pink socks'
    })

    /* Identify a visitor */
    Analytics.identify('user-id-xyz', {
      firstName: 'bill',
      lastName: 'murray',
      email<EMAIL_ADDRESS>    })
  </script>
  ```

## Demo

See [Analytics Demo](https://analytics-demo.netlify.com/) for a site example.

## API

The core `analytics` API is exposed once the library is initialized with [configuration](#configuration).

Typical usage:

1. Initialize with [configuration](#configuration)
2. Export the analytics instance with third-party providers (Google Analytics, HubSpot, etc)
3. Use [`page`](#analyticspage), [`identify`](#analyticsidentify), [`track`](#analyticstrack) in your app
4. [Plugin custom business logic](#creating-analytics-plugins)

### Configuration

Analytics library configuration

After the library is initialized with config, the core API is exposed & ready for use in the application.

**Arguments**

- **config** object - analytics core config
- **[config.app]** (optional) string - Name of site / app
- **[config.version]** (optional) string - Version of your app
- **[config.debug]** (optional) boolean - Should analytics run in debug mode
- **[config.plugins]** (optional) Array.<AnalyticsPlugin> - Array of analytics plugins

**Example**

```js
import Analytics from 'analytics'
import pluginABC from 'analytics-plugin-abc'
import pluginXYZ from 'analytics-plugin-xyz'

// initialize analytics
const analytics = Analytics({
  app: 'my-awesome-app',
  plugins: [
    pluginABC,
    pluginXYZ
  ]
})
```

### analytics.identify

Identify a user. This will trigger `identify` calls in any installed plugins and will set user data in localStorage

**Arguments**

- **userId** String - Unique ID of user
- **[traits]** (optional) Object - Object of user traits
- **[options]** (optional) Object - Options to pass to identify call
- **[callback]** (optional) Function - Callback function after identify completes

**Example**

```js
// Basic user id identify
analytics.identify('xyz-123')

// Identify with additional traits
analytics.identify('xyz-123', {
  name: 'steve',
  company: 'hello-clicky'
})

// Fire callback with 2nd or 3rd argument
analytics.identify('xyz-123', () => {
  console.log('do this after identify')
})

// Disable sending user data to specific analytic tools
analytics.identify('xyz-123', {}, {
  plugins: {
    // disable sending this identify call to segment
    segment: false
  }
})

// Send user data to only to specific analytic tools
analytics.identify('xyz-123', {}, {
  plugins: {
    // disable this specific identify in all plugins except customerio
    all: false,
    customerio: true
  }
})
```

### analytics.track

Track an analytics event. This will trigger `track` calls in any installed plugins

**Arguments**

- **eventName** String - Event name
- **[payload]** (optional) Object - Event payload
- **[options]** (optional) Object - Event options
- **[callback]** (optional) Function - Callback to fire after tracking completes

**Example**

```js
// Basic event tracking
analytics.track('buttonClicked')

// Event tracking with payload
analytics.track('itemPurchased', {
  price: 11,
  sku: '1234'
})

// Fire callback with 2nd or 3rd argument
analytics.track('newsletterSubscribed', () => {
  console.log('do this after track')
})

// Disable sending this event to specific analytic tools
analytics.track('cartAbandoned', {
  items: ['xyz', 'abc']
}, {
  plugins: {
    // disable track event for segment
    segment: false
  }
})

// Send event to only to specific analytic tools
analytics.track('customerIoOnlyEventExample', {
  price: 11,
  sku: '1234'
}, {
  plugins: {
    // disable this specific track call all plugins except customerio
    all: false,
    customerio: true
  }
})
```

### analytics.page

Trigger page view. This will trigger `page` calls in any installed plugins

**Arguments**

- **[data]** (optional) PageData - Page data overrides.
- **[options]** (optional) Object - Page tracking options
- **[callback]** (optional) Function - Callback to fire after page view call completes

**Example**

```js
// Basic page tracking
analytics.page()

// Page tracking with page data overrides
analytics.page({
  url: 'https://google.com'
})

// Fire callback with 1st, 2nd or 3rd argument
analytics.page(() => {
  console.log('do this after page')
})

// Disable sending this pageview to specific analytic tools
analytics.page({}, {
  plugins: {
    // disable page tracking event for segment
    segment: false
  }
})

// Send pageview to only to specific analytic tools
analytics.page({}, {
  plugins: {
    // disable this specific page in all plugins except customerio
    all: false,
    customerio: true
  }
})
```

### analytics.user

Get user data

**Arguments**

- **[key]** (optional) string - dot.prop.path of user data.

**Arguments**

- **[callback]** (optional) Function - Handler to run after reset

**Example**

```js
// Reset current visitor
analytics.reset()
```

### analytics.ready

Fire callback on analytics ready event

**Arguments**

- **callback** Function - function to trigger when all providers have loaded

**Example**

```js
analytics.ready((payload) => {
  console.log('all plugins have loaded or were skipped', payload);
})
```

### analytics.on

Attach an event handler function for analytics lifecycle events.

**Arguments**

- **name** String - Name of event to listen to
- **callback** Function - function to fire on event

**Example**

```js
// Fire function when 'track' calls happen
analytics.on('track', ({ payload }) => {
  console.log('track call just happened. Do stuff')
})

// Remove listener before it is called
const removeListener = analytics.on('track', ({ payload }) => {
  console.log('This will never get called')
})

// cleanup .on listener
removeListener()
```

### analytics.once

Attach a handler function to an event and only trigger it once.

**Arguments**

- **name** String - Name of event to listen to
- **callback** Function - function to fire on event

**Example**

```js
// Fire function only once per 'track'
analytics.once('track', ({ payload }) => {
  console.log('This is only triggered once when analytics.track() fires')
})

// Remove listener before it is called
const listener = analytics.once('track', ({ payload }) => {
  console.log('This will never get called b/c listener() is called')
})

// cleanup .once listener before it fires
listener()
```

### analytics.getState

Get data about user, activity, or context. Access sub-keys of state with `dot.prop` syntax.

**Arguments**

- **[key]** (optional) string - dot.prop.path value of state

**Example**

```js
// Get the current state of analytics
analytics.getState()

// Get a subpath of state
analytics.getState('context.offline')
```

### analytics.storage

Storage utilities for persisting data.
These methods will allow you to save data in localStorage, cookies, or to the window.

**Example**

```js
// Pull storage off analytics instance
const { storage } = analytics

// Get value
storage.getItem('storage_key')

// Set value
storage.setItem('storage_key', 'value')

// Remove value
storage.removeItem('storage_key')
```

### analytics.storage.getItem

Get value from storage

**Arguments**

- **key** String - storage key
- **[options]** (optional) Object - storage options

**Example**

```js
analytics.storage.getItem('storage_key')
```

### analytics.storage.setItem

Set storage value

**Arguments**

- **key** String - storage key
- **value** any - storage value
- **[options]** (optional) Object - storage options

**Example**

```js
analytics.storage.setItem('storage_key', 'value')
```

### analytics.storage.removeItem

Remove storage value

**Arguments**

- **key** String - storage key
- **[options]** (optional) Object - storage options

**Example**

```js
analytics.storage.removeItem('storage_key')
```

### analytics.plugins

Async Management methods for plugins.

This is also where [custom methods](https://bit.ly/329vFXy) are loaded into the instance.

**Example**

```js
// Enable a plugin by namespace
analytics.plugins.enable('keenio')

// Disable a plugin by namespace
analytics.plugins.disable('google-analytics')
```

### analytics.plugins.enable

Enable analytics plugin

**Arguments**

- **plugins** string|Array.<string> - name of plugins(s) to disable
- **[callback]** (optional) Function - callback after enable runs

**Example**

```js
analytics.plugins.enable('google-analytics').then(() => {
  console.log('do stuff')
})

// Enable multiple plugins at once
analytics.plugins.enable(['google-analytics', 'segment']).then(() => {
  console.log('do stuff')
})
```

### analytics.plugins.disable

Disable analytics plugin

**Arguments**

- **plugins** string|Array.<string> - name of integration(s) to disable
- **callback** Function - callback after disable runs

**Example**

```js
analytics.plugins.disable('google').then(() => {
  console.log('do stuff')
})

analytics.plugins.disable(['google', 'segment']).then(() => {
  console.log('do stuff')
})
```

## Events

The `analytics` library comes with a large variety of event listeners that can be used to fire custom functionality when a specific lifecycle event occurs.

These listeners can be fired using `analytics.on` & `analytics.once`

```js
const eventName = 'pageEnd'
analytics.on(eventName, ({ payload }) => {
  console.log('payload', payload)
})
```

Below is a list of the current available events

| Event | Description |
|:------|:-------|
| **`bootstrap`** | Fires when analytics library starts up.
This is the first event fired. '.on/once' listeners are not allowed on bootstrap
Plugins can attach logic to this event |
| **`params`** | Fires when analytics parses URL parameters |
| **`campaign`** | Fires if params contain "utm" parameters |
| **`initializeStart`** | Fires before 'initialize', allows for plugins to cancel loading of other plugins |
| **`initialize`** | Fires when analytics loads plugins |
| **`initializeEnd`** | Fires after initialize, allows for plugins to run logic after initialization methods run |
| **`ready`** | Fires when all analytic providers are fully loaded. This waits for 'initialize' and 'loaded' to return true |
| **`resetStart`** | Fires if analytic.reset() is called.
Use this event to cancel reset based on a specific condition |
| **`reset`** | Fires if analytic.reset() is called.
Use this event to run custom cleanup logic (if needed) |
| **`resetEnd`** | Fires after analytic.reset() is called.
Use this event to run a callback after user data is reset |
| **`pageStart`** | Fires before 'page' events fire.
 This allows for dynamic page view cancellation based on current state of user or options passed in. |
| **`page`** | Core analytics hook for page views.
 If your plugin or integration tracks page views, this is the event to fire on. |
| **`pageEnd`** | Fires after all registered 'page' methods fire. |
| **`pageAborted`** | Fires if 'page' call is cancelled by a plugin |
| **`trackStart`** | Called before the 'track' events fires.
 This allows for dynamic page view cancellation based on current state of user or options passed in. |
| **`track`** | Core analytics hook for event tracking.
 If your plugin or integration tracks custom events, this is the event to fire on. |
| **`trackEnd`** | Fires after all registered 'track' events fire from plugins. |
| **`trackAborted`** | Fires if 'track' call is cancelled by a plugin |
| **`identifyStart`** | Called before the 'identify' events fires.
This allows for dynamic page view cancellation based on current state of user or options passed in. |
| **`identify`** | Core analytics hook for user identification.
 If your plugin or integration identifies users or user traits, this is the event to fire on. |
| **`identifyEnd`** | Fires after all registered 'identify' events fire from plugins. |
| **`identifyAborted`** | Fires if 'track' call is cancelled by a plugin |
| **`userIdChanged`** | Fires when a user id is updated |
| **`registerPlugins`** | Fires when analytics is registering plugins |
| **`enablePlugin`** | Fires when 'analytics.plugins.enable()' is called |
| **`disablePlugin`** | Fires when 'analytics.plugins.disable()' is called |
| **`online`** | Fires when browser network goes online.
This fires only when coming back online from an offline state. |
| **`offline`** | Fires when browser network goes offline. |
| **`setItemStart`** | Fires when analytics.storage.setItem is initialized.
This event gives plugins the ability to intercept keys & values and alter them before they are persisted. |
| **`setItem`** | Fires when analytics.storage.setItem is called.
This event gives plugins the ability to intercept keys & values and alter them before they are persisted. |
| **`setItemEnd`** | Fires when setItem storage is complete. |
| **`setItemAborted`** | Fires when setItem storage is cancelled by a plugin. |
| **`removeItemStart`** | Fires when analytics.storage.removeItem is initialized.
This event gives plugins the ability to intercept removeItem calls and abort / alter them. |
| **`removeItem`** | Fires when analytics.storage.removeItem is called.
This event gives plugins the ability to intercept removeItem calls and abort / alter them. |
| **`removeItemEnd`** | Fires when removeItem storage is complete. |
| **`removeItemAborted`** | Fires when removeItem storage is cancelled by a plugin. |

## Analytic plugins

The `analytics` has a robust plugin system. Here is a list of currently available plugins:

| Plugin | Stats | Version |
|:---------------------------|:---------------:|:-----------:|
| **[@analytics/activity-utils](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-activity)**
 User activity listener utilities | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.1.15** |
| **[@analytics/amplitude](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-amplitude)**
 Amplitude integration for 'analytics' module | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.1.3** |
| **[@analytics/aws-pinpoint](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-aws-pinpoint)**
 AWS Pinpoint integration for 'analytics' module | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.7.9** |
| **[@analytics/cookie-utils](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-storage-cookie)**
 Tiny cookie utility library | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.2.12** |
| **[@analytics/core](https://github.com/DavidWells/analytics/tree/master/packages/analytics-core)**
 Lightweight analytics library for tracking events, page views, & identifying users. Works with any third party analytics provider via an extendable plugin system. | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.12.7** |
| **[@analytics/countly](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-countly)**
 Countly plugin for 'analytics' module | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.21.12** |
| **[@analytics/crazy-egg](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-crazy-egg)**
 Crazy Egg integration for 'analytics' module | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.1.2** |
| **[@analytics/custify](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-custify)**
 Custify integration for 'analytics' module for browser & node | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.0.2** |
| **[@analytics/customerio](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-customerio)**
 Customer.io integration for 'analytics' module | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.2.2** |
| **[@analytics/form-utils](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-forms)**
 Form utility library for managing HTML form submissions & values | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.3.13** |
| **[@analytics/fullstory](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-fullstory)**
 Unofficial FullStory plugin for 'analytics' module | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.2.6** |
| **[@analytics/global-storage-utils](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-storage-global)**
 Tiny global storage utility library | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.1.7** |
| **[@analytics/google-analytics](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-google-analytics)**
 Google analytics v4 plugin for 'analytics' module | <img width="360" height="22"<EMAIL_ADDRESS>|  **1.0.7** |
| **[@analytics/google-tag-manager](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-google-tag-manager)**
 Google tag manager plugin for 'analytics' module | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.5.5** |
| **[@analytics/google-analytics-v3](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-google-analytics-v3)**
 Google analytics v3 plugin for 'analytics' module | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.6.1** |
| **[@analytics/gosquared](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-gosquared)**
 GoSquared integration for 'analytics' module | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.1.3** |
| **[@analytics/hubspot](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-hubspot)**
 HubSpot plugin for 'analytics' module | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.5.1** |
| **[@analytics/intercom](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-intercom)**
 Intercom integration for 'analytics' module for browser & node | <img width="360" height="22"<EMAIL_ADDRESS>|  **1.0.2** |
| **[@analytics/listener-utils](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-listener)**
 Backward compatible event listener library for attaching & detaching event handlers | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.3.2** |
| **[@analytics/localstorage-utils](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-storage-local)**
 Tiny LocalStorage utility library | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.1.10** |
| **[@analytics/mixpanel](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-mixpanel)**
 Mixpanel plugin for 'analytics' module | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.4.0** |
| **[@analytics/original-source-plugin](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-original-source)**
 Save original referral source of visitor plugin for 'analytics' pkg | <img width="360" height="22"<EMAIL_ADDRESS>|  **1.0.11** |
| **[@analytics/ownstats](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-ownstats)**
 Ownstats integration for 'analytics' module for browser & node | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.1.2** |
| **[@analytics/perfumejs](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-perfumejs)**
 Send browser performance metrics to third-party analytics providers | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.2.1** |
| **[@analytics/queue-utils](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-queue)**
 Dependency free queue processor | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.1.2** |
| **[@analytics/redact-utils](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-redact)**
 Utility library for redacting event data | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.1.3** |
| **[@analytics/remote-storage-utils](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-storage-remote)**
 Storage utilities for cross domain localStorage access, with permissions | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.4.20** |
| **[@analytics/router-utils](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-router)**
 Route change utilities for single page apps | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.1.1** |
| **[@analytics/scroll-utils](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-scroll)**
 Scroll utility library to fire events on scroll | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.1.22** |
| **[@analytics/segment](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-segment)**
 Segment integration for 'analytics' module for browser & node | <img width="360" height="22"<EMAIL_ADDRESS>|  **1.1.4** |
| **[@analytics/session-storage-utils](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-storage-session)**
 Tiny SessionStorage utility library | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.0.7** |
| **[@analytics/session-utils](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-session)**
 Tiny session utility library | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.1.19** |
| **[@analytics/simple-analytics](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-simple-analytics)**
 Simple analytics plugin for 'analytics' module for browser | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.3.4** |
| **[@analytics/snowplow](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-snowplow)**
 Snowplow integration for 'analytics' module for browser & node | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.3.3** |
| **[@analytics/storage-utils](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-storage)**
 Storage utility with fallbacks | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.4.2** |
| **[@analytics/type-utils](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-types)**
 Tiny runtime type checking utils | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.6.2** |
| **[@analytics/url-utils](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-url)**
 Url utils | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.2.3** |
| **[@analytics/visitor-source](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-visitor-source)**
 Get visitor source | <img width="360" height="22"<EMAIL_ADDRESS>|  **0.0.7** |
| **[analytics-cli](https://github.com/DavidWells/analytics/tree/master/packages/analytics-cli)**
 CLI for `analytics` pkg |  |  **0.0.5** |
| **[analytics-plugin-do-not-track](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-do-not-track)**
 Disable tracking for opted out visitors plugin for 'analytics' module |  |  **0.1.5** |
| **[analytics-plugin-event-validation](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-event-validation)**
 Event validation plugin for analytics |  |  **0.1.2** |
| **[gatsby-plugin-analytics](https://github.com/DavidWells/analytics/tree/master/packages/gatsby-plugin-analytics)**
 Easily add analytics to your Gatsby site |  |  **0.2.0** |
| **[analytics-plugin-lifecycle-example](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-lifecycle-example)**
 Example plugin with lifecycle methods for 'analytics' module |  |  **0.1.2** |
| **[analytics-plugin-tab-events](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-tab-events)**
 Expose tab visibility events plugin for 'analytics' module |  |  **0.2.1** |
| **[use-analytics](https://github.com/DavidWells/analytics/tree/master/packages/use-analytics)**
 Analytics hooks for React |  |  **1.1.0** |
| **[analytics-util-params](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-params)**
 Url Parameter helper functions |  |  **0.1.2** |
| **[analytics-utils](https://github.com/DavidWells/analytics/tree/master/packages/analytics-utils)**
 Analytics utility functions used by 'analytics' module |  |  **1.0.12** |
| **[analytics-plugin-window-events](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-window-events)**
 Expose window events plugin for 'analytics' module |  |  **0.0.7** |

## Community Plugins

Below are plugins created outside of this repo:

- [ActiveCampaign](https://github.com/deevus/analytics-plugin-activecampaign) Adds Analytics support for ActiveCampaign
- [analytics-fetch](https://www.npmjs.com/package/@standardorg/analytics-fetch) Integration with the browser's fetch API for analytics
- [Conscia](https://www.npmjs.com/package/analytics-plugin-conscia) Adds Analytics support for conscia.ai
- [Facebook tracking pixel](https://github.com/DavidWells/analytics/issues/54#issuecomment-735413632) Send data to Facebook Tracking pixel
- [Indicative](https://www.npmjs.com/package/analytics-plugin-indicative) Adds Analytics support for Indicative
- [LinkedIn Pixel](https://www.npmjs.com/package/analytics-plugin-linkedin) Adds Analytics support for Linkedin tracking pixel
- [Logrocket](https://www.npmjs.com/package/analytics-plugin-logrocket) Adds Analytics support for LogRocket
- [Planhat](https://www.npmjs.com/package/analytics-plugin-planhat) Adds Analytics support for Planhat
- [Plausible](https://www.npmjs.com/package/analytics-plugin-plausible) Adds Analytics support for Plausible
- [PostHog](https://www.npmjs.com/package/@metro-fs/analytics-plugin-posthog) Adds Analytics support for PostHog
- [ProfitWell](https://github.com/deevus/analytics-plugin-profitwell) Adds Analytics support for ProfitWell
- [Reddit Pixel](https://www.npmjs.com/package/analytics-plugin-reddit-pixel) Adds Analytics support for Reddit Pixel
- [RudderStack](https://www.npmjs.com/package/begrowth-analytics-rudderstack) Adds Analytics support for RudderStack
- [Splitbee](https://www.npmjs.com/package/analytics-plugin-splitbee) Adds Analytics support for Splitbee
- [Tapfiliate](https://github.com/deevus/analytics-plugin-tapfiliate) Adds Analytics support for Tapfiliate
- [Yandex](https://github.com/pechischev/analytics-yandex-metric-plugin) Send data to Yandex metrica
- [Add a plugin link](https://github.com/DavidWells/analytics/blob/master/external-plugins.json)

Additional examples

- [Using AWS Lambda, API Gateway & analytics](https://blog.mikecoughlin.com/own-your-event-tracking/)
- [Using analytics to make amundsen.io pluggable](https://github.com/amundsen-io/amundsenfrontendlibrary/blob/e91c0ab9d8a39b302a71c535145a20e24326ee21/docs/application_config.md#analytics)

## Creating analytics plugins

The library is designed to work with any third-party analytics tool.

Plugins are just plain javascript objects that expose methods for `analytics` to register and call.

Here is a quick example of a plugin:

```js
// plugin-example.js
export default function pluginExample(userConfig) {
  // return object for analytics to use
  return {
    /* All plugins require a name */
    name: 'my-example-plugin',
    /* Everything else below this is optional depending on your plugin requirements */
    config: {
      whatEver: userConfig.whatEver,
      elseYouNeed: userConfig.elseYouNeed
    },
    initialize: ({ config }) => {
      // load provider script to page
    },
    page: ({ payload }) => {
      // call provider specific page tracking
    },
    track: ({ payload }) => {
      // call provider specific event tracking
    },
    identify: ({ payload }) => {
      // call provider specific user identify method
    },
    loaded: () => {
      // return boolean so analytics knows when it can send data to third-party
      return !!window.myPluginLoaded
    }
  }
}
```

`name` is required for all plugins. All other methods are optional.

If you don't need to hook into `page` tracking, just omit the `page` key from your plugin object.

To use a plugin, import it and pass it into the `plugins` array when you bootstrap `analytics`.

```js
import Analytics from 'analytics'
import pluginExample from './plugin-example.js'

const analytics = Analytics({
  app: 'my-app-name',
  plugins: [
    pluginExample({
      whatEver: 'hello',
      elseYouNeed: 'there'
    }),
    ...otherPlugins
  ]
})
```

### React to any event

Plugins can react to any event flowing through the `analytics` library.

For example, if you wanted to trigger custom logic when `analytics` bootstraps, you can attach a function handler to the `bootstrap` event.

For a full list of core events, checkout [`events.js`](https://github.com/DavidWells/analytics/blob/master/packages/analytics-core/src/events.js).

```js
// Example Plugin plugin.js
export default function myPlugin(userConfig) {
  return {
    /* Name is a required field for plugins */
    name: 'my-plugin',
    /* Bootstrap runs when analytics starts */
    bootstrap: ({ payload, config, instance }) => {
      // Do whatever on `bootstrap` event
    },
    pageStart: ({ payload, config, instance }) => {
      // Fire custom logic before analytics.page() calls
    },
    pageEnd: ({ payload, config, instance }) => {
      // Fire custom logic after analytics.page() calls
    },
    trackStart: ({ payload, config, instance }) => {
      // Fire custom logic before analytics.track() calls
    },
    'track:customerio': ({ payload, config, instance }) => {
      // Fire custom logic before customer.io plugin runs.
      // Here you can customize the data sent to individual analytics providers
    },
    trackEnd: ({ payload, config, instance }) => {
      // Fire custom logic after analytics.track() calls
    },
    // ... hook into other events
  }
}
```

Using this plugin is the same as any other.

```js
import Analytics from 'analytics'
import customerIoPlugin from '@analytics/customerio'
import myPlugin from './plugin.js'

const analytics = Analytics({
  app: 'my-app-name',
  plugins: [
    // include myPlugin
    myPlugin(),
    customerIoPlugin({
      trackingId: '1234'
    })
    ...otherPlugins
  ]
})
```

### Custom methods

Analytics plugins can provide their own custom functionality via the `methods` key.

```js
import Analytics from 'analytics'

// Example plugin with custom methods
const pluginOne = {
  name: 'one',
  // ... page, track, etc
  // Custom functions to expose to analytics instance
  methods: {
    myCustomThing(one, two, three) {
      const analyticsInstance = this.instance
      console.log('Use full analytics instance', analyticsInstance)
    },
    otherCustomThing: (one, two, ...args) => {
      // Arrow functions break this.instance context.
      // The instance is instead injected as last arg
      const analyticsInstance = args[args.length - 1]
      console.log('Use full analytics instance', analyticsInstance)
    },
    // Async function examples
    async fireCustomThing(one, two, three) {
      const { track } = this.instance
      track('customThing')
      return 'data'
    },
    triggerSpecial: async (argOne, argTwo, ...args) => {
      // Arrow functions break this.instance context.
      // The instance is instead injected as last arg
      const analyticsInstance = args[args.length - 1]
      return argOne + argTwo
    }
  }
}

// Example plugin with custom methods
const pluginTwo = {
  name: 'two',
  page: () => { console.log('page view fired') }
  // Custom functions to expose to analytics instance
  methods: {
    cookieBanner(one, two, three) {
      const analyticsInstance = this.instance
      console.log('Use full analytics instance', analyticsInstance)
      const cookieSettings = analyticsInstance.storage.getItem('preferences-set')
      if (!cookieSettings) {
        // Show cookie settings
      }
    },
  }
}

// Initialize analytics instance with plugins
const analytics = Analytics({
  app: 'your-app-name',
  plugins: [
    pluginOne,
    pluginTwo
  ]
})

// Using custom methods in your code
analytics.plugins.one.myCustomThing()
analytics.plugins.two.cookieBanner()
```

##  Plugin Naming Conventions

Plugins should follow this naming convention before being published to npm

```bash
analytics-plugin-{your-plugin-name}
```

E.g. An analytics plugin that does `awesome-stuff` should be named

```bash
npm install analytics-plugin-awesome-stuff
```

Then submit to the [list above](#analytic-plugins)

## Debugging analytics

During development, you can turn on `debug` mode. This will connect the dev tools for you to see the analytics events passing through your application visually.

![analytics-debug-tools](https://user-images.githubusercontent.com/532272/61163639-21da2300-a4c4-11e9-8743-b45d3a570271.gif)

```js
import Analytics from 'analytics'

const analytics = Analytics({
  app: 'my-app',
  debug: true
})
```

## TypeScript support

Types for analytics and plugins are generated from [JSDoc blocks](https://jsdoc.app/) in the code base via the [tsd-jsdoc](https://www.npmjs.com/package/tsd-jsdoc) package.

We are always looking to improve type support & improve the DX of users. If you see something that can be improved let us know in an issue!

## Contributing

Contributions are always welcome, no matter how large or small. Before contributing, please read the [code of conduct](CODE_OF_CONDUCT.md).

## Setup & Install dependencies

Clone the repo and run

```sh
$ git clone https://github.com/davidwells/analytics
$ cd analytics
$ npm install && npm run setup
```

The above command will set up all the packages and their dependencies.

## Development

You can watch and rebuild packages with the `npm run watch` command.

```sh
npm run watch
```

While watch mode is activated, you can work against the demo site in examples to test out your changes on a live application.

repository: DavidWells/analytics

repo_name: DavidWells/analytics


text:
# Dynamic Data Grid Rename
A Mendix widget for changing the column names of a data grid using an enclosing context entity.

This is all still boilerplate

## Configuration
<TODO>


text:
qs.json.js is a microservice that returns the query string as a JSON object.

**usage**

- install `micro` by running `npm install`.
- run the server (`npm start` or `npm start -- -p PORT`)
- `curl 'http://localhost:3000/?test=true&json=ok'`


text:
# i18n middleware

NOTE: v2.0.3 will be the last version of this module and it will be deprecated.
Use <https://github.com/gobuffalo/middleware> instead.

This Buffalo middleware enables i18n features in your app:

* User language detection from configurable sources
* Translation helper using locales bundles from github.com/nicksnyder/go-i18n
* Localized views

## Installation

This middleware is setup by default on a new Buffalo app:

### actions/app.go

```go
var app *buffalo.App

// T is used to provide translations
var T *i18n.Translator

// App is where all routes and middleware for buffalo
// should be defined. This is the nerve center of your
// application.
func App() *buffalo.App {
    if app == nil {
        // [...]

        // Setup and use translations:
        var err error
        if T, err = i18n.New(os.DirFS("locales"), "en"); err != nil {
            app.Stop(err)
        }

        app.Use(T.Middleware())
    }
    return app
}
```

Use `i18n.New` to create a new instance of the translation module, then add the middleware (`T.Middleware()`) to the app to enable its features.

See <https://gobuffalo.io/docs/localization> for further info about Buffalo translation features and configuration.

gha_language: Go


text:
# broadcastor
Scalable message broadcaster

## Usage
local
```
> docker-compose up -d redis
# in configuration files, all references to `redis:6379` must be change to `localhost:6379`
> make dep
> make
> ./bin/bc_spreader -c bin config_spreader_0.json
> ./bin/bc_spreader -c bin config_spreader_1.json
> ./bin/bc_api -c bin/config_api.json
> ./bin/bc_client -c bin/config_client_0.json
```

docker-compose
```
# Run redis, API and 2 spreaders
> docker-compose up -d redis spreader0 spreader1 api

# Run clients interactive
> docker-compose run --rm client_0
> docker-compose run --rm client_1
> docker-compose run --rm client_2
# first frame may be not rendered correctly, just press space to render correctly
```

Client commands
```
/rooms -> list rooms
/newroom -> create a new room
/connect ROOM_ID -> connect to a room ROOM_ID as a new user, or last room created
```

e.g:
```
/newroom
01CFZFPPF7PGQK1RSJEE15GYQD
/connect
connected with user ID: 01CFZFPRCPDB09G283JRV3CRFJ
test
Thu Jun 14 16:02:56 UTC 2018 | test
```
## TODO
- [ ] Set expiration time for user (set with ping time from client to keep alive)
- [ ] Set expiration time for messages
- [ ] Remove/Delete rooms (and associated users)
- [ ] Use redis cluster
- [ ] Add multiple fields for user/message/room (name, description, image, etc.)

repository: Elojah/broadcastor

repo_name: Elojah/broadcastor


text:
But here you have proven that you really don't understand.

This I don't intend to ignore. Welcome to my killfile. When you
figure out why, you may be worthy of being removed from it.

{% endraw %}
```

## Thread

+ Return to [October 1993](/archive/1993/10)

+ Return to<EMAIL_ADDRESS>(T. William Wells)](/authors/bill_at_twwells_com_t_william_wells_)"
+ Return to "[Duncan Frissell <frissell@panix.com>](/authors/duncan_frissell_frissell_at_panix_com_)"
+ Return to "["Perry E. Metzger" <pmetzger@lehman.com>](/authors/perry_e_metzger_pmetzger_at_lehman_com_)"
+ Return to<EMAIL_ADDRESS>(Ray)](/authors/rjc_at_gnu_ai_mit_edu_ray_)"

+ 1993-10-24 (Sun, 24 Oct 93 07:03:34 PDT) - [Re: Net Regulation](/archive/1993/10/5489e648913ca343f471a4f9b2b565cef24f06ec25dba48474ddd9c66c61f08d) - _Duncan Frissell<EMAIL_ADDRESS>  + 1993-10-24 (Sun, 24 Oct 93 13:08:36 PDT) - [Re: Net Regulation](/archive/1993/10/60841ebaf89481d93380b63ae4135e08c1d90864d72ee00179cdf5869a74c0a1) -<EMAIL_ADDRESS>(T. William Wells)_
    + 1993-10-25 (Sun, 24 Oct 93 18:58:39 PDT) - [Re: Net Regulation](/archive/1993/10/4af5258e019673bd31b343915e1e8cab0e477e01b07f3b861fe7b7fc2283c38d) - _"Perry E. Metzger"<EMAIL_ADDRESS>      + 1993-10-25 (Sun, 24 Oct 93 23:03:12 PDT) - Re: Net Regulation -<EMAIL_ADDRESS>(T. William Wells)_
        + 1993-10-25 (Mon, 25 Oct 93 06:39:51 PDT) - [Re: Net Regulation](/archive/1993/10/edafea233bbbb623a6dabbc0095ea8fb74e504246501789431e4e43e020e8d5a) - _"Perry E. Metzger"<EMAIL_ADDRESS>        + 1993-10-28 (Thu, 28 Oct 93 01:38:05 PDT) - [Last words, perhaps...](/archive/1993/10/f442f8ef9bcafc38f47678323a6a67823ef5d3fb75bd224b585f9310c18146b1) -<EMAIL_ADDRESS>(Ray)_


text:
---
description: Class
keywords: php
title: Class
toc_max: 4
---

### class

```php
class Me {
  function info(){
    echo "this is user info";
  }
}
$t = new Me();
$t->info();
# this is user info
```

### extends

* [inheritends](http://sg2.php.net/manual/en/language.oop5.inheritance.php)

```php
class User{
  public function me(){
    echo "kamal";
  }
}

class Emp extends User{

}

$j = new Emp();
$j->me();
// kamal
```

* call system

```php
class User{
  public function me(){
    echo "kamal";
  }
}

class Emp extends User{
  public function me(){
    echo "parent is here";
  }
  public function selfMe(){
    self::me();
  }
  public function parentMe(){
    self::me();
  }
}

$j = new Emp();
$j->selfMe();
// output : kamal
$j->parentMe();
// output: parent is here
```

* [class php.net](http://sg2.php.net/manual/en/oop5.intro.php)

### properties

* `variables` are called `properties` which `live` in `class`

### static

* `no need to declare of class objects (new)`
* `scope :: operator`

```php
class Me {
  static function info(){
    echo "this is user info\n";
  }
}
Me::info();
# this is user info
```

➲(`laravel` ) : `static` live in `facades` folder

### abstract class

`abstract class Me{} → extends Me `

* Abstraction is a process of hiding the implementation details and showing only functionality to the user.
* `must be have one abstract method`

```php
abstract class User{
  abstract public function name();
  public function normal(){
    echo "this is normal function";
  }
}

class Employee extends User{
  public function name(){
    echo "abstract methods body\n";
  }
}
$t = new Employee();

$t->name();
$t->normal();
// abstract methods body
// this is normal function
```

~ resources

* [javatpoint](https://www.javatpoint.com/abstract-class-in-java)
* [developer](https://www.developer.com/lang/php/article.php/3604111/PHP-5-OOP-Interfaces-Abstract-Classes-and-the-Adapter-Pattern.htm)

### interface

`interface me{} → implements me `

➲ `visibility` must be `public`

➲ blueprint of class's functions

➲(`laravel` ) : `intreface` live in `contract` folder

```php
interface me{
  public function name();
}

class User implements me{
  public function name(){
    echo "this is user\n";
  }
}

class Employee implements me{
  public function name(){
    echo "this is employee\n";
  }
}

$r = new Employee();
$t = new User();
$t->name();
$r->name();
// this is user
// this is employee
```

### trait

trait is a process that reuse methods . if you are Vue developer or SASS(css), you know about `mixins` . `trait` as like `mixins`

`trait me{} → use me `

```php
trait me{
  public function name(){
    echo "this is trait";
  }
}

class User{
  use me;
}

$t = new User();
$t->name();
// this is trait
```

### constructor

```php
class A {

 function __construct() {
  echo "constructor automaticaly return when class call";
 }
}

$obj= new A();
 # constructor automaticaly return when class call
?>
```

~ resource

* [phptpoint](https://www.phptpoint.com/php-constructor/)
* [classobj](http://php.net/manual/en/book.classobj.php)


text:
### How to reproduce results?

Main Text
=========

* Experiment 1: See ```ex1_2_model.ipynb```.
* Experiment 2: See ```ex2_celeba.ipynb```.
* Experiment 3: See ```ex3_normalising_flows.py```.
Requries ```tensorflow-probability=0.5.0```, ```tensorflow=1.13.1```, and ```matplotlib.basemap```. The
invertible models can be downloaded from [here](https://drive.google.com/file/d/1NPqutoHYMfPOpA4tosENCuXmPro4mkiK/view?usp=sharing). Please make the necessary change in ```tf_models/config.py```.

Appendix
========

* Experiment H.1: See ```appen-l-models-fpr-tpr-mean-shift.py``` and
```appen-l-models-fpr-tpr-rbm.py```.
* Experiment H.2:

repository: jenninglim/model-comparison-test

gha_language: Jupyter Notebook

repo_name: jenninglim/model-comparison-test


text:
# Regulator

## Responsibilities
* Run a series of cleaning steps on a graph, modifying it in place.
* Generate a human-readable reason for each modification.
* Validate the graph against a set of criteria.
* If the graph has problems the Regulator cannot fix, or if the graph fails validation, halt with an error.

## Parameters
* `ingest_job` (optional) -- [IngestJob](../Tables.md#IngestJob)
* `graph` -- [MutableGraph](./Graph.md) object, output from a [Transformer](./Transformer.md)

## Phases of Regulation
* Source-specific Phase
  * `suid.source_config` can contain a list of regulator steps that will run first
* Node Phase
  * Static list of regulator steps that run on each node individually
  * Each step makes decisions based only on the information in the given node
  * Possible effects:
    * Modify the given node
    * Delete the given node
    * Add new nodes to the graph
      * Added nodes will be run through a Node Phase separately
* Graph Phase
  * Static list of regulator steps that run on the entire graph
  * Decisions based on information across multiple nodes
  * Can modify any part of the graph in any way
    * Added nodes will be run through a Node Phase separately
* Validation Phase
  * Static list of regulator steps that run on the entire graph
  * Cannot modify the graph
  * Each phase tests the graph against a criterion
    * Halts with an error if the graph fails

## Example Regulator Steps
* Node-Phase Steps
  * tokenize
    * recognize when a single field has multiple values
      * tag.name has list of tags
      * agent.name has list of names
    * remove all but first value
    * create nodes for each additional value
        * if splitting an agent that is a creator on a work with order_cited=1, new creator nodes should have order_cited 1.1, 1.2, etc.
  * rich agent names
    * recognize when agent.name contains more information than just a name
      * email address
      * location
      * affiliated organization/institution
    * remove excess info from the name
    * create nodes for excess info
  * person name parts
    * if a person has a `name`, but not given/family names, parse `name` into parts
    * if a person has given/family names but no `name`, concat the parts and assign to `name`
  * cited as
    * if an agent-work relation has missing/empty `cited_as`, copy `name` from the agent
  * normalize white space
    * look at each text field
    * remove leading or trailing whitespace
    * replace repeated whitespace or newlines, tabs, etc. with a single space
* Graph-Phase Steps
  * order cited
    * look at `order_cited` for all creators for each work
    * sort by `order_cited` and ensure all values are integers
      * e.g. (0, 0.1, 0.2, 1.0, 1.1) -> (0, 1, 2, 3, 4)
    * if any creators have null `order_cited`, add them to the end in alphabetical order
      * or fail?
  * prune duplicate nodes
    * find identical pairs of nodes, or nodes with duplicate values in a unique field
    * delete one of the duplicate nodes
  * delete invalid nodes
    * delete works that have no identifiers
    * delete agents that meet all conditions:
      * have no identifiers
      * have no relations to a work
      * have no relations to an agent with an identifier(?)
    * delete all other nodes that are not somehow connected to an agent or work
* Validation-Phase Steps
  * required fields
    * all required fields for a node's model (and type) must be present
  * field values
    * scalar fields: field values must be appropriate type/format/value for the field
    * relation fields: related nodes must have the correct model for the field
  * required identifiers
    * works must have at least one identifier
    * agents must have either an identifier or a related work

## Error conditions
* Duplicate node IDs -> Fail ingestion

repository: mattclark/SHARE

repo_name: mattclark/SHARE


text:
# DynamoDB

## RDS OLTP Relational DBs
* MS SQL Server
* Oracle
* MySQL
* PostgresSQL
* Aurora
* MariadB

## Non-relational DB
* DynamoDB - no SQL
* Redshift - OLAP datawarehousing
* Elasticache - in memory caching.
* DMS

## How to improve db speed?
* Elasticache - either Memcached or Redis.
* It will cache the most consistently queried aspects of your DB.

## DMS - database migration service
* Allows you to migrate your DB to AWS automatically.

## DyanmoDB Facts
* document oriented - collection (table), document(row), key/value pair (fields).
* Single-ditig millisecond latency
* On SSD
* Spread across 3 geographically distinct data centers

## Consistency modes
* **Eventually Consistent Reads** (default). Consistency is delayed, but is reached within 1 seconds.
* **Strongly consistent** reads - consistent immediately prior to the read.

## Basics
* Table
* Items - row. e.g. students.
* Attribute - column e.g. a student's first name.
* supports nested attributes up to 32 levels deep.
* You can export table or items into CSV.
* Each primary key attribute must be a scalar (meaning that it can only hold a single value).

## Lab
* Give EC2 IAM role of AmazonDynamoDBFullAccess.

## Primary Keys (unique IDs)
* Two types of primary keys:
1. **Partition Key** aka **Hash Key** - e.g. artist name. DynamoDB uses the partition key's value as input to an internal hash function; the output from the hash function determines the partition where the item is stored.
2. **Partion Key + Sort Key** -  composite primary key. e.g. artist name + song title. All items with the same partition key are stored together, in sorted order by sort key value.
   With a composite primary key, it is possible for two items to have the same partition key value, but those two items must have different sort key values.

## Indexes
* Primary Key allows you to find data. If you want to find data for other attributes, you need to create **Secondary Index**.
* **Local Secondary Index** - an index that has the same partition key as the table, but a different sort key.
* **Global Secondary Index** -  an index with a partition key and sort key that can be different from those on the table.
* Max **5** local secondary index per table.
* Max **5** global secondary index per table.

## Streams
* captures any modifications to the tables.
* if a new item is added to the table, the stream captures an image of the entire item + all its attributes. Stores it for 24hrs.
* if item is updated, stream captures "before" and "after" images of modified attributes.
* if item is deleted, stream captures image of entire item before it was deleted.

## Triggers
* Connect Streams to lambda.
* modify item, stream is triggers, lambda is triggered.

## Query API Call
* Query - searches only partition key (primary key) + sort key.
* Returns data matching primary key search.
* Very efficient. Searches indexes only.
* All attribs of an item is returned. but you can use ProjectionExpression parameter so that the query only returns some of the attributes.
* Result is sorted by sort key **ascending**. To make it **descending**, set the **ScanIndexForward** param to **false**.
* by default, it is **eventually consistent**, but can be changed to **strongly consistent**.
![](./images/dynamodb_query.jpg)

## Scan
* Returns all items (and their attribues) in the table; therefore very inneficient.
* It scans the entire table, then filters out the values to provide the desired results, essentially adding the extra step of removing data from the result set.
* You can use **ProjectionExpression** param so that scan only returns some attribues.
* Only eventual consistent reads are available (not strong consistecy).
* As the table grows, the scan slows.
* The more filters, the slower performance of a scan.

## Query vs Scan
 * Query is more efficient than Scan
 * Avoid using Scan on large table.

## Provisioned Throughput
* When you create a table, you specify how much provisioned throughput capacity you want to reserve for reads and writes.
* **Capacity unit** - is the unit of provisioned throughput.
* **One Read Capacity unit**
  ```
  Reads are in blocks of 4KB.
  = Strongly consistent = 1 read per second
  = Eventually consistent = 2 read per second
  ```
* **One Write Capacity Unit**
    ```
    Writes are in blocks of 1KB.
    one write per second.
    ```
* If you exceed your max allowed provisioned throughput for a table or for one or more global secondary indexes? You get 400 http status code **ProvisionedThroughputExceededException**
## Read Throughput
```
(size of read rounded to the nearest 4KB chunk / 4 KB) x no of items = read throughput.
divided by 2 if eventually consistent.
```
e.g. Your app requires to read 10 items (of 1KB ea) per second using eventual consistency. What should you set the throughput to?
* 1KB rounded to the nearest 4KB = 4KB.
* 4KB / 4KB = 1
* 1 x 10 = 10
* 10 / 2 = 5 units of read throughput.

e.g. App requires to read 10 items of 6KB per second using eventual consistency.
What should you set the read throughput to?
* 6KB rounded to the nearest increment of 4KB = 8KB
* 8KB / 4KB = 2
* 2 x 10 = 20
* 20 / 2 = 10 units of read throughput.

e.g. App requires to read 5 items of 10KB per second using eventual consistency.
* 10KB rounded to nearest 4KB increment = 12KB
* 12KB / 4 = 3
* 3 x 5 = 15
* 15 / 2 = 7.5 = 8 units of read throughput.

## Write Throughput
e.g. App requires to write 5 items. Each item = 10KB per second.
5 x 10KB = 50 write units throughput.

## Web Identity providers to authenticate to DynamoDB
1. User authenticates with ID provider (eg. Google, Facebook).
2. User is given back a token by ID Provider.
3. Your code calls AssumeRoleWithWebIdentity API and provides the ProviderID token and RoleARN for the IAM Role.
4. Your App can now access DyanmoDB from between 15mins to 1hr (default is 1hr).


text:
Junk
====
![](https://travis-ci.org/eightdatabits/junk.svg?branch=master)

A library containing a random assortment of useful embedded code. This includes a HAL with drivers
for AVR and STM32 parts as well as general use code such as memory, math, and container objects and
functions.

JunkHAL
-------

The JunkHAL currently only supports AVR processors. To build JunkHAL for all supported processors:
```
$ cd <junk_root>/hal/avr
$ make libs
```
Use `make help` to see all build options.

repository: eightdatabits/junk

repo_name: eightdatabits/junk


text:
#### 2. Perf: Basics II

----

Performance monitoring and tracking tools can provide a wealth of information about a running system. In some cases, they can help identify anomalies which could have been caused by a security incident.

----

In this lab, the server was compromised and the attacker was running a crypto miner on the same machine.

----

We have provided the tool "perf" and its "capture" file to you. Please analyze the details and answer the following questions:

- What is the name of the crypto miner service?

```sh
root@attackdefense:~# perf report
```

![](images/1/1.png)

![](images/1/2.png)

```
dcgxvwaenrsorbfsdfvzcasrvxc
```

- The mining service used a configuration file to connect to the pool server. Provide the complete path of the configuration file.

![](images/1/2.png)

```sh
/usr/bin/config.cfg
```

- Retrieve the plain-text password used by the service to connect to the pool server.

```sh
root@attackdefense:~# cat /usr/bin/config.cfg

#
# RPC login details
#
host=dqdaicaxcmgs.dev.local
port=5555
#port=8332

#
# base64 encoded the username and password
#

rpcuser=bW9uZXJvLW1pbmVy
rpcpass=bjB0czBzM2N1cjNwNHNzdzByZA==

#
# mining details
#

threads=4

# periodic rate for requesting new work, if solution not found
scantime=60

#
# misc.
#

# not really used right now
logdir=/tmp/miner

# set to 1, to enable hashmeter output
hashmeter=0
root@attackdefense:~#
```

```sh
root@attackdefense:~# echo bjB0czBzM2N1cjNwNHNzdzByZA== | base64 -d
n0ts0s3cur3p4ssw0rd
root@attackdefense:~#
```

----

###### Reference

- Perf can be invoked using `perf` command.
- [Perf documentation](https://perf.wiki.kernel.org/index.php/Main_Page)

----

EOF