text:
# search-data-exports-backend

Exploration of various large-scale data export techniques for browser-based users, using an AWS Serverless Lambda backend and an Elasticsearch datasource.

Exporting data via a web application, where large results sets are generated is a very common use case. Typically, the export process itself is asynchronous, due to the time taken to generate the data, either due to the large amount of data or time intensive processing against the data. This repository (and the related [frontend repository](https://github.com/ScottLogic/search-data-exports-frontend)) demonstrate worked examples of a number of techniques for achieving this. For a more in depth look at some of the features in this repository you can check out our blog posts on [Email Digests with Elasticsearch via a Serverless Architecture](https://blog.scottlogic.com/2019/11/28/email-digests-with-elasticsearch-via-a-serverless-architecture.html) and [Generating SVG and PDF reports from Elasticsearch](https://blog.scottlogic.com/2019/12/02/Search-Data-Visualisation.html).

## Twitter Clone

To provide a dataset to help us explore this topic, a very basic Twitter clone has been created. The application is pretty simple for our purposes. The functionality required:

* Perform a text search against a data source
* Display the search results in a paginated form
* Allow the user to generate an export CSV file for the entire result set in a number of ways:
  * Download the export file, polling to see if the generation is complete
  * An email notification is sent to the user with a download link when the export file generation is complete
  * Download the export file, with a push notification via websockets when the generation is complete

At a high level, the application looks like this:
![high-level-infrastructure.png](docs/high-level-infrastructure.png)

## AWS Infrastructure

To build the necessary infrastructure we utilise two "infrastructure as code" services, namely:

* Terraform
* Serverless Framework

We used Terraform for the more static parts of the infrastructure, whereas the Serverless framework was used for the more dynamic infrastructure, that are changed often, such as Lambda's, Step Functions.

Terraform is used to create the following AWS services:

* Elasticsearch cluster
* S3 buckets

The Servlerless framework is used to create the more dynamic AWS services, related to our actual code:

* Lambda's
* Step Functions
* API Gateway (HTTP and Websocket)
* Cognito authentication

### Elasticsearch

A `t2.small.elasticsearch` cluster is created with a single index called posts. The posts index contains the following fields to support our Twitter clone posts:

* UserId - the id of the user who posted
* DateCreated - when the post was created
* Content - the actual post
* Tags - any hashtags associated with the post

#### Data Helix

We utilise an existing Scott Logic tool called [Data Helix](https://github.com/finos/datahelix), which generates test and simulation data, to populate our Elasticsearch index with meaningful data.

Data Helix generates skeleton test data and which we then enhance using randon strings to represent post context and tags. The resultant CSV file is then converted into JSON and imported into Elasticsearch. The project files for this can be found in:

* [Data import](dataimport)

### S3 Buckets

Two buckets are created:

* Public website bucket to host the [React frontend app](https://github.com/ScottLogic/search-data-exports-frontend)
* Private bucket to temporarily store the data export CSV files.
** Files in this bucket are all private and we return signed URL's to the user for each export
** The bucket has a lifecycle rule, which automatically expires files after a day to ensure the bucket isn't continuously growing in size

## Frontend

The [frontend](https://github.com/ScottLogic/search-data-exports-frontend) is written using React / Redux and utilises the AWS Amplify library, which allows us to leverage the AWS Cognito authentication service, giving us a login page and signup page for free.

Once the user has logged in, a text box is displayed allowing the user to search the posts in the Elasticsearch cluster. A paginated list of matching searches is displayed to the user, and an "Export Results" button is enabled if there are matching results. On clicking the button, the following options are available:
![download-types.PNG](docs/download-types.png)

Each of the export options will be explored in the following section.

## Export Results

There is a single API called `/download-request` which is called for all three types of download. The payload consists of the download type and the origin search criteria

~~~json
{
  "type":"direct",
  "searchCriteria":{
    ...
  }
}
~~~

The `type` field can be one of following:

* `direct`
* `email`
* `push`

Given the data export is an asynchronous request, the response is an `executionArn` which the frontend can use to determine if the download is complete, depending on the export type selected.

### The Download Request Lambda

The `/download-request` API in API Gateway calls the `downloadRequest` Lambda, which in turn starts the execution of an AWS Step Function to handle the 3 different download request types:
![Download-request.png](docs/download-request.png)

The Lambda then returns the `executionArn` of the Step Function, which then executes asynchronously.

### The download-request Step Function

The Step Function has 3 alternative paths, depending on the value contained in `type`.

~~~json
{
  "Choose download type": {
    "Type": "Choice",
      "Choices": [
      {
        "Variable": "$.type",
        "StringEquals": "email",
        "Next": "Email report request"
      },
      {
        "Variable": "$.type",
        "StringEquals": "direct",
        "Next": "Direct download of report"
      },
      {
        "Variable": "$.type",
        "StringEquals": "push",
        "Next": "Push notification report request"
      }
    ]
  }
}
~~~

![download-request-step-function.PNG](docs/download-request-step-function.png)

### Direct download

When the `type=direct`, the `Direct download of report` choice is selected in the Step Function.

![Direct-download-step-function.png](docs/direct-download-step-function.png)

Whilst the report is generating, the frontend will poll the backend using the `executionArn` returned from the downloadRequest Lambda. Once complete, the signed URL for the generated report will be returned to the frontend:
![direct-download-report-status.png](docs/direct-download-report-status.png)

### Email report
When the `type=email`, the `Email report request` choice is selected in the Step Function. The same Lambda is called to generate the report, but the signed URL output of the report generation is passed into the `Email CSV Report link to user` step.

The email step uses the authenticated users email passed from the initial `/download-request` via a JWT, generates an email with the signed URL as the email body, and sends an email to the user via AWS Simple Email Services

![email-step-function.png](docs/email-step-function.png)

### Push Notification report
When the `type=push`, the `Push notification report request` choice is selected in the Step Function. For this notification type, rather than the frontend polling the backend for the report generation completion, the backend will send a notification to the frontend using websockets.

We make use of an AWS Step Function Activity, to handle the frontend connecting to a websocket via API Gateway. For the example, the Activity is called AwaitOpenConnectionFromClient.

For a push notification, we return a `taskToken` for the `AwaitOpenConnectionFromClient` activity as well as the `executionArn` during the initial `/download-request`:
![Download-request-push.png](docs/download-request-push.png)

The frontend then connects to a websocket using API Gateway, passing the `executionArn` and `taskToken`. API Gateway, triggers a lambda called `pushNotificationOpenConnection` on an `OpenConnection` event on the API Gateway (WEBSOCKET), and this Lambda marks the `AwaitOpenConnectionFromClient` as complete and passes in the `connectionId` into the step.
![open-connection-push.png](docs/open-connection-push.png)

The `Await OpenConnection from Client` step will complete, once the frontend opens a websocket connection, and once the parallel task `Generate CSV Report for push notification` step is complete, the backend pushes the report URL via the websocket the frontend opened via a Lambda.
![push-step-function.png](docs/push-step-function.png)

### Notes - 23/08/2019

The serverless dev dependency has been locked at version 1.49.0 as the latest version (1.50.0) currently causes the following error output:
```
Serverless: Installing dependencies for custom CloudFormation resources...
EMFILE: too many open files ...
```
Until a patch is released for the Serverless Framework the version will remain fixed at 1.49.0

repository: ScottLogic/search-data-exports-backend

repo_name: ScottLogic/search-data-exports-backend


text:
STLViewer
=========

[STL](http://en.wikipedia.org/wiki/STL_(file_format)) 3D object file viewer for java.

# install
unzip distributed stlviewer*.zip

should extract:
stlviewer.jar
libs/j3dcore.jar
libs/j3dutils.jar
libs/jogamp-fat.jar
libs/vecmath.jar
, etc to a directory

# run
java -jar stlviewer.jar
(the above libs jars should be in libs subdirectory)

- holding / dragging the left mouse button rotates the model
- holding / dragging the right mouse button pan the model
- rotating the mouse wheel forward moves away from the model / backward moves towards the model
- clicking home on the toolbar reverts to the initial view

# build

ant
(ant and jdk is required for the build')

# Pre-requisites

Java >= 1.6

# note
- the app resizes the model and relocates the origin to ease viewing manipulations

# Attributions
this app/project uses/is made possible by the java3d and jogl implementations maintained by the jogamp community
and part are derivatived works in particular of java3d from sun/oracle
- http://jogamp.org/
- https://gouessej.wordpress.com/2012/08/01/java-3d-est-de-retour-java-3d-is-back
- https://github.com/hharrison/java3d-core
- https://github.com/hharrison/java3d-utils
- https://github.com/hharrison/vecmath
- http://jogamp.org/deployment/v2.3.2/fat/jogamp-fat.jar

and the stl parser by cyanobacterium
https://github.com/cyanobacterium/STL-Parser-for-Java

partially derived from
cpedrinaci/STL-Loader https://github.com/cpedrinaci/STL-Loader

# Licence

[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)
applies to code package org.stlviewer sub-branch

Software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

# origin
originally hosted on: https://github.com/ag88/stl-viewer

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
Two common types of numbers in Ruby are:

- Integers: numbers with no digits behind the decimal separator (whole numbers). Examples are `-6`, `0`, `1`, `25`, `976` and `500000`.
- Floating-point numbers: numbers with zero or more digits behind the decimal separator. Examples are `-2.4`, `0.1`, `3.14`, `16.984025` and `1024.0`.

They are implemented through the `Integer` and `Float` classes.

The `Float` and `Integer` classes have methods that will coerce values from one to the other. `Integer` numbers are precise to a whole unit, while `Float` has precision that is fractional to an whole number.

In this exercise you must conditionally execute logic. A common way to do this in Ruby is by using an `if/else` statement:

```ruby
x = 5

if x == 5
  # Execute logic if x equals 5
elsif x > 7
  # Execute logic if x greater than 7
else
  # Execute logic in all other cases
end
```

license: MIT

gha_license_id: MIT


text:
## 10 Ways to Rock a Conference
[Reference](http://www.scienceofpeople.com/2015/03/10-ways-to-rock-a-conference/)

- Conferences pros: look forward to their event because they know they will get new business from it, they know how to work a room and walk up to a stranger, they aren't sleazy, schmoozer types, and they can manage the schedule, land VIP coffees, and kill it at after-parties.

### Your Assets

- *Your badge.* This is your first impression/conversation starter. It is your key to interaction. Make sure your name/company is spelled right. Add conversation starters--vacation spot, music you listened to, interesting fact.
- Business card--I suggest to add your picture to the business card. Bring a ton of cards.

### Pitch Perfect

- Make your pitch niched and specific for conference attendees: "My name is Vanessa and I run a human behavior research lab that looks for patterns on how people use technology."
- Reference the conference: "I'm at so-and-so looking for ideas for my human behavior research lab.
- Reference them if you know what they do from their badge or their introduction--"I help journalists like you find interesting human behavior research to write about."
- Offer: I was invited a trend conference as a blogger, my goal was to find interesting people to cover. I went around offering coverage, there was no real benefit to me, I was just looking for cool people to feature and drive traffic to.
- When thinking about your event, don't think about what you need or what you want to ask for, focus only on what you can offer. How can you help people at the conference? What can you give them? What do you have to offer this conference?
- *When we are in the ask mentality, we are in scarcity and we are in need. When we are in the offer mentality, we are in abundance and we are at ease.*

### The Context Come On

- I never approach someone cold at an event.
- Master the context. Use your location or surroundings to make an opening line and conversation easy.
- Look for lines at conferences because it is the easiest way to meet the person in front and behind you.
- I never pass up the opportunity to get to a session 5 minutes early and sit at a partially full table or block of seats with people.
- Contexts:
  - Lunch table: "Enjoying the conference so far?"
  - Coffee line: "Juicing up for the big keynote?"
  - Bathroom line: "How are you liking today's sessions?"
  - Seat mate: "What brings you to this session?"
  - Badge line: "Come to a lot of conferences like this?"
  - Elevator: "Been to this conference before?"
- **The best pick up line ever: "Hello, how are you?"**

### In Like Flynn

- Starters: "What did you think of the keynote?", "Have you learned anything interesting so far?", "Which break-out session are you going to?", "Any booths I should stop by in the Exhibition Hall?"
- Killer conversation starters
  - "Working on any personal passion projects?"
  - "What are you looking forward to for the rest of the day?"
  - "Working on interesting projects these days?"
  - "Tell me about you."
  - "What's your story?"
  - "What personal passion project are you working on right now?"
  - "Working on anything exciting lately?"
  - "How do you know the host?"
  - "How do you know the host?"
  - "Have you been to an event like this before?"
  - "What was the highlight of your day today?"
  - "What was the highlight of your week?"
  - "What was the high-point and low-point of your day so far?"

### Out Like Scout

- Graceful exit: Genuine Compliment + Follow-up Item + Handshake = Graceful Exit.
- "It's been a pleasure talking to you.", "I loved hearing about your business idea".
- "I'll follow-up with you on email", "Hope to see you at the after-party tonight", "Pass me your business card and I'll find you on LinkedIn".
- Handshake: clear cue that you want to exit.

### Tricks of the Trade

- Look at the agenda to see which sessions you want to prioritize. Get a map if it is a big conference so you aren't relying on slow wifi connections to figure out where you are going.
- Beware of conference buddies--it is hard to network well when you are with someone else.
- Use the event hashtag.
- Thank the organizers and conference planning committee.

license: Unlicense

repository: daryllxd/lifelong-learning

gha_language: Elixir

gha_license_id: Unlicense

repo_name: daryllxd/lifelong-learning


text:
This ain't cyberpunks.
I never joined that motherfucking list.  If you want
to talk to me, you dump the motherfucking list.

If you want to talk to me, you go to the Freedom-Knights
or the InterNet Freedom Council ONLY.

> On Sat, 16 Nov 1996, legal expert aga wrote:
>
> > ...cypherpunks is an "all or nothing" proposition...After a
> > certain level, EVERYTHING reaches the "public doamin," and that
> > is the *common-law of cyberspace.*
>
> As I'm sure aga knows, "common law" is that form of jurisprudence
> in which cases of first which are appealed to a higher court set
> legal precedents which are subsequently binding on lower courts.
>
> I must admit, it appears "Aga" has the advantage of me, as I did
> not study the *common-law of cyberspace* back when I was in law
> school.  (Unfortunately, my education pre-dates the existance of
> cyberspace.)
>

What year did you graduate from Law School?

> As a favor to me and other's on the list who would like to know
> as much as "Aga" does about the *common-law of cyberspace* I ask
> "Aga" to please share his knowledge with us.  For starters, a
> list of the most relevant appelate cases embodied in the *common-
> law of cyberspace* would be appreciated.
>
>
>  S a n d y
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>

Just how old are you, Sandy?


text:
# How to use Mountain Duck with Minio [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/minio/minio?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

In this recipe you will learn how to carry out basic operations on Minio using Mountain Duck. Mountain Duck lets you mount server and cloud storage as a local disk in the Finder.app on Mac and the File Explorer on Windows. It is released under the GPL license v2.0.

## 1. Prerequisites

* [Mountain Duck](https://mountainduck.io/) is installed and running.  We are using ``S3(HTTP)`` profile for this setup.

* Minio Server is running on localhost on port 9000 in ``HTTP``, follow [Minio quickstart guide](https://docs.minio.io/docs/minio-quickstart-guide) to install Minio.

_NOTE:_ You can also run Minio in ``HTTPS``, follow this [guide](https://docs.minio.io/docs/generate-let-s-encypt-certificate-using-concert-for-minio) along with Mountain Duck ``S3(HTTPS)`` profile.

## 2. Steps

### Add Minio authentication in Mountain Duck

Click on Mountain Duck icon and open the application via navigation menu. Click open connection, select ``S3(HTTP)``

![I_IMAGE](https://github.com/minio/cookbook/blob/master/docs/screenshots/mountainduck/defaultdashboard.jpg?raw=true)

### Replace the existing AWS S3 details with your local Minio credentials

![MINIO_DASH](https://github.com/minio/cookbook/blob/master/docs/screenshots/mountainduck/connecttominio.jpg?raw=true)

![MINIO_DASH2](https://github.com/minio/cookbook/blob/master/docs/screenshots/mountainduck/connecttominio1.jpg?raw=true)

### Click on the connect tab to establish connection.

You will be asked to connect via insecure connection since we are using HTTP instead of HTTPS, accept it. Once the connection is established you can explore further, some operations are listed below.

#### List Bucket

![B_LISTING](https://github.com/minio/cookbook/blob/master/docs/screenshots/mountainduck/listbuckets.jpg?raw=true)

#### Copy bucket to local file system

![D_BUCKET](https://github.com/minio/cookbook/blob/master/docs/screenshots/mountainduck/copybucket.jpg?raw=true)

#### Delete Bucket

![D_BUCKET](https://github.com/minio/cookbook/blob/master/docs/screenshots/mountainduck/deletebucket.jpg?raw=true)

## 3. Explore Further

* [Minio Client complete guide](https://docs.minio.io/docs/minio-client-complete-guide)
* [Mountain Duck project homepage](https://mountainduck.io)

repository: cloudberrylab/cookbook

repo_name: cloudberrylab/cookbook


text:
# Chuvash Keyboard Setup
This information is maintained by Miron Toli @mirontoli. Last updated 2017-02-02.

1. [Windows](#windows)
1. [Android](#android)
1. [iOS](#ios)
1. [Linux](#linux)
1. [Mac](#mac)
1. [Web](#web)

## Windows
The Chuvash Keyboard Layout allows you to type Russian as you would with the usual Russian layout,
but you will also have access to the Chuvash letters Ӑ Ӗ Ҫ Ӳ.
They can be typed by holding the AltGr key and typing А Е С У.

### How to Install

1. Download [the installation file](http://bit.ly/cv-kbd-win) and unzip it.

2. Run `setup.exe`.

  ![Installer](img/cv-kbd-win-001.png)

3. Close the window after the installation is complete:

  ![Complete](img/cv-kbd-win-002.png)

4. Done! To change the keyboard layout to Chuvash, click on the language panel:

  ![Change Language](img/cv-kbd-win-003.png)

### Additional Letters
As a bonus, you will have access to the old Chuvash characters (Zolotnitsky, Yakovlev and Ashmarin),
and also symbols used in the formatting of articles on Wikipedia. If you are interested, you can learn more
at the [Ashmarin Keyboard Layout Project Page](http://bit.ly/asm-kbd).

## Android

Install the [Chuvash Keyboard](http://bit.ly/cv-kbd-android) from the Google Play Store.
Follow the instructions in the application.

Find the application in the Google Play Store:

![Chuvash Keyboard in Google Play Store](img/cv-kbd-android-001-en.png)

Click "Install":

![Installation of Chuvash Keyboard on Android](img/cv-kbd-android-003-ru.png)

Open the application:

![Open](img/cv-kbd-android-004-ru.png)

Press "1. Ҫак сарӑма ҫутӑр" (translation: Activate this keyboard):

![Setup](img/cv-kbd-android-005.png)

Activate "Чӑваш сарӑмӗ" (translation: Chuvash keyboard):

![Setup](img/cv-kbd-android-006.png)

When a warning pops up, press "OK":

![Setup](img/cv-kbd-android-007-ru.png)

Select the keyboard by clicking on "2. Ҫак сарӑма суйлӑр" (translation: Select this keybord).
On the next menu, click "Чӑвашла":

![Setup](img/cv-kbd-android-008.png)

## iOS

Download the application [Чувашская клавиатура](http://bit.ly/cv-kbd-ios) (translation: Chuvash keyboard) by Andrey Fetisov,
which costs about 70 Rubles or $0.99.

![Чувашская клавиатура](img/cv-kbd-ios-001-ru.png)

Open the application and set up the keyboard as shown in the instructions (in Russian):

![Setup of Чувашская клавиатура on iOS](img/cv-kbd-ios-002.png)

## Linux

The Chuvash keyboard on Linux is built in. Just like on Windows, you can type the Chuvash letters Ӑ Ӗ Ҫ Ӳ
by pressing AltGr and one of the letters А Е С У.
You will also be able to type Russian.

### Setup Instructions
We will show step-by-step instructions for the popular distro Ubuntu.

1. Right-click on the language menu in the upper right-hand corner of the screen:

  ![Language Menu](img/cv-kbd-ubuntu-001.png)

2. In the window that opens, click on + to add an additional keyboard. Type `chu` and click Add.

 ![Keyboard Setup](img/cv-kbd-ubuntu-002.png)

3. Done! To change the keyboard, click on the language menu icon.

## Mac

The Chuvash Keyboard Layout (Input Source) was created using Ukulele according to the steps described in [Salvatore Testas blog post](https://saltesta.com/hack/customizing-mac-input-source-icon/).

![Choosing Chuvash Input source](img/cv-kbd-mac-000.png?raw=true)

## How to install
1. Download [ChuvashKeyboardOSX.bundle.zip](http://bit.ly/cv-kbd-mac)

  ![Download](img/cv-kbd-mac-001.png?raw=true)

2. Open `~/Library/Keyboard\ Layouts/` in Finder from terminal (because it is a hidden folder)

  ![Open](img/cv-kbd-mac-003.png?raw=true)

3. Copy ChuvashKeyboardOSX.bundle into Keyboard Layouts directory.

  ![Copy](img/cv-kbd-mac-004.png?raw=true)

4. Restart computer
5. Add Chuvash - PC as input source.

  ![Add input source](img/cv-kbd-mac-005.png?raw=true)

### Additional Characters

In the Chuvash keyboard for Mac OS we have added additional characters: the old Chuvash characters, and characters used to write
other languages of the Russian Federation.
If you need to type in Russian, Chuvash, Tatar, or, say, Udmurt, you can find more detailed information at the
[Keyboard Layout for Mac OS Project Page](https://github.com/mirontoli/chuvash-kbd/tree/master/Mac).

## Web
If you are using another person's computer, or you don't have permission to install programs on your computer
(for example, at work), you can use our virtual keyboard in your browser.
Go to [chuvashskaya.klaviatura.su](http://bit.ly/cv-kbd-web), type what you need to type, and then copy and paste it elsewhere.

![Browser Keyboard](img/cv-kbd-web.png)

repository: mirontoli/chuvash-kbd

repo_name: mirontoli/chuvash-kbd


text:
# TwiFi
TwiFi is a simple library which allows you to easily manage the WiFi connections on your ESP8266 or ESP32. This is a new version of my old [TwiFi Module (RETIRED)](https://github.com/Thorinair/TwiFi-Module-RETIRED), as using the old one has proven to be horrible in the long run.

NOTE: TwiFi saves WiFI status on the EEPROM, specifically on memory positions 0 and 1. Please don't use these in your own code.

# Usage
Include the library in your sketch. Call the `twifiInit` function and pass all the relevant parameters in your `setup()`. Please refer to the TwiFi.h file for details on which parameters should be used. To begin connecting, call the `twifiConnect` function and pass a bool parameter to tell it whether it should continuously loop through all WiFis.

For a real example, please check the examples folder in the repository.

repository: Thorinair/TwiFi

repo_name: Thorinair/TwiFi


text:
# WebSockets

WebSockets are designed as full-duplex communication channels over a single TCP connection. The WebSocket protocol facilitates the real-time data transfer from and to a server. This is made possible by providing a standardized way for the server to send content to the browser without being solicited by the client, and allowing for messages to be passed back and forth while keeping the connection open. In this way, a bi-directional (two-way) ongoing conversation can take place between browser and server. The communications are typically done over standard TCP ports, such as 80 or 443.

The WebSocket protocol is currently supported in most major browsers including Google Chrome, Microsoft Edge, Internet Explorer, Firefox, Safari and Opera. WebSockets also require support from web applications on the server.

## Relevant Examples

* [Perfect-Chat-Demo](https://github.com/PerfectExamples/Perfect-Chat-Demo)
* [Perfect-WebSocketsServer](https://github.com/PerfectExamples/Perfect-WebSocketsServer)

## Getting started

Add the WebSocket dependency to your Package.swift file:

``` swift
.Package(url:"https://github.com/PerfectlySoft/Perfect-WebSockets.git", majorVersion: 3)
```

Then import the WebSocket library into your Swift source code as needed:

``` swift
import PerfectWebSockets
```

A typical scenario is communication inside a web page like a chat room where multiple users are interacting in near-real time.

This example sets up a WebSocket service handler interacting on the route `/echo`:

``` swift
var routes = Routes()

routes.add(method: .get, uri: "/echo", handler: {
		request, response in
    // Provide your closure which will return the service handler.
    WebSocketHandler(handlerProducer: {
        (request: HTTPRequest, protocols: [String]) -> WebSocketSessionHandler? in

        // Check to make sure the client is requesting our "echo" service.
        guard protocols.contains("echo") else {
            return nil
        }

        // Return our service handler.
        return EchoHandler()
    }).handleRequest(request: request, response: response)
	}
)
```

## Handling WebSocket Sessions

A WebSocket service handler must implement the `WebSocketSessionHandler` protocol.

This protocol requires the function `handleSession(request: HTTPRequest, socket: WebSocket)`. This function will be called once the WebSocket connection has been established, at which point it is safe to begin reading and writing messages.

The initial `HTTPRequest` object which instigated the session is provided for reference.

Messages are transmitted through the provided WebSocket object.

* Call `WebSocket.sendStringMessage` or `WebSocket.sendBinaryMessage` to send data to the client.
* Call `WebSocket.readStringMessage` or `WebSocket.readBinaryMessage` to read data from the client.

By default, reading will block indefinitely until a message arrives or a network error occurs.

A read timeout can be set with `WebSocket.readTimeoutSeconds`.

Close the session using `WebSocket.close()`.

The example `EchoHandler` consists of the following:

``` swift
class EchoHandler: WebSocketSessionHandler {

	// The name of the super-protocol we implement.
	// This is optional, but it should match whatever the client-side WebSocket is initialized with.
	let socketProtocol: String? = "echo"

	// This function is called by the WebSocketHandler once the connection has been established.
	func handleSession(request: HTTPRequest, socket: WebSocket) {

		// Read a message from the client as a String.
		// Alternatively we could call `WebSocket.readBytesMessage` to get the data as an array of bytes.
		socket.readStringMessage {
			// This callback is provided:
			//	the received data
			//	the message's op-code
			//	a boolean indicating if the message is complete
			// (as opposed to fragmented)
			string, op, fin in

			// The data parameter might be nil here if either a timeout
			// or a network error, such as the client disconnecting, occurred.
			// By default there is no timeout.
			guard let string = string else {
				// This block will be executed if, for example, the browser window is closed.
				socket.close()
				return
			}

			// Print some information to the console for informational purposes.
			print("Read msg: \(string) op: \(op) fin: \(fin)")

			// Echo the data received back to the client.
			// Pass true for final. This will usually be the case, but WebSockets has
			// the concept of fragmented messages.
			// For example, if one were streaming a large file such as a video,
			// one would pass false for final.
			// This indicates to the receiver that there is more data to come in
			// subsequent messages but that all the data is part of the same logical message.
			// In such a scenario one would pass true for final only on the last bit of the video.
			socket.sendStringMessage(string, final: true) {

				// This callback is called once the message has been sent.
				// Recurse to read and echo new message.
				self.handleSession(request, socket: socket)
			}
		}
	}
}
```

## FastCGI Caveat
WebSockets serving is only supported with the stand-alone Perfect HTTP server. At this time, the WebSocket server does not operate with the Perfect FastCGI connector.

## WebSocket Class

### enum OpcodeType
WebSocket messages can be various types: continuation, text, binary, close, ping or pong, or invalid types.

### var readTimeoutSeconds
When trying to read a message from the current socket, this property helps the socket to read a message before timeout. If this property has been set to NetEvent.noTimeout (-1), it will wait infinitely.

### read message
There are two ways of reading messages: text or binary, which differ only in the data type returned, i.e. String and [UInt8] array respectively.

#### read text message:

``` swift
public func readStringMessage(continuation: @escaping (String?, _ opcode: OpcodeType, _ final: Bool) -> ())
```

#### read binary message:

``` swift
public func readBytesMessage(continuation: @escaping ([UInt8]?, _ opcode: OpcodeType, _ final: Bool) -> ())
```

There are three parameters when it calls back:

#### String / [UInt8]
readMessage will deliver the text / binary data sent from the client to your closure by this parameter.

#### opcode
Use opcode if you want more controls in the communication.

#### final
This parameter indicates whether the message is completed or fragmented.

### send message
There are two ways of sending messages: text or binary, which differ only in the data type sent, i.e. String and [UInt8] array respectively.

#### send text message:

``` swift
public func sendStringMessage(string: String, final: Bool, completion: @escaping () -> ())
```

#### send binary message:

``` swift
public func sendBinaryMessage(bytes: [UInt8], final: Bool, completion: @escaping () -> ())
```

Parameter final indicates whether the message is completed or fragmented.

### ping & pong

Perfect WebSocket also provides a convenient way of testing the connection. The ping method starts the test and expects a pong back.

Check out these two methods:

``` swift
/// Send a "pong" message to the client.
public func sendPong(completion: @escaping () -> ())

/// Send a "ping" message to the client.
	/// Expect a "pong" message to follow.
public func sendPing(completion: @escaping () -> ())
```

### func close()
To close the WebSocket connection:

``` swift
socket.close()
```

For a Perfect WebSockets server example, visit the [Perfect-WebSocketsServer](https://github.com/PerfectExamples/Perfect-WebSocketsServer) demo.

repository: fanguohuiruan/PerfectDocs

repo_name: fanguohuiruan/PerfectDocs


text:
# _Template_

#### By __

## Description

_A template java app for use with gradle and junit_

## Setup/Installation Requirements

* _Copy the repository from GitHub_
* _Open in code editor of your choice_
* _Make sure you have gradle and junit installed!_

## GitHub link

https://github.com/ewajm/javaTemplate

## Licensing

* MIT

Copyright (c) 2016 **__**


text:
{{#template name="react-step05"}}

# Checking off and deleting tasks

Until now, we have only interacted with a collection by inserting documents. Now, we will learn how to update and remove them.

Let's add two new elements to our `task` component, a checkbox and a delete button, with event handlers for both:

```js
// Replace the Task component with this new one
// that has a checkbox and a delete button
Task = React.createClass({
  propTypes: {
    task: React.PropTypes.object.isRequired
  },
  toggleChecked() {
    // Set the checked property to the opposite of its current value
    Tasks.update(this.props.task._id, {
      $set: {checked: ! this.props.task.checked}
    });
  },
  deleteThisTask() {
    Tasks.remove(this.props.task._id);
  },
  render() {
    return (
      <li className={this.props.task.checked ? "checked" : ""}>
        <button className="delete" onClick={this.deleteThisTask}>
          ×
        </button>

        <input
          type="checkbox"
          readOnly={true}
          checked={this.props.task.checked}
          onClick={this.toggleChecked} />

        <span className="text">{this.props.task.text}</span>
      </li>
    );
  }
});
```

### Update

The `update` function on a collection takes two arguments. The first is a selector that identifies a subset of the collection, and the second is an update parameter that specifies what should be done to the matched objects.

In this case, the selector is just the `_id` of the relevant task. The update parameter uses `$set` to toggle the `checked` field, which will represent whether the task has been completed.

### Remove

The `remove` function takes one argument, a selector that determines which item to remove from the collection.

### Using object properties or helpers to add/remove classes

If you try checking off some tasks after adding all of the above code, you will see that checked off tasks have a line through them. This is enabled by the following snippet:

```html
<li className={this.props.task.checked ? "checked" : ""}>
```

With this code, if the `checked` property of a task is `true`, the `checked` class is added to our list item. Using this class, we can make checked-off tasks look different in our CSS.
{{/template}}

repository: jbaxleyiii/tutorials

repo_name: jbaxleyiii/tutorials


text:
# dev-perl/Authen-SASL

### kerberos
Pull in the [dev-perl/GSSAPI](../dev-perl/GSSAPI.md) package as a dependency. Provide support for client part of the GSSAPI SASL algorithm, as described in RFC 2222 section 7.2.1.

This flag should be enabled if there is a need to handle GSSAPI SASL authentication in Perl, e.g. for LDAP.

repository: akater/gentoo-use-docs

repo_name: akater/gentoo-use-docs


text:
---
layout: portfolio_entry
l_title: Semi-Active Suspension Research
image: /img/VT_REU/VT_REU_LOGO.png
title: CenTiRe
image1: /img/VT_REU/Full_Rig_06042013.png
title1: The first iteration of the platform.
image2: /img/VT_REU/Testing_Rig_Picture.PNG
title2: High level overview of the design.
image3: /img/VT_REU/Test_Rig_07152013.png
title3: Final iteration.
image4: /img/VT_REU/Capture.PNG
title4: Performing FEA on various elements.

---
REU at Virginia Tech

During the summer between my sophomore and junior years, I spent a memorable summer at Virginia Tech, working with Dr. Saied Taheri as part of the Center for Tire Research. During my ten weeks with the program, my research focused on designing a testing platform for semi-active suspensions. Given my passion for cars and land vehicles, it was everything I had hoped for and more. At night, I would read material on topics like vehicle dynamics and tire mechanics. I came to better understand where my passions lie, as well as gained experience managing an open ended project, setting my own goals and expectations. While there wasn’t enough time to build the rig, my partner, Jordan Ikeda, and I thoroughly reviewed the designs and gathered all the materials. In the Fall of 2013, the project continued as Jordan’s senior design project, backed by General Motors. In addition, our research was selected by the Council for Undergraduate Research to be presented at their annual conference.


text:
---
layout: page
title: 'Publications'
subtitle:
---

“Tweets of a Native Son: The Quotation and Recirculation of James Baldwin from Black Power to #BlackLivesMatter,” *American Quarterly* 70, no. 3 (2018).

*You can [find this article on Project Muse](http://muse.jhu.edu/article/704336). Thanks to Johns Hopkins University Press’ publishing policies, which stipulate that I can include the piece on my "own
personal or departmental institutional database or on-line site," I am also making the [article available below](/pdf/AQ-Tweets-of-a-Native-Son.pdf):

<object data="/pdf/AQ-Tweets-of-a-Native-Son.pdf#page=2" type="application/pdf" width="100%" height="1000px">

This browser does not support PDFs. Please download the PDF to view it: Download PDF

</object>

gha_language: HTML


text:
![CrowdStrike Falcon](https://raw.githubusercontent.com/CrowdStrike/falconpy/main/docs/asset/cs-logo.png)

# Support

PSFalcon is a community-driven, open source project designed to assist administrators in leveraging the power of
CrowdStrike APIs within their organizations. While not a formal CrowdStrike product, PSFalcon is maintained by
CrowdStrike and supported in partnership with the open source community.

- [Issue Reporting](#issue-reporting)
- [Questions](#questions)
- [Discussions](#discussions)
- [Documentation](#documentation)
- [Contributing](#contributing)

## Issue Reporting

Issues may be reported [here](https://github.com/CrowdStrike/psfalcon/issues/new/choose) and are used to track
bugs, documentation and link updates, enhancement requests and security concerns.

### Escalation

Generally, we endeavor to provide support for using PSFalcon here within the repository. This expands our online
knowledge base, enables self-help for our community, and reduces the amount of time for you to receive answers.
Depending on the root cause, there is a possibility that an identified issue exceeds the scope of the PSFalcon
SDK and may require additional investigation. A maintainer may ask you to refer you to CrowdStrike technical
support should this occur.

If you are a CrowdStrike customer and you would prefer to have your questions or issues handled directly with
CrowdStrike Support, you are welcome to [contact the CrowdStrike technical support team](https://supportportal.crowdstrike.com/).

## Questions

Have a question you can't find answered in the [wiki](https://github.com/CrowdStrike/psfalcon/wiki) or [samples](https://github.com/CrowdStrike/psfalcon/tree/main/samples)?

Find out if anyone else in the community is experiencing the same issue on our [discussion board](https://github.com/CrowdStrike/psfalcon/discussions).

Issue reports that do not result in a bug finding, documentation or link update, security alert, or enhancement
request are converted into discussions. Discussions that relate to potential errors, documentation and link
updates, security concerns or enhancement requests will result in the generation of an issue report.

## Discussions
| | Category | Purpose |
| :--: | :--- | :--- |
| :speech_balloon: | [**General**](https://github.com/CrowdStrike/psfalcon/discussions/categories/general) | Catch all for general discussions. |
| :bulb: | [**Ideas**](https://github.com/CrowdStrike/psfalcon/discussions/categories/ideas) | Have a suggestion for a feature request? Let us know here. |
| :pray: | [**Q&A**](https://github.com/CrowdStrike/psfalcon/discussions/categories/q-a) | Have a question about how to accomplish something? Submit them here! |
| :raised_hands: | [**Show and Tell**](https://github.com/CrowdStrike/psfalcon/discussions/categories/show-and-tell) | Share with the community what you're up to! |

## Documentation

Extended documentation is available via the [wiki](https://github.com/CrowdStrike/psfalcon/wiki) for this
repository. It is updated as part of our release cycle.

Using `Get-Help <command>` from within a PowerShell session will provide basic command information. Adding the
`-Online` switch will link you directly to the relevant command page within the PSFalcon wiki.

## Contributing
Interested in contributing? Start [here](https://github.com/CrowdStrike/psfalcon/blob/main/CONTRIBUTING.md)!

repository: CrowdStrike/psfalcon

gha_language: PowerShell

repo_name: CrowdStrike/psfalcon


text:
docker-node-imagetools
======================

Docker container with Image Tools (ImageMagick + PDF Utils)

The following image tools are installed:

* Node
* ImageMagick (installed already by buildpack-deps, parent of node image)
* pdftk
* poppler-utils

repository: onesysadmin/docker-node-imagetools

repo_name: onesysadmin/docker-node-imagetools


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

### Description

Tivoli Endpoint in IBM Tivoli Management Framework 3.7.1, 4.1, 4.1.1, and 4.3.1 has an unspecified "built-in account" that is "trivially" accessed, which makes it easier for remote attackers to send requests to restricted pages via a session on TCP port 9495, a different vulnerability than CVE-2011-1220.

### POC

#### Reference
- http://www.securityfocus.com/archive/1/518199/100/0/threaded

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

repository: trickest/cve

branch_name: refs/heads/main

repo_name: trickest/cve


text:
KOTS Applications
==================

Manifests of multiple applications, showcasing how easy it is for various applications to get up and running with KOTS.

# Installing KOTS Applications to Existing Kubernetes Clusters

1. Identify the application slug based on the root directory of the application (e.g., for /nginx-ingress/, `APP_SLUG=nginx-ingress`)
2. Ensure that you have KOTS installed (e.g., `curl https://kots.io/install | bash`)
3. Execute `kots install` for the name of the application directory (e.g., `kubectl kots install nginx-ingress`)

# Installing KOTS Applications to Machines without Kubernetes (Embedded cluster installs)

1. Identify the application slug based on the root directory of the application (e.g., /nginx-ingress/, `APP_SLUG=nginx-ingress`)
2. Use `curl` to perform a `kURL Install` using the name of the application directory (e.g., `curl -sSL https://kurl.sh/$APP_SLUG | sudo bash`)

# List of Applications:

* nginx-ingress : Ingress setup to a running instance of NGINX
* [initcontainer-logs](./initcontainer-logs) : Example showing how to collect logs from init containers with [Troubleshoot.sh](https://troubleshoot.sh) collectors
* [postgres-snapshots](./postgres-snapshots) : Example showing best practices for integrating an application that requires a PostgreSQL database.
* [helm-grafana](./helm-grafana) : Example showing how to build a KOTS application using a helm chart. In this case, we use the Grafana helm chart.

# CONTRIBUTING

## Overview of CI

The CI process is as follows:
1. When GitHub detects a change within an application's directory, the CI process is started for each application.
2. The common makefile is copied to the local application directory, to ensure the same process for each application.
3. `make release` is executed on the copied makefile, which performs linting and attempts to make a new release.
4. If the release is successful, the CI process passes.

A common makefile is used in the CI process to ensure consistency across each KOTS application. As such, makefiles in each application directory are ignored in the repository.

## Developer Setup

1. Create a fork of this repository.
2. On your Vendor account (create one, if needed), create an API token from the [Teams and Tokens](https://vendor.replicated.com/team/tokens) page:

3. Ensure the token has "Write" access or you'll be unable create new releases.
4. Configure the `REPLICATED_API_TOKEN` github secret in your forked repository (see [configuring secrets](https://help.github.com/en/github/automating-your-workflow-with-github-actions/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables) for more details.
5. Set the `REPLICATED_API_TOKEN` in your local environment (e.g., `export REPLICATED_API_TOKEN=...`)
6. Go to the directory of the desired application (e.g., `nginx-ingress`) and copy the default makefile to the current directory.
7. Ensure the CLI is working by running `make list-releases`
7. To iterate on your application, simply push changes to the repository onto the master branch or a new branch. When changes are detected in the `app-slug/manifests` directory, a github action will initiate to make a new release on the channel of the same name.
8. To release a beta version of your application, simply push a new tag to the master branch starting with `v` followed by valid semver format (e.g., `v1.0.1`). Tags that aren't in this format will be ignored. When this tag is detected, a github action will initiate to make a new release on the "Beta" channel across all applications. Alternatively, you can use the built-in semver functionality and run `make tag-next-release`

## Creating a new kotsapp

1. Run the following script: `./common/init-new-app.sh <app_name>'. This will create a new directory for the app_name and populate with initial content (including github actions workflow).
2. Push the new app to github to create your first release on the 'Unstable' channel: `git push origin master`
3. In vendor web, create a license for Unstable channel and place in the root of the application directory. Once stable and beta releases are available, you can do the same for those channels as well (License.yaml, License-Unstable.yaml, License-Beta.yaml).

## Tools reference

- [replicated vendor cli](https://github.com/replicatedhq/replicated)

## License

MIT

repository: replicatedhq/kotsapps

gha_language: Mustache

repo_name: replicatedhq/kotsapps


text:
---
layout: lab
num: lab08
ready: true
desc: "Exercises in Pipelined MIPS CPU Design"
assigned: 2020-03-06 08:00:00.00-7
due: 2020-03-12 23:59:59.00-7
---

**Due Thursday, March 12th at 11:59 PM**

## Goals for This Lab

To analyze a pipelined MIPS CPU architecture and walk instructions through it, identifying and rectifying any hazards.

## Provided Files

You will be solving problems on paper/PDF. The problem set file is [lab08.pdf](/w20/lab/lab08/lab08.pdf).
Follow the instructions in the problem set file *carefully* and *fully*.
Submit your completed PDF on GauchoSpace.

## Submission Instructions

Submit your work to Gradescope to the entry labeled **lab08** (this will be set up by the weekend for your submissions).

Copyright 2020, Ziad Matni, CS Dept, UC Santa Barbara. Permission to copy for non-commercial, non-profit, educational purposes granted, provided appropriate credit is given;  all other rights reserved

gha_language: Shell


text:
## Documentation of Task 1 :rocket:

### Dealing and Evaluating an Initial Hand of Blackjack

##### Utilization of classes, collections and fuctions

The first line:
```
class Card(val pip: String, val suit: Char){

}
```
data class called Card with two members a String for the pip and a char for the suit.

I used unicode characters for the Suit instead of the regular C,S,D,H

Unicode | Meaning| Symbol/Output
------- | ------- | ---------------
'\u2663' | club | :clubs:
'\u2660' | spade |:spades:
'\u2666' | diamond | :diamonds:
'\u2665' | heart| :hearts:

##### Functions
- createDeck Function
- dealHand Function
- evaluateHand Function
- printResults

###### The output

```
Your hand was :
10 :hearts:
Q :clubs:
For a totalof :  20
You lost ;-(
```

path: /Week 1/README.md

gha_language: Kotlin


text:
## What is it?
It's a ray tracer on python 3

[Source (python 2)](http://www.excamera.com/sphinx/article-ray.html)

## Sample of output (1280x960)
![](https://github.com/maxkolotilin/RayTracing/blob/master/fig.png)

repository: maxkolotilin/RayTracing

repo_name: maxkolotilin/RayTracing


text:
---
id: API_ABI-WooCommercePlugin
title: WooCommerce Plugin
---
[//]: # (tagline)
The plugin parameters are defined in the widget as payment gateway settings in Woocommerce and also defined in the source file `kyber-settings.php`. The main logic of handling payments through the widget is defined in the source file `class-woo-kyber-payment-gateway.php`.

## Plugin Parameters
| Parameter |          Description          |     Example     |
| --------- | ----------------------------- | --------------- |
| `Title`   | Title to be displayed for the KyberWidget WooCommerce payment option for users in the checkout pages. | Kyber Payment Gateway |
| `Description` | Describe what the payment gateway is for. It will be displayed under the payment options. | Pay with tokens |
| `Receive Address` | Wallet address to receive the payment. This address is <b>required</b>. Without this address, payment will not be processed | `0xf6d420FAB01826386e39664770299eADD68617da` |
| `Receive Token Symbol`   | Token symbol of the token you want to receive from payments. The token must be supported by Kyber Network. | KNC |
| `Network` | ETH network that the payment gateway will run in. Either `Ropsten` (for testing) or `Mainnet` (for production) | Ropsten |
| `Mode` | Behavior of how the widget will appear to the user. Find out more [here](api_abi-kyberwidget.md#widget-mode). Either `tab`, `popup`, or `iframe` | popup |
| `Block Confirmation` | Number of block confirmations to finalize the transaction. Larger block confirmations mean longer confirmation times, but are more secure | 40 |
| `Commission ID` | Registered ETH address that is part of the [fee sharing program](integrations-feesharing.md) | 0x2B522cABE9950D1153c26C1b399B293CaA99FcF9 |

## Transaction Monitoring
In order to check if the payment is successful, we use the [widget-monitor-php](https://github.com/KyberNetwork/widget-monitor-php) library to monitor the transaction.

This plugin will retrieve the transaction receipt from the blockchain and return its status as well as validate the payment. It provides 2 modes for monitoring the tx status: `useIntervalLoop` or none. The `useIntervalLoop` plugin will continuously query a node to get the tx receipt until it reaches the desired block confirmation number. Note that this approach will consume a lot of server resources if there are many orders on-hold and block confirmation numbers are large.

We recommend using a cronjob to check the order tx status periodically. We are already using wp_cron to monitor every 30 seconds. You can install and use WP Crontrol to view and edit that job.

![Woocommerce Cron](/uploads/woocommerce-8.png "Woocommerce Cron")

### Advanced Options
The cron jobs above will run upon every page load. This approach has 2 main issues:
1) As with any heavy job, it will slow down the page for users
2) It is dependent on the user request to run the cronjob. Therefore, it is recommended to disable the WordPress default cronjob and setup a Linux (server) cronjob using crontab.

Here is a guide on how to do this:

1. Install crontab (if your server does not have it as default). You may need to search for instructions for your distro (Centos, RHEL, etc).

2. Setup crontab.

```sh
crontab -e
```

3. Add the following line in order to run every minute to check the tx status.

```sh
curl http://example.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1
```

Please make sure you use the correct path to wp-cron.php.

Alternatively, you can use WP-cli

```sh
cd /var/www/example.com/htdocs; wp cron event run --due-now > /dev/null 2>&1
```

4. You will need to disable WordPress default wp-cron. Add following to wp-config.php.
```php
define('DISABLE_WP_CRON', true);
```

5. Finally, restart crontab service so the new job can run.
```sh
sudo service cron restart
```

## Contribution Guidelines
If you are a developer and want to contribute, please check out the following guidelines for contributing to the Woocommerce Kyber Widget repository.

* [Reporting Bugs](https://github.com/KyberNetwork/widget-woocommerce/blob/master/bug_report.md/)
* [Featured Requests](https://github.com/KyberNetwork/widget-woocommerce/blob/master/feature_request.md/)

repository: KyberNetwork/developer-portal

gha_language: CSS

repo_name: KyberNetwork/developer-portal


text:
---
title: Basic Commands
author: YourMCGeek
---

Table of Contents
- [Home](#home)
- [Chat](#chat)
- [Island/Cave Areas](#island/cave-area)
- [Grief Prevention](#grief-prevention)

| Argument 	| Required 	|
|:--------:	|:--------:	|
|    <>    	| Required 	|
|    []    	| Required 	|

# Home

``sethome [name] [-o]`` Sets your home at a current location. Failure to specify a name will set the home under the name ``home``. Adding ``-o`` to the end of your command will override the location of the previous home (e.g ``sethome home -o`` will make your new home at the location you're currently at).

``home <name>`` Teleports your to the specified home. Failure to specify a home name will default to home.

``delhome <name>`` Deletes the specific home. Failure to specify a name will result in command failure.

``homes`` Lists all set homes. Clicking on a home will teleport you to that home.Any home marked in a red colour is unable to be teleported to due to it being in an unsafe condition.

# Teleportation

``tpa <name>`` Sends a request to teleport to the specified player. The player may respond to the request or ignore it.

``tpyes`` Accepts the most recent teleport request you've received. You are also able to press ``Accept`` in the message to accept the teleport request.

``tpno`` Denies the most recent teleport request you've received. You are also able to press ``Deny`` in the message to deny the teleport request.

``tpahere <name>`` Sends a request to the specified player to teleport to your location. **Requires the rank of Shade or higher.**

``tptoggle`` Toggles players being able to send you teleport requests. By default, all requests are enabled.

``rtp`` Teleports you to a random location in the same dimension after a short delay. Locations may include deep in a cave or in the middle of the ocean. **Costs 100 in-game dollars to reduce spam.**

# Chat

``msg <name> <message>`` Sends your message privately to the specified user.

``r <message>`` Replies with your message to the last person who messaged you.

``gignore add <name>`` Ignores specified player's chat globally. We recommend doing this command in the lobbies as the specified user needs to have joined your server previously.

``gignore remove <name>`` Stop ignoring chat from the player.  Users in other servers will not be able to see your chat, yet you will see theirs. *Discord is not effected by these commands.*

# Island/Cave Area

Sky Factory and Stoneblock servers use a plugin that adds a bit of integration for the islands. Along with the commands mentioned above, there are a few more commands for your island/cave.

``area create`` Creates an area and automatically sets the area spawn point. **This command wipes your inventory.**

``area home`` Teleports you to your area spawnpoint.

``area sethome <-o>`` Changes the area spawnpoint location to where you are currently standing.

``area reset`` Wipes your area and starts your progress over fresh.

``area info`` Provides information regarding the area you are currently in.

``area list`` Provides a list of all the areas on the server.

``area lock`` Locks down your island preventing any uninvited members from entering.

``area unlock`` Unlocks your island, allowing all members of the server access to enter.

``area expand`` Expands your area's claim. Default size is 256x256, max size is 400x400.

``area setbiome <biome>`` Changes your areas biome.

``area spawn <player name>`` Teleports you to the specified users island. Leaving the name blank will teleport you to your island.

``area invite <name>`` Invites the player to build and play with you. They must set their own home in your area or use the ``island spawn`` command. **This does not remove a previous island which the user has created.**

``area leave`` Removes your access to the area you are standing in, if you've been previously invited.

``area kick <name>`` Revoke all permissions of the player in your area.

# Grief Prevention
*All these commands will work for subdivided claims as well*

``claimsinfo`` Checks information of the claim such as trusted players or who owns the claim.

``claimslist`` Displays a list of all your claims.

``permissiontrust <name>`` Allows the user to trust others and run claim commands in the claim your are currently standing in.

``trust <name>`` Allows the user to build in the claim you are currently standing in, access chests and other inventories.

``containertrust <name>`` Allows the user to access chests, farm crops, tame/kill animals, the use of a bed, and the use of levers/buttons/pressure plates in the claim you are currently standing in.

``accesstrust <name>`` Allows the user to access your bed and inventories like an anvil for the claim you're standing in.

``untrust <name>`` Revokes all permissions for the user for the claim you're currently standing in.

``untrustall <name>`` Revokes all permissions for the user in all your claims.

``trustlist`` Displays a list of claims that you are trusted in.

``abandonclaim`` Removes the claim you are currently standing in.

``abandonallclaims`` Removes all your claims.

repository: CosmicElemental/ShadowNodeHugo

repo_name: CosmicElemental/ShadowNodeHugo


text:
# What is the UniversalChart?

The **Universal Chart** is a reusable component designed to make our use of **Plotly.js** significantly easier. The overall idea is that the **Universal Chart** Component can be inserted into any page, passed a few simple props, and bam, it works! However, while offering a simple reusable solution to our charting needs it also allows for a ton of custom input, enabling the user to create any chart their heart desires.

## Example Chart

To give some context to the further explainations, here is an example chart which we will be going over how to create in this documentation.

![alt text](https://i.imgur.com/7xyYwcZ.png)

## Creating a chart

Using the **UniversalChart** is as simple as placing or calling apon this component from your desired page and giving it some data. In the code snippit below, you will likely notice the **keys** and **dataset** props. These props are the data that the chart will use to render.

```
 <UniversalChart
          className="stock-price-chart"
          keys={keys}
          dataset={dataset}
          backgroundColor="rgba(30, 34, 45, 1)"
          plotBackgroundColor="rgba(30, 34, 45, 1)"
        />
```

Both the **keys** and **dataset** props take in an array of items, in the case for keys, it is an array of strings, integers, or whatever you 'keys' you desire for the data to display. In our example case, it is dates relating to the price of a stock. The **dataset**, however, is a little more complicated than the keys. The dataset itself while still being an array, does not contain simple strings or integers, but rather *'traces'/'individual sets'* of data.

For instance, in our example, we are providing the chart with a dataset which includes only one trace. That trace reflects the stock price and with that, we have chosen the *type* **'line'** to display for our chart. We have also given this **'line'** a *color* & *outline* color of blue, as well as a 30% transparent version of the same color for the inner *fill*. Finally, we have provided our line with a object property noted as **'values'** which in our example case resembles an array of prices to correspond with the array of keys provided earlier.
```
const dataset = []

dataset.push({
      name: 'Stock Price',
      type: 'line',
      color: 'rgba(39, 91, 232, 1)',
      outline: 'rgba(39, 91, 232, 1)',
      fillcolor: 'rgba(39, 91, 232, .3)',
      fill: 'tonexty',
      values: values
    })
```

And it is with that, the the chart is complete! Simple right? Yet seemingly so complex.

Keep in mind that there are also a ton of other props you can pass the chart, as well as properties that you can apply to the dataset in order to further modifty the chart. However, they all follow this general concept! With that, below are a list of props and object properties that can be applied to the **UniversalChart** component and *datasets* objects.

**I would also strongly recommend checking out the Plotly.js reference page!**
https://plotly.com/javascript/reference/
## Props that can be attached to the UniversalChart Component

|  Property 	| Example	|  Description	|
|---	|---	|---	|
|title|'Stock Price'|Set the title of a chart|
|className|'stock-price-chart'|Set the className on the chart wrapper div|
|dataset|[{...(above)}]|The dataset array containing the chart data|
|keys|[1, 2, 3]|The keys used for the xAxis|
|backgroundColor|'rgb(30, 34, 45)'|The background color of the plot including margin|
|plotBackgroundColor|'rgb(30, 34, 45)'|The background color of the plot not including margin|
|autosize|true/false|Should the chart automatically resize|
|margin|{ l: 50, r: 50, b: 25, t: 35 }|How much margin should the chart have inside its container|
|legend|{ x: 1, y: 1, font: { size: 10 }|The actual chart legend. https://plotly.com/javascript/reference/layout/#layout-legend|
|showlegend|true/false|Should the legend display|
|barmode|'group'|Types of barmode include 'group' 'stack' 'relative'|
|bargap|0.1|Custom distance between bars on bar chart (default is 0.1)|
|xaxis|{gridcolor: gridcolor}|You can read about the axes here: https://plotly.com/javascript/axes/|
|yaxis|{gridcolor: gridcolor}|You can read about the axes here: https://plotly.com/javascript/axes/|
|annotations|example|description|
|grid|{rows: 2, columns: 2}|Customize the grid|
|gridcolor| 'rgba(67, 70, 81, 0.3)'|The color of the background grid|
|hoverdistance|20|How far from the datapoint should the hover show|
|hovermode|'closest'|Determines the mode of hover interactions. If "closest", a single hoverlabel will appear for the "closest" point within the `hoverdistance`.|
|fullLayout|{title: "title"}|Pass in your own object which will be used as the layout for Plotly.js|

## Properties that can be used on the datasets!

|  Property 	| Example	|  Description	|
|---	|---	|---	|
|name|'price'|The name of the set (shows on hover and on legend)|
|type|'line'|The type of set this will be, 'bar', 'line', 'pie', 'scatter', 'candlestick', 'etc'|
|cKeys|[1, 2, 3]|Set a seperate set of keys for this trace|
|values|[1, 2, 3]|The values this trace will display|
|text|'example'|The text that will display inside the trace|
|color|'red'|Color of inner/overall trace|
|outline|'red'|Color of outline|
|stroke|5|Thickness of outline stroke|
|customSet|{marker: {...}}|Add properties (not included here) to the set/trace|
|fullSet|{type: 'line'}|Replace the whole current set/trace with your own|

repository: FullStackWork/StatsNine

repo_name: FullStackWork/StatsNine


text:
# Juice

-- unsupported please use Encodable/Decodable ---

[![CI Status](http://img.shields.io/travis/rundfunk47/Juice.svg?style=flat)](https://travis-ci.org/rundfunk47/Juice)
[![Version](https://img.shields.io/cocoapods/v/Juice.svg?style=flat)](http://cocoapods.org/pods/Juice)
[![License](https://img.shields.io/cocoapods/l/Juice.svg?style=flat)](http://cocoapods.org/pods/Juice)
[![Platform](https://img.shields.io/cocoapods/p/Juice.svg?style=flat)](http://cocoapods.org/pods/Juice)

🥤 Juice is a modern and simple JSON Encoder / Decoder for Swift 3+ 🥤

## Features:
* Written to take full advantage of Swift's ability to throw errors.
* If a required parameter is missing or the wrong type, Juice will tell you exactly which model and key - for easy debugging.
* Easy to use. No weird `<*>` `<|?>` `<:3>`-operators. Just use `decode`, Juice will figure out the rest.
* Ability to transform values when encoding / decoding.
* ...and of course many, many test cases!

## Usage:

To make a model Decodable and Encodable:
```swift
struct Person: Decodable, Encodable {
    let title: String
    let firstName: String
    let lastName: String
    let age: Int
    let car: Car?
    let children: [Person]

    init(fromJson json: JSONDictionary) throws {
        title = try json.decode(["name", "title"])
        firstName = try json.decode(["name", "fullName", "firstName"])
        lastName = try json.decode(["name", "fullName", "lastName"])
        age = try json.decode("age")
        car = try json.decode("car")
        children = try json.decode("children")
    }

    func encode() throws -> JSONDictionary {
        var dictionary = JSONDictionary()
        try dictionary.encode(["name", "title"], value: title)
        try dictionary.encode(["name", "fullName", "firstName"], value: firstName)
        try dictionary.encode(["name", "fullName", "lastName"], value: lastName)
        try dictionary.encode(["age"], value: age)
        try dictionary.encode(["car"], value: car)
        try dictionary.encode(["children"], value: children)
        return dictionary
    }
}
```

A Decodable and Encodable enum with raw value:
```swift
enum PhoneNumberType: String, Decodable, Encodable {
    case home
    case office
    case mobile
}
```

A decodable enum without raw value:
```swift
enum Distance: Decodable {
    case reallyClose
    case close
    case far

    init(fromJson json: Double) throws {
        switch json {
        case _ where json < 2:
            self = .reallyClose
        case _ where json < 6:
            self = .close
        default:
            self = .far
        }
    }
}
```

With Juice it is possible to decode any type by using either transforms...
```swift
struct TransformHomePage {
    let title: String
    let url: URL

    init(fromJson json: JSONDictionary) throws {
        title = try json.decode("title")
        url = try json.decode("url", transform: { (input: String) -> URL in
            if let url = URL(string: input) {
                return url
            } else {
                throw BadURLError(attemptedUrl: input)
            }
        })
    }
}
```

...or by using protocol extensions:
```swift
extension URL: Decodable {
    public init(fromJson json: String) throws {
        if let url = URL(string: json) {
            self = url
        } else {
            throw BadURLError(attemptedUrl: json)
        }
    }
}

struct ProtocolHomePage {
    let title: String
    let url: URL

    init(fromJson json: JSONDictionary) throws {
        title = try json.decode("title")
        url = try json.decode("url")
    }
}
```

...and on classes you can't directly modify:

```swift
extension NSURL: FactoryDecodable {
    public static func create<T>(fromJson json: String) throws -> T {
        if let url = NSURL(string: json) {
            return url as! T
        } else {
            throw BadURLError(attemptedUrl: json)
        }
    }
}

struct ProtocolHomePage {
    let title: String
    let url: NSURL

    init(fromJson json: JSONDictionary) throws {
        title = try json.decode("title")
        url = try json.decode("url")
    }
}
```

Juice features precise error throwing:
```swift
do {
    let dict = JSONDictionary(["title": "Apple", "url": "ht tps://apple.com"])
    try ProtocolHomePage(fromJson: dict)
} catch {
    // Error at key path ["url"]: Failure when attempting to decode type URL: Not a valid URL: "ht tps://apple.com"
    print(error.localizedDescription)
}
```

## Example

To run the example playground, clone the repo, and run `pod install` from the Example directory first. Then, open the `Juice.xcworkspace` and play around in the playground! Also, see the unit tests for more examples.

## Requirements

Juice has been tested with iOS 8.0+

## Installation

Juice is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
pod "Juice"
```

## Author

Narek Mailian<EMAIL_ADDRESS>
## License

Juice is available under the MIT license. See the LICENSE file for more info.

gha_language: Swift


text:
---
layout: single
title: Publications
permalink: /publications/
author_profile: true
comments: false
share: false
related: true
classes: wide
---

## Talks
*   5th December 2017 - Mesos & Docker - gained experience, Dragon Valley Tech Talks #1
*   28th November 2017 - Time Series Data & Metrics Collection, NovoTalks #1
*   19th July 2018 - Configuring PKI base on CFSSL, Edu4 Novomatic-tech
*   23th August 2018 - Kubernetes - Kick off, Edu4 Novomatic-tech
*   4th October 2018 - [Kubernetes - Pods, Edu4 Novomatic-tech](https://github.com/kaarolch/kubernetes-examples/tree/master/pods)
*   24th October 2018 - [Kubernetes - The Story about containers orchestration](https://drive.google.com/open?id=1onQoeD5GIL2zulN9IPO3C13XlFpxbbcF), AGH
*   21th November 2018 - [Infrastructure as a code and Immutable Infrastructure](https://drive.google.com/file/d/1ioXEG70ohG68kvOZAh_BpCgDxNZh-DvW/view?usp=sharing), NovoTour AGH
*   23th January 2019 - [Introduction to PKI base on CFSSL](https://docs.google.com/presentation/d/e/2PACX-1vRT3HA3aUUecurzkTSGnub_DVLcoNsK2YeqXcJHbJQ_0k9hi3Wj1jhaNK5eLTdzipoA1KG3mc07ctcP/pub?start=false&loop=false&delayms=3000), Lecture for AGH students


text:
# Changelog
All notable changes to this project will be documented in this file.

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

## [0.6.8] - 2019-08-13

- Added support for arrays in Solidity tight packing `ABI.solidityPack()`
  function, PR [#82](https://github.com/ethereumjs/ethereumjs-abi/pull/82)

[0.6.8]: https://github.com/ethereumjs/ethereumjs-abi/compare/v0.6.7...v0.6.8

## [0.6.7] - 2019-03-18

- Added support/CI testing for Node 10, 11,
  PR [#77](https://github.com/ethereumjs/ethereumjs-abi/pull/77)
- Dropped support for Node 4, 6,
  PR [#77](https://github.com/ethereumjs/ethereumjs-abi/pull/77)
- Updated `ethereumjs-util` dependency to `v6.0.0`, `bn.js` to `4.11.8`,
  PR [#77](https://github.com/ethereumjs/ethereumjs-abi/pull/77)
- Updated dev dependency versions,
  PR [#77](https://github.com/ethereumjs/ethereumjs-abi/pull/77)

[0.6.7]: https://github.com/ethereumjs/ethereumjs-abi/compare/v0.6.6...v0.6.7

## [0.6.6] - 2019-01-16

- Include size of fixed-size array in offset for dynamic type,
  PR [#60](https://github.com/ethereumjs/ethereumjs-abi/pull/60)
- Replaced problematic for..in loops with C-style loops,
  PR [#68](https://github.com/ethereumjs/ethereumjs-abi/pull/68)
- Updated `ethereumjs-util` dependency to `v5.0.0`,
  PR [#59](https://github.com/ethereumjs/ethereumjs-abi/pull/59)
- Run CI tests on currently supported Node versions,
  PR [#61](https://github.com/ethereumjs/ethereumjs-abi/pull/61)

[0.6.6]: https://github.com/ethereumjs/ethereumjs-abi/compare/v0.6.5...v0.6.6

## [0.6.5] - 2017-12-07
- Fix tight packing for ``ABI.soliditySHA3``
- Fix ``ABI.solidityPack`` early return on bytes32 input
- Support for multi dim / dynamic arrays
- Support addresses starting with zeroes

[0.6.5]: https://github.com/ethereumjs/ethereumjs-abi/compare/v0.6.4...v0.6.5

## [0.6.4] - 2016-08-29
- Fix length calculation for static arrays and skip enough bytes after them

[0.6.4]: https://github.com/ethereumjs/ethereumjs-abi/compare/v0.6.3...v0.6.4

## [0.6.3] - 2016-08-10
- Support for the (u)``fixedMxN`` datatype
- Fix conversion of type shorthands (int, uint, fixed, ufixed)
- Serpent fixes
- Other bug fixes / improvements

[0.6.3]: https://github.com/ethereumjs/ethereumjs-abi/compare/v0.6.2...v0.6.3

## [0.6.2] - 2016-06-01
- Minor improvements and bug fixes
- Additional tests

[0.6.2]: https://github.com/ethereumjs/ethereumjs-abi/compare/v0.6.1...v0.6.2

## [0.6.1] - 2016-05-19
- Properly decode fixed-length arrays

[0.6.1]: https://github.com/ethereumjs/ethereumjs-abi/compare/v0.6.0...v0.6.1

## [0.6.0] - 2016-04-26
- Introduce ``ABI.stringify``
- Remove signature handling form ``rawEncode``/``rawDecode``
- Added ``ABI.simpleEncode`` and ``ABI.simpleDecode``
- Export ``methodID`` and ``eventID``
- Various improvements

[0.6.0]: https://github.com/ethereumjs/ethereumjs-abi/compare/v0.5.1...v0.6.0

## Older releases:

- [0.5.1](https://github.com/ethereumjs/ethereumjs-abi/compare/v0.5.0...v0.5.1) - 2016-04-12
- [0.5.0](https://github.com/ethereumjs/ethereumjs-abi/compare/v0.4.0...v0.5.0) - 2016-03-25
- [0.4.0](https://github.com/ethereumjs/ethereumjs-abi/compare/v0.3.0...v0.4.0) - 2015-12-17
- [0.3.0](https://github.com/ethereumjs/ethereumjs-abi/compare/v0.2.0...v0.3.0) - 2015-11-30
- [0.2.0](https://github.com/ethereumjs/ethereumjs-abi/compare/v0.1.0...v0.2.0) - 2015-11-25
- 0.1.0 - 2015-11-23

repository: Hsiang-xxs/via-issuer

repo_name: Hsiang-xxs/via-issuer


text:
---
hrs_structure:
  division: '1'
  volume: '4'
  title: '14'
  chapter: '232'
  section: 232-4
type: hrs_section
tags:
  - Government
menu:
  hrs:
    identifier: HRS_0232-0004
    parent: HRS0232
    name: 232-4 Second appeal
weight: 58020
title: Second appeal
full_title: 232-4 Second appeal
---
**§232-4 Second appeal.** In every case in which a taxpayer appeals a real property tax assessment to a tax appeal court and there is pending an appeal of the assessment, the taxpayer shall not be required to file a notice of the second appeal; provided the first appeal has not been decided prior to April 9 preceding the tax year of the second appeal; and provided further the assessor gives notice that the tax assessment has not been changed from the assessment which is the subject of the appeal. [L 1965, c 201, §1; Supp, §116-2.2; am L 1967, c 255, §§17, 40, 46; [HRS §232-4](/title-14/chapter-232/section-232-4/); am L 1969, c 170, §26; am L 1975, c 157, §31; am L 1989, c 14, §5]

Case Notes

Taxpayers were not entitled to automatic appeals under plain language of section. 73 H. 63, 828 P.2d 263.

repository: SamMade/BlueAndKrabby

repo_name: SamMade/BlueAndKrabby


text:
# Handling a failover

## Problem

If a redis master dies and gets restarted by kubernete (or OpenShift), Redis Cluster will have a slave/replica take over, and keep the cluster running. However once this is done one need to get a new redis node to become a slave/replica of the newly elected master node. With the default settings, kubernete will create a new pod, running in cluster mode but unknown to the rest of the cluster yet.

Once a machine has been rebooted and its old ip and node id disappear, the cluster will treat it as a failed instance. However rcc was not detecting it, and all the basic rcc sub-commands were hanging, as they were trying to connect to a dead ip. The first change to improve this was to add more verbosity when connecting.

The rcc code was updated to properly detect nodes that were in fail node when parsing the CLUSTER NODES response, and skip them. A companion change was made to display the number of replica for each master, so that we know which master needs to be replicated.

 Now we need to identify which pod is running the new redis instance which has not joined the cluster yet. We will use the *endpoints* sub-command of rcc to figure this out. That command expects that there is a default service named redis-cluster which run your cluster. That setup will be described separately. If you use another name there is an option to specify it. This is really just a tiny wrapper on top of kubernete.

```
$ rcc endpoints --full --service redis-cluster
ip              name
--------------  ---------------------
<IP_ADDRESS>  redis-cluster-6-wmqn7
<IP_ADDRESS>  redis-cluster-6-jp2mr
<IP_ADDRESS>   redis-cluster-6-2pmb9
<IP_ADDRESS>   redis-cluster-6-5zd27
<IP_ADDRESS>  redis-cluster-6-k47kj
<IP_ADDRESS>  redis-cluster-6-blsvd
<IP_ADDRESS>   redis-cluster-6-sxb9n
<IP_ADDRESS>   redis-cluster-6-sl76p
<IP_ADDRESS>  redis-cluster-6-h6q97
<IP_ADDRESS>   redis-cluster-6-8tz6g
<IP_ADDRESS>  redis-cluster-6-p675h
<IP_ADDRESS>  redis-cluster-6-457cq
<IP_ADDRESS>  redis-cluster-6-s8g84
<IP_ADDRESS>   redis-cluster-6-7rm4m
<IP_ADDRESS>   redis-cluster-6-tmctq
<IP_ADDRESS>   redis-cluster-6-cccx2
<IP_ADDRESS>   redis-cluster-6-7s2gd  <-- the new node, not found in CLUSTER NODES
<IP_ADDRESS>  redis-cluster-6-vctz6
```

We need to eye-ball which redis instance is not part of the CLUSTER NODES response yet. In our case it is *<IP_ADDRESS>*, so we will have to remote connect to *redis-cluster-6-7s2gd* to configure the new node. This will be a 2 steps process for adding a new slave/replica.

```
oc rsh redis-cluster-6-7s2gd
# redis-cli
<IP_ADDRESS>:6379> CLUSTER NODES
4205c956cbb67e5155931c5dfa9377d903899226 :6379@16379 myself,master - 0 0 0 connected
```

The machine only know about itself at this point.

repository: machinezone/rcc

gha_language: Python

repo_name: machinezone/rcc


text:
---
title: "getPreviousUntil.js"
date: 2018-01-24T12:16:26-05:00
draft: false
description: "Get all previous siblings of an element until a selector is found."
how: "https://gomakethings.com/how-to-get-all-siblings-of-an-element-until-a-selector-is-found-with-vanilla-js/"
demo: "https://codepen.io/cferdinandi/pen/vbEEjO"
polyfills: "[Requires the `matches()` polyfill.](https://vanillajstoolkit.com/polyfills/matches/)"
weight: 10
noIndex: false
---

```js
/*!
 * Get previous siblings of an element until a selector is found
 * (c) 2018 Chris Ferdinandi, MIT License, https://gomakethings.com
 * @param  {Node}   elem     The element
 * @param  {String} selector The selector to match against
 * @return {Array}           The siblings
 */
var getPreviousUntil = function (elem, selector) {

	// Setup siblings array and get previous sibling
	var siblings = [];
	var prev = elem.previousElementSibling;

	// Loop through all siblings
	while (prev) {

		// If the matching item is found, quit
		if (selector && prev.matches(selector)) break;

		// Otherwise, push to array
		siblings.push(prev);

		// Get the previous sibling
		prev = prev.previousElementSibling

	}

	return siblings;

};
```

repository: pahbloo/vanilla-js-toolkit

repo_name: pahbloo/vanilla-js-toolkit


text:
+++
title = "Welcome to Emacs Anonymous, Sorry, My Blog"
author = ["Aidan Scannell"]
date = 2019-09-16T12:14:00+01:00
tags = ["emacs"]
draft = false
+++

Hello and welcome to my blog.

I am an aspiring researcher (aka phd student) with interests at the intersection of robotics and machine learning.
I am particularly interested in uncertainty quantification in ML and as a result spend a significant amount of time with Bayesian non-parametric methods, specifically Gaussian processes.

And I also do a little bit of programming in python within my **beautiful** text editor.

I am all about that work-life balance.

This blog is inevitably going to contain a mixture of Emacs/Spacemacs posts and some more involved mathematical ML posts.
There will probably be some where I just dump the contents of my mind and others where I actually plan what I am going to write.

_Disclaimer 1: I am an Emacs noob at the start of my journey to enlightenment._

_Disclaimer 2: I'm rocking multiple Spacemacs configs and one vanilla Emacs config, so most of my posts will probably be tailored to Spacemacs._

This blog is written in Emacs Org mode ([thanks to ox-hugo](https://ox-hugo.scripter.co/)).

repository: aidanscannell/academic-kickstart

repo_name: aidanscannell/academic-kickstart


text:
---
layout: post
title: PicoCTF 2018 - Script Me
categories: [PicoCTF, General Skills]
tags: [Hard, Python, Logic]
---

## Information

| Points |Category  | Level|
|--|--|--|
| 500 | General Skills |Hard |

## Challenge

> Can you understand the language and answer the questions to retrieve the flag? Connect to the service with `nc 2018shell.picoctf.com 7866`

### Hint

>  Maybe try writing a python script?

## Solution

So after connecting to the service this massage showed up:

    Rules:
    () + () = ()()                                      => [combine]
    ((())) + () = ((())())                              => [absorb-right]
    () + ((())) = (()(()))                              => [absorb-left]
    (())(()) + () = (())(()())                          => [combined-absorb-right]
    () + (())(()) = (()())(())                          => [combined-absorb-left]
    (())(()) + ((())) = ((())(())(()))                  => [absorb-combined-right]
    ((())) + (())(()) = ((())(())(()))                  => [absorb-combined-left]
    () + (()) + ((())) = (()()) + ((())) = ((()())(())) => [left-associative]

    Example:
    (()) + () = () + (()) = (()())

    Let's start with a warmup.
    (()) + (()()()) = ???

So there is a 8 rules and it's like a math problem, so for understanding the rules.
I just tried to answer some questions and if I got wrong, the right answer   showed up to show me where I was wrong.
After some tries I thought I understood the rules and here they are:

 >1. **Combine** - the max depth of each part are equal => combine them
 >*example:*  ()()()(()) + (())() = ()()()(())(())()
 >
>||part1|part2  |answer |
>|--|:--:|:--:|:--:|
>|value| ()()()(()) | (())() | ()()()(())(())()|
>|max depth| 2| 2| 2|

>2. **Absorb left** (and right) - if the max depth of the left part is more than   >the max left of the right part => put the right part right before closing the left part
 >*example:*  (()) + () = (()())
 >
>||part1|part2  |answer |
>|--|:--:|:--:|:--:|
>|value| (()) |  () | (()())|
>|max depth| 2| 1| 2|
>
>* the absorb right it's symmetric

>3. **Left associative** - start from the 2 left parts, do the + between them and take >the result + the third part
>*example:* () + (()) + ((())) = ((()())(()))
 >
>||part1|part2  |part3 |part1+part2 |result+part3 |
>|--|:--:|:--:|:--:|:--:|:--:|
>|value| () | (())|  ((())) | (()())|((()())(())) |
>|max depth| 1| 2| 3| 2| 3|

So I wrote this python script:
```python
import re

#Count the max depth of a str.
#Each '(' add one, each ')' sub one.
def depth (str):
	max = 0
	curr = 0
	for c in str:
		if c == '(':
			curr+= 1
			if curr > max:
				max = curr
		if c == ')':
			curr-= 1
	return max

#AbsorbLeft (when the left part depth is more than the right part.
#Set all the left part without the closing ')' at the end, insert right part and close by ')'
def absorbLeft(left,right):
	return left[:-1]+right+left[-1]

#Symmertic to the absorbLeft
def absorbRight(left,right):
	return right[0] + left + right[1:]

def splitProblem(question):
	#Split by "?" and "=" and "+"
	question = re.split('[= + ?]', question)
	#Remove empty strings from the list
	return filter(None, question)

def solveProblem(question):
	#Split the question to parts.
	parts = splitProblem(question)
	print "answer:"
	result = parts[0]
	for i in range(1,len(parts)):
		#The depth is equal for both, just add after the first part
		if(depth(result) == depth(parts[i])):
			result += parts[i]
			continue
		#Left part depth is less than the right part depth -
		#Absorb right
		if(depth(result) < depth(parts[i])):
			result = absorbRight(result,parts[i])
			continue
		#else, left part depth is more than the right part depth -
		#Absorb left
		result = absorbLeft(result,parts[i])
	return result

if __name__ == "__main__":
	text = raw_input("Enter question: ")
	while(text != "exit"):
		print solveProblem(text)
		text = raw_input("Enter question: ")
```
*Comments speaks for themselves

So I print each question I got from the shell to the script, got the answer and   print it back in the shell,and after 5 questions I got the key.

## Flag
> `picoCTF{5cr1pt1nG_l1k3_4_pRo_45ca3f85}`

### Downloads

 - [python script][1]

[1]:{{ site.url }}/download/Script_Me-script.py


text:
<!-- README.md is generated from README.Rmd. Please edit that file -->

# tidygutenbergr

<!-- badges: start -->

[![Travis build
status](https://travis-ci.org/EmilHvitfeldt/tidygutenbergr.svg?branch=master)](https://travis-ci.org/EmilHvitfeldt/tidygutenbergr)
<!-- badges: end -->

The goal of tidygutenbergr is to provide simple cleaning functions for
popular works collected from gutenberg.org.

## Installation

You can install the development version from
[GitHub](https://github.com/) with:

``` r
# install.packages("devtools")
devtools::install_github("EmilHvitfeldt/tidygutenbergr")
```

## Example

``` r
library(tidygutenbergr)

king_arthur()
#> Determining mirror for Project Gutenberg from http://www.gutenberg.org/robot/harvest
#> Using mirror http://aleph.gutenberg.org
#> # A tibble: 9,194 x 2
#>    text                                                                  chapter
#>    <chr>                                                                   <int>
#>  1 "CHAPTER I"                                                                 1
#>  2 ""                                                                          1
#>  3 "_The Prophecies of Merlin, and the Birth of Arthur_"                       1
#>  4 ""                                                                          1
#>  5 ""                                                                          1
#>  6 "King Vortigern the usurper sat upon his throne in London, when, sud…       1
#>  7 "upon a certain day, ran in a breathless messenger, and cried aloud-…       1
#>  8 ""                                                                          1
#>  9 "\"Arise, Lord King, for the enemy is come; even Ambrosius and Uther…       1
#> 10 "whose throne thou sittest--and full twenty thousand with them--and …       1
#> # … with 9,184 more rows
```

## Code of Conduct

Please note that the ‘tidygutenbergr’ project is released with a
[Contributor Code of Conduct](.github/CODE_OF_CONDUCT.md). By
contributing to this project, you agree to abide by its terms.

repository: EmilHvitfeldt/tidygutenbergr

repo_name: EmilHvitfeldt/tidygutenbergr


text:
# Group Automox Devices by ServiceNow CMDB
For organization leveraging ServiceNow CMDB, it is frequently seen as the source of truth for tagging and grouping
devices within an environment. To ease grouping Automox devices based on a ServiceNow environment, this script can be
leveraged in order to:
1. Pull Automox Devices
2. Pull Automox Groups; identifying the default group
3. Pull ServiceNow CMDB Computers/Devices by mapping the provided hostname and IP address of each CI record
4. Update the matched Automox device by hostname or IP address with the defined group value to be pulled from the
   ServiceNow response

In an unmodified ServiceNow instance, the hostname field for comparison is `name`, the IP address field for comparison
is `ip_address`, and the `asset_tag` or `support_broup` fields can easily be leveraged for grouping needs.

## Running the Script
To run the script, first make sure Python 3 is installed on the host system and clone this repository locally then
follow the below steps:
1. Create a virtual environment: `python3 -m venv venv`
2. Source virtual environment: `source venv/bin/activate`
3. Install the Automox Console SDK and requests library: `pip install automox-console-sdk requests`
4. Navigate to the script directory: `cd examples/use-cases/group_devices_by_servicenow_cmdb`
4. Run the scripts: `python group_devices_by_servicenow_cmdb.py`

This will execute the script and prompt for inputs. Validation will be performed to ensure there
are alerts for improper input(s) if encountered.

Both the Automox API Key and Organization ID inputs can be defined as environment variables prior to running the script
to avoid continual prompting. This can be accomplished by exporting the AUTOMOX_API_KEY and AUTOMOX_ORGANIZATION_ID environment
variables:
```shell
AUTOMOX_API_KEY=<API KEY HERE> AUTOMOX_ORGANIZATION_ID=<ORG ID HERE> python group_devices_by_servicenow_cmdb.py
```

In addition, it is possible to set the `SERVICENOW_INSTANCE_NAME`, `SERVICENOW_USERNAME`, and `SERVICENOW_PASSWORD`
environment variables to define the necessary ServiceNow details.

## Script Prompts
When the script is run, the user will be prompted for a handful of inputs. These inputs define:
1. The ServiceNow CMDB table to be used (default: cmdb_ci_computer)
2. The field name used for matching on device hostname (default: name)
3. The field name used for matching on device IP address (default: ip_address)
4. The field name used for pulling the group value (default: support_group)

```shell
Enter the ServiceNow CMDB Table for pulling devices (default: cmdb_ci_computer):
Enter the ServiceNow CMDB field for Hostname (default: name): name
Enter the ServiceNow CMDB field for IP Address (default: ip_address): ip_address
Enter the ServiceNow CMDB field to map to the Automox Server Group (default: support_group): support_group
```

## Script Output
When running the script, output will be sent to standard out in the case of an input issue, errors, or informational
messages. This output could be redirected to a file for storing on disk as needed. To avoid verbose output, the script
is not currently outputing unmatched devices; however, a counter message is provided when the script completes to give a
overview of what occurred:
```
Successfully updated Device ID 1234 (hostname-1, <IP_ADDRESS>)
Successfully updated Device ID 5678 (hostname-2, )
Script complete; matched devices: 2, unmatched devices: 855, groups created: 0
```

repository: ax-ctprod/automox-console-sdk-python

repo_name: ax-ctprod/automox-console-sdk-python