text:
# OpenSphinxSearch

OpenSphinxSearch provides a RESTful [OpenSearch API](http://www.opensearch.org/Home)
to the [Sphinx Fulltext Searchserver](http://sphinxsearch.com/). The REST interface is
fully configurable and the output fully customizable with templates.

## Basics

OpenSphinxSearch is based on the [Slim PHP Framework](https://www.slimframework.com/) (version 2),
the [Sphinx PHP API](https://github.com/romainneutron/Sphinx-Search-API-PHP-Client)
and [Twig](https://twig.symfony.com/) as template engine.

OpenSphinxSearch has been successfully tested with PHP 5.6.x - 7.x.x and Sphinxsearch 2.2.x.
It might work on more recent versions of Sphinx as well.

This is beta software (fully usable) but documentation is still missing. Future releases
will be refactored to use recent versions of PHP libraries and of Sphinxsearch.
But it is on the roadmap to keep all currently implemented functionality as stable as possible during
refactoring and provide an easy migration path (if necessary at all).

If you find any issues in the current version do not hesitate to report them in our
[issue tracker](https://github.com/digicademy/open-sphinxsearch/issues). You are very welcome to send
in pull requests as well.

### Installation

OpenSphinxSearch uses Composer as a package manager. First of all you will of course need a working Sphinx server.
The installation procedure for the OpenSphinxSearch package works as follows:

1. Install [Composer](https://getcomposer.org)
2. Clone the [GitHub repository](https://github.com/digicademy/open-sphinxsearch) to a local directory of your choice
   (*not* your webroot).
3. CD into the project directory and use `composer install` to install the dependencies
4. Copy *configuration.example.json* to *configuration.json* and modify the file with your own settings
   (use configuration.example.full.json as a reference)
5. Optionally copy the *view* directory to a *templates* directory (this is ignored from git versioning)
   and modify the Twig templates to your needs. Don't forget to configure the new templates directory in your
   configuration.json file.
5. Point your webserver (vhost) to the *public* directory of your installation and make
   sure that all requests are routed through the index.php file (an .htaccess file for Apache is included;
   for Nginx you need to tweak your vhost configuration depending on your webserver installation)

Open your browser and navigate to the URL under which you have installed OpenSphinxSearch. The base URL
provides you with a simple HTML page that references the (dynamically generated) OpenSearch description. The next
segments in the URL are your configured index names. Each configured index then provides the following four REST entry
points: *search* (for fulltext search), *suggest* (for Open Search suggestions), *keywords* (for disambiguating
submitted keywords) and *excerpts* (for submitting snippets that should be returned with
highlighted keywords).

### Configuration

Yet to come.

### Index setup

Yet to come.

## Endpoints

Yet to come.

### Search

Yet to come.

### Query settings

Yet to come.

#### By configuration only

Yet to come.

#### By configuration or URL parameter

Yet to come.

#### By URL parameter only

Yet to come.

### Suggest

Yet to come.

### Keywords

Yet to come.

### Excerpts

Yet to come.

## Templating

Yet to come.

## Credits

Released under MIT license.
@author: Torsten Schrade (@metacontext)

repository: digicademy/open-sphinxsearch

gha_language: PHP

repo_name: digicademy/open-sphinxsearch


text:
---
layout: post
title:  "Hydrophobic Sand"
---

Magic Sand is a toy made from sand coated with a hydrophobic ("water fearing") compound. When exposed to water, the material aggregates into cylindrical clumps in order to minimize contact surface area. Because of its hydrophobic properties, the sand returns to its original shape when removed from the water.

Source: <https://youtu.be/6wM692T2BXM>

[#ScienceGIF](https://plus.google.com/s/%23ScienceGIF/posts) [#Science](https://plus.google.com/s/%23Science/posts) [#GIF](https://plus.google.com/s/%23GIF/posts) [#Hydrophobic](https://plus.google.com/s/%23Hydrophobic/posts) [#Interaction](https://plus.google.com/s/%23Interaction/posts) [#Liquid](https://plus.google.com/s/%23Liquid/posts) [#Solid](https://plus.google.com/s/%23Solid/posts) [#Sand](https://plus.google.com/s/%23Sand/posts) [#MagicSand](https://plus.google.com/s/%23MagicSand/posts)
[View Original Post on Google+](https://plus.google.com/+ColinSullender/posts/jNM58TXeZdn)

![Hydrophobic Sand](/assets/img/2015-12-24-Hydrophobic-Sand.gif)

license: MIT

repository: shiruken/sciencegifs

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: shiruken/sciencegifs


text:
# collared-kerberos
A couple of helper classes for and an example of using Constrained Delegation with Kerberos.

## What is the Kerberos Double Hop problem and Kerberos Constrained Delegation?
The Kerberos Double Hop problem occurs when you have a kerberised service 'A' that needs to talk to another kerberised service 'B' on behalf of a user. Service A can not by default request a new service ticket for service B without constrained delegation (or protocol transition). A good write up can be found [here](http://searchwindowsserver.techtarget.com/feature/Advanced-Kerberos-topics-Delegation-of-authentication).

## What is in this repo?
### collared-kerberos
Contains helper classes that can be used to perform constrained delegation using spring-security-kerberos and S4U2Proxy.
* springsecuritykerberos package - Contains the changes found in [this pull request](https://github.com/spring-projects/spring-security-kerberos/pull/27) as well as a tweak to the Sun JAAS config to have `isInitiator=true`. This is necessary to get Krb5ProxyCredential as described in the comment [here](https://github.com/openjdk-mirror/jdk/blob/jdk8u/jdk8u/master/src/share/classes/sun/security/jgss/krb5/Krb5Context.java#L542).
* CollaredKerberosTokenFactory - An example/helper for creating SPNEGO tokens using the obtained Krb5ProxyCredential.
* httpclient package - A simple HttpClient SPNEGO scheme that can be used in a KerberosRestTemplate and simply returns the provided token during the SPNEGO sequence.

### The Example
I set this example up to fulfil my particular use case at the time around the Hadoop stack - that a request from a user would hit a Kerberised service, get passed through a couple of insecure services, and finally hit another kerberised service that required the end users credentials. So collared-kerberos-example-gateway is a kerberised service and collared-kerberos-example-hop isn't, although it makes a kerberised call to a downstream service. It works by generating a service ticket token for the kerberised end service during the gateway interaction, and passing that service ticket as a header to the hop service. The hop service then simply uses that token and KerberosRestTemplate to call the downstream kerberised service. The meat of the constrained delegation is in the gateway example.

#### collared-kerberos-example-gateway
The gateway service configured with [spring security kerberos](http://projects.spring.io/spring-security-kerberos/) that also uses helper classes found in collared-kerberos. Key points to note:
* WebSecurityConfig - Your stock spring security setup with a SPNEGO authentication filter, using the tweaked SunKerberosJaasTicketValidator.
* GatewayController - Obtains the delegated credential after the SPNEGO sequence, puts it in a header and calls the configured hop service.

#### collared-kerberos-example-hop
* HopController - gets the token out of the header and calls the target kerberised service using KerberosRestTemplate, with a custom HttpClient that uses the token at the right point of the SPNEGO sequence.

## Setting up a Test AD Environment

### Prerequisites
* Virtualbox
* Patience
* Googling ability - I can't guarantee these instructions will work and will happily accept PRs to fix them, but you'll likely need to work through some problems.

### Set Up a Host Only Network in Virtualbox
1. File -> Preferences -> Network -> Host-only Networks. Make sure there is an adapter.
1. Edit it and note down the address.
1. Some people get this working using static IPs for the following hosts, but I used a DHCP server and made sure the hosts always got the same IP.

### Set Up Active Directory Server
#### Create Server
1. Download an evaluation Windows Server 2012 R2 from [here](https://www.microsoft.com/en-GB/evalcenter/evaluate-windows-server-2012-r2)
1. In virtualbox, click new.
1. Give your server a good name, leave the defaults, and click create.
1. Right click your new server, click on settings, and click on Storage. Click the 'Empty' disk in the 'Storage Tree' section, then click the disc on the far right. Select Choose Virtual Optical Disk File and then find where you downloaded your ISO and select it.
1. Click on Network, Adapter 2, Enable Network Adapter. Select Host-Only Adapter in the Attached to drop down and click OK.
1. Double click to power it up. Go through the install process making sure to select 'Windows Server 2012 R2 Standard Evaluation (Server with a GUI)'. Do a 'Custom' install and finish up the install.
1. After install, give it a password and log in.
1. Open up the Server Manager, and click Add Roles and Features. Next, Next, Next. Select Active Directory Domain Services and DNS Server. Next through to the end. You may get a warning about not having a static IP - I couldn't quite figure out how to do this and it worked with DHCP so I left it. Install and then close.
1. Click on the orange exclaimation mark and click promote this server to Domain Controller. Select add a new forest and give it a name, e.g. MYCOOLDOMAIN.COM
1. Next through the rest of the options and Install. Server will restart.

#### Set Up User Accounts
1. Once the server has restarted click start, start typing active and then open Active Directory Users and Groups. Expand your domain and click on Managed Service Accounts. Right click in the white space and click new -> User.
1. Give a name for your delegating service like MYCOOLSERVICE and type the same in the User Login Name. Click next and then untick User must change password on next login and tick password never expires and then create.
1. Repeat above for another user called DOWNSTREAM - this will be our downstream kerberised service B.
1. Repeat above for our end user, e.g. Tom. This will be the user that logs into Windows and uses a browser to call our first kerberised service.
1. Create a SPNEGO service principal name (SPN) for MYCOOLSERVICE by opening powershell and running `setspn -s HTTP/mycoolservice.mycooldomain.com MYCOOLSERVICE`.
1. Create a Keytab for the service by running `ktpass -out C:\Users\Administrator\mycoolservice.keytab -princ<EMAIL_ADDRESS>-mapUser MYCOOLSERVICE -mapOp set +rndpass -crypto RC4-HMAC-NT -pType KRB5_NT_PRINCIPAL`.
1. Add the MYCOOLSERVICE user principal to the keytab using the command `ktpass -in C:\Users\Administrator\mycoolservice.keytab -out C:\Users\Administrator\mycoolservice.keytab -princ<EMAIL_ADDRESS>-mapUser MYCOOLSERVICE -mapOp set +rndpass -crypto RC4-HMAC-NT -pType KRB5_NT_PRINCIPAL`. Ignore the warning.
1. Repeat the above for the DOWNSTREAM service, but this time for the SPNEGO principal use HTTP/downstream.mycooldomain.com (although for this example you just need the SPNEGO SPN).
1. Configure constrained delegation for the MYCOOLSERVICE user by going back to Active Directory Users and Computers and clicking View -> Advanced Features. Right click on the MYCOOLSERVICE user and click properties. There is now a Delegation tab. Click it and click Trust the user for delegation to specified services only. Click Users or Computers and type downstream and check names and then OK. Select the HTTP downstream.mycooldomain.com service and click OK and OK.
1. Get the keytabs of the server for later, e.g. with a share or something.

### Set Up A Linux Host for the Gateway & Hop
1. Download Ubuntu from [here](http://www.ubuntu.com/download/desktop).
1. Follow the process as above for creating the virtualbox image.
1. Install Ubuntu.
1. Get the mycoolservice keytab and place on server.
1. Install jdk8 and krb5-workstation.
1. Configure krb5.conf.
1. Configure NTP and Hosts.
1. Clone collared kerberos example projects.
1. Configure projects.
1. Build and start them.

### Set Up A Linux Host for the downstream example Kerberised Service
1. Create another Virtualbox Unbutu VM as in the Gateway/Hop one above.
1. Get downstream keytab and place on server.
1. Install krb5-workstation.
1. Configure krb5.conf.
1. Configure NTP and Hosts.
1. Clone the hadoop-auth example from [here](https://github.com/apache/hadoop/tree/trunk/hadoop-common-project/hadoop-auth).
1. Configure as per hadoop auth example instructions to point to downstream principal and keytab.
1. Build hadoop auth example
1. Download [apache Tomcat](http://tomcat.apache.org/download-80.cgi) and extract and start it.
1. Put built web app in webapps.

### Set Up a Windows Host to be the End User
1. Get a Windows VM from [here](https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/)
1. As per the other virtualbox VMs, create one for Windows.
1. Log in as end user.
1. Add it to mycooldomain.com.
1. Edit IE settings to supply user/password.
1. Go to http://mycoolservice.mycooldomain.com:8080/ - If everything works the service should say you're Tom/whatever your end user you set up was.

### Common Problems

#### Clock Skew

#### Couldn't contact KDC

#### Slow Responses

## Why is this called Collared Kerberos?
 Yeah I know. Terrible.

repository: tellisnz/collared-kerberos

repo_name: tellisnz/collared-kerberos


text:
# Principle Grey

![Logo](https://github.com/xaphere/sgj2016/blob/master/presentation/1.png?raw=true)

The game was made at [Sofia Game Jam 2016](http://www.sofiagamejam.com/) part of [Global Game Jam](http://globalgamejam.org/)

####Theme: Ritual
The premise is that Gray is trying to complete 3 of his daily rituals before he goes to work, but the World and the clock is against him.

####Tech
Created with Unity3d Engine

####Links
[Play](http://xaphere.github.io/games/Ritual/)

[Game Page](http://globalgamejam.org/2016/games/principle-grey)

[Sounds](http://freesound.org/)

[Music](https://www.youtube.com/watch?v=MF6JvbfYI-8)


text:
# Pokemonsay in Docker

![Docker build](https://img.shields.io/docker/automated/xaviervia/pokemonsay.svg?maxAge=2592000)

Dockerized https://github.com/possatti/pokemonsay. Kudos to @possatti.

```
docker run --rm -it xaviervia/pokemonsay 'Hello World!'
```

## Notice

All Pokémon rights are property of [The Pokémon Company](https://en.wikipedia.org/wiki/The_Pok%C3%A9mon_Company). This is a  fan project with no ties to The Pokémon Company.

repository: xaviervia/docker-pokemonsay

gha_language: Makefile

repo_name: xaviervia/docker-pokemonsay


text:
---
layout: post
title: "Prioritizing Requests Using The Eisenhower Matrix"
description: "Data scientists can use the Eisenhower Matrix to avoid simply taking orders, and instead, establish themselves as strategic advisers"
comments: true
keywords: "data science, productivity, data, career advice"
---

![](https://cdn-images-1.medium.com/max/2000/0*WVEZg8fwJX1vDCuH)

Data scientists must constantly deal with the tension between short-term requests and long-term projects. Neglect the long-term projects, and you risk having minimal impact. However, neglect the short-term requests, and you may find yourself out of a job.

As a result, the best data scientists are those that can split their time effectively between short-term requests and long-term projects. In practice, this can be quite difficult because there is never a shortage of questions that your stakeholders may ask. Some of these questions are urgent and important, while others are neither important nor urgent.

Dwight Eisenhower, a former US President, coined the idea of using urgency and importance to help him prioritize his tasks. Using the[ Eisenhower Matrix](https://www.eisenhower.me/eisenhower-matrix/), he was able to ruthlessly prioritize his day.

In this article, we’ll explore this idea, and how it can help data scientists deal specifically with stakeholder requests. We’ll go through effective strategies to deal with each of the four quadrants below.

![](https://cdn-images-1.medium.com/max/2210/1*EAJtwwDDkQVZz9IjftkN-A.png)

1. **High Importance / High Urgency**

Typically when you get these requests, everything else gets dropped. There isn’t much leeway here, except for anticipating and planning for these types of requests.

For example, if you know that at the end of each quarter you’re responsible for pulling data and commentary on business performance, you may find it helpful to automate some of that work. Spotting repeatable work that is automatable, especially with high importance and high urgency tasks, will help you establish credibility as someone who can accomplish objectives quickly.

**2. High Importance / Low Urgency**

When it comes to high importance and low urgency requests, you may find yourself wanting to dive right in. However, the more prudent approach is to first understand what is being asked of you.

Often you can negotiate these types of asks and whittle them down to something more manageable. For example, a marketing executive may send a laundry list of data pulls they need to understand the effects of cannibalization. The reality may be that only one or two of the data pulls are necessary to tell the story they want to tell.

In general, with high importance and low urgency requests, you should strive to create a dynamic of strategic adviser, rather than that of an order taker. Having a unique point of view and leaving your stamp on the project will ensure a seat at the table for any future projects.

Since this is a low urgency request, you should use your best judgment whether you should re-prioritize your current queue of work (including that of long-term projects). Sometimes despite the importance of the problem, you may find it better to push back and set a future date for delivery.

**3. Low Importance / High Urgency**

Just because something is urgent, does not make it important.

If someone needs data by a certain date, you shouldn’t drop everything you’re working on to meet their deadline. Particularly if the request is of low importance (stack ranked against other requests and long-term objectives you’re working towards).

The best way to deal with these requests is to get more information. Sometimes all it takes is a 15-minute phone call to realize that the extra work required to pull the data, may end up just being an appendix slide that never gets brought up in the meeting. In this case, you can defer to the time when the data is actually necessary.

In cases like these, you could explore a rotation model, where each member of your team is “On-call” for these types of requests.

**4. Low Importance / Low Urgency**

The final, and trickiest quadrant are those requests that are of low importance and urgency. In the Eisenhower model, we would simply “Eliminate” these tasks. In a company setting, you have to be a bit more delicate with how you respond to these types of requests.

One easy way to defer these kinds of tasks is to put the onus on the stakeholder to do some work first. It might be a few pointed questions that require them to do some leg work before you start pulling any data. This will either buy you time, or they may lose motivation if the request wasn’t that important in the first place.

You can also try to delay the delivery of the work, communicating your current list of priorities and letting the stakeholder know that they should follow up with you in another week or two once things have settled down. The key is to never outright say no, but rather communicate your list of priorities to help the stakeholder understand the difficulty you may have with answering their questions at this time.

Long-term these kinds of asks may surface the need to create self-service options. A good rule of thumb is that anytime you get asked three different times to either update analysis, or pull data to answer a similar question, you should explore a dashboarding or automated solution.

![*The Original Eisenhower Matrix*](https://cdn-images-1.medium.com/max/2210/1*mCIwWYHuIzt455Qy7HTmoA.png)

The Original Eisenhower Matrix

So next time you have a request sitting in your email, consider which of the four quadrants it would fall under. After doing so, you can then take the corresponding measures. You’ll inevitably make some mistakes, but the alternative of trying to keep all your stakeholders happy by simply being an order taker will diminish the impact that you can have as a data scientist.


text:
# .NET Core 2.0 By Example
This is the code repository for [.NET Core 2.0 By Example](https://www.packtpub.com/application-development/net-core-20-example?utm_source=github&utm_medium=repository&utm_campaign=9781788395090), 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
With the rise in the number of tools and technologies available today, developers and architects are always exploring ways to create better and smarter solutions. Before, the differences between target platforms was a major roadblock, but that's not the case now. .NET Core 2.0 By Example will take you on an exciting journey to building better software.

This book provides fresh and relevant content to .NET Core 2.0 in a succinct format that’s enjoyable to read. It also delivers concepts, along with the implications, design decisions, and potential pitfalls you might face when targeting Linux and Windows systems, in a logical and simple way.

With the .NET framework at its center, the book comprises of four varied projects: a multiplayer Tic-tac-toe game; a real-time chat application, Let'sChat; a chatbot; and a movie booking application. You will start each chapter with a high-level overview of the content, followed by the above example applications described in detail. By the end of each chapter, you will not only be proficient with the concepts, but you’ll also have created a tangible component in the application.

By the end of the book, you will have built four solid projects using all the tools and support provided by the .NET Core 2.0 framework.
## 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.

For C# and .NET Core Samples:
Open the Packt.DotNetCore2ByExamples.Examples.sln solution file in Visual Studio 2017

For F# Project:
Open the F# sample project solution in Visual Studio 2017 and run the app.

For C++ and Ubuntu code samples:
Ubuntu Code samples should be downloaded and opened with Visual Studio Code.
C++ ExampleDll solution can be directly opened in Visual Studio 2017.

The code will look like the following:
```
# include<stdio.h>

int hello()
{
  return 15;
}
```

This book is aimed at experienced developers who use different platforms—Windows, Linux, Ubuntu, macOS—and want to try Microsoft .NET Core 2.0 cross platform. Developers using C#, C, or C++ for development who are interested in extending their knowledge of functional programming, beginners who want to understand F# and functional programming, we assume that you have a basic understanding of C# and are aware of the .NET framework and Windows.

The below section summarizes the chapter wise content and demo links.

## [Chapter 1](https://github.com/PacktPublishing/.NET-Core-2.0-By-Example/tree/master/Chapter01)

[Hello .NET Core 2](https://github.com/PacktPublishing/.NET-Core-2.0-By-Example/tree/master/Chapter01/HelloDotNetCore2)

[F# Console Application](https://github.com/PacktPublishing/.NET-Core-2.0-By-Example/tree/master/Chapter01/FSharpGettingStarted)

### Key takeaways
1. Getting started with .NET Core 2.0 and required setup.
2. Getting started with F# and required setup.

## [Chapter 2](https://github.com/PacktPublishing/.NET-Core-2.0-By-Example/tree/master/Chapter02)

[Ubuntu Code Samples](https://github.com/PacktPublishing/.NET-Core-2.0-By-Example/blob/master/Chapter02/HelloSOLib.c)

[PInvoke Example](https://github.com/PacktPublishing/.NET-Core-2.0-By-Example/tree/master/Chapter02/DllImport)

[Example Dll](https://github.com/PacktPublishing/.NET-Core-2.0-By-Example/tree/master/Chapter02/ExampleDLL)

### Key takeaways
1. Getting started with PInvoke using .NET Core
2. Introduction to NCurse and how to consume it from .NET Core

## [Chapter 3](https://github.com/PacktPublishing/.NET-Core-2.0-By-Example/tree/master/Chapter03)
[Getting Started](https://github.com/PacktPublishing/.NET-Core-2.0-By-Example/tree/master/Chapter03/GettingStarted)

[Tic-tac-toe](https://github.com/PacktPublishing/.NET-Core-2.0-By-Example/tree/master/Chapter03/TicTacToeGame)

### Key takeaways:
1. Configuring services in ASP.NET Core apps.
2. Configuring and using SignalR Core with ASP.NET Core

### Demo
[Play Tic-tac-toe](http://testdecompression.azurewebsites.net/)
1. The above link would take you to Register page. Register with your name and display image (size should be less than 1 MB) that you wish to use for playing instead of X or O icon, and click Register button.
2. Upon registration, user would be navigated to the "Find Opponent Player" screen, to find an opponent player, against which you can play. Click on the button to find if you have any opponent player. If you don't find anyone, ask your friend to register and find opponent player. Both of you, should now be able to play a game of tic-tac-toe. Enjoy the game!

## Chapter 4, 5 and 6
[Let's Chat](https://github.com/PacktPublishing/.NET-Core-2.0-By-Example/tree/master/Chapter04/LetsChat)

[Let's Chat Test](https://github.com/PacktPublishing/.NET-Core-2.0-By-Example/tree/master/Chapter06/LetsChatTest)

[Faq Bot](https://github.com/PacktPublishing/.NET-Core-2.0-By-Example/tree/master/Chapter06/FaqBot)

### Key takeaways
1. Integrating Facebook login with your ASP.NET Core app. Google/Microsoft/Twitter can be learnt and tried from [ASP.NET Core documentation](https://docs.microsoft.com/en-us/aspnet/core/security/authentication/social/)
2. Using configuration.
3. Intro to authorization and authentication.
4. Learn to develop simple FAQ BOT.
5. Get started with simple unit tests.

### Demo
[Let's Chat](https://packtletschat.azurewebsites.net) - Online Chat Room
1. The above link would redirect to Facebook login screen (if you are not already logged in to Facebook). Instead of fetching the user name and image from the user input, the app uses your Facebook profile to get user name and profile picture.
2. Upon login, user would be redirected to Chat Room page. You would be able to chat with all the logged in people in the Let's Chat app.
It displays the message when a user joins or leaves the room and also shows Online Users on the left panel. Happy chatting!

## Chapter 7

[Reference to Cloud Storage Resources with .NET Core 2.0](https://docs.microsoft.com/en-us/aspnet/core/data/azure-storage/?view=aspnetcore-2.0)

## Chapter 8
[Getting Started With EF Core](https://github.com/PacktPublishing/.NET-Core-2.0-By-Example/tree/master/Chapter08/GettingStartedWithEFCore)

[Movie Booking app](https://github.com/PacktPublishing/.NET-Core-2.0-By-Example/tree/master/Chapter08/MovieBooking)

[Extended Chapter 8](https://github.com/PacktPublishing/.NET-Core-2.0-By-Example/blob/master/Chapter08/MovieBooking/Readme.md)

### Key takeways:
1. Getting started with Entity Framework Core.
2. Learn to do simple CRUD operations using ASP.NET Core 2.0 and apply migrations.
3. Deploy an ASP.NET Core app to Azure.
4. Introduction to Razor pages. I feel Razor pages makes UI development fast and controller approach can be used to make Web APIs. This choice of UI and API development should be very productive, while still maintaining separation of concerns.

### Demo
[Movie Booking App](http://packtmoviebookingapp.azurewebsites.net/)

Just browse the link. The data is fetched from the DataStore class and getting it from SQL database (as hosting and deploying on Azure is a cost) is left as an exercise to the reader. Please refer to Getting Started With EF Core sample to accomplish the same.

[Chat BOT](http://packtmoviebookingapp.azurewebsites.net/Chat.html)

Chat with ASP.NET Core FAQ BOT and do simple converstaion like Hi, Why ASP.NET Core, MVC, about book, etc. Have Fun !

## Chapter 9
[Blazor Source Code](https://github.com/aspnet/Blazor)

### Key takeaways:
1. Introduction to Blazor.

# Usage Instructions
### 1. Clone or download the repository by clicking the Clone or download button.
### 2. For C# and .NET Core Samples:
1. Open the *Packt.DotNetCore2ByExamples.Examples.sln* solution file in Visual Studio 2017
2. Run the app as per chapter information given above.
### 3. For F# Project:
* Open the F# sample project solution in Visual Studio 2017 and run the app.
### 4. For C++ and Ubuntu code samples:
* Ubuntu Code samples should be downloaded and opened with Visual Studio Code.
* C++ ExampleDll solution can be directly opened in Visual Studio 2017.

For a thorough undertsanding and extended reading, following resources are recommended:
1. [ASP.NET Documentation](https://docs.microsoft.com/en-us/aspnet/)
2. [Entity Framework Core Source Code](https://github.com/aspnet/EntityFrameworkCore)
3. [ASP.NET Core MVC Source Code](https://github.com/aspnet/Mvc)
4. [Kestrel Server Source Code](https://github.com/aspnet/KestrelHttpServer)
5. [New Announcements from ASP.NET](https://github.com/aspnet/Announcements) - Keep this repo on watch list for latest and greated updates.
6. [ASP.NET Core docker images](https://github.com/aspnet/aspnet-docker)
7. [SignalR Core Source Code](https://github.com/aspnet/SignalR)
8. [ASP.NET Home Repository](https://github.com/aspnet) - Keep exploring, keep learning.

Though the demo apps should work in all modern browsers, we only checked them against Chrome, so in case you face any issues in other browsers, please try using Chrome browser for demos.
For any issues, questions, suggestions or constructive feedback, please contact [Rishabh<EMAIL_ADDRESS>or [Neha<EMAIL_ADDRESS>
## Related Products
* [C# 7 and .NET Core 2.0 Blueprints](https://www.packtpub.com/application-development/c-7-and-net-core-20-blueprints?utm_source=github&utm_medium=repository&utm_campaign=9781788396196)

* [C# 7 and .NET Core 2.0 High Performance](https://www.packtpub.com/application-development/c-7-and-net-core-20-high-performance?utm_source=github&utm_medium=repository&utm_campaign=9781788470049)

* [.NET Standard 2.0 Cookbook](https://www.packtpub.com/application-development/net-standard-20-cookbook?utm_source=github&utm_medium=repository&utm_campaign=9781788834667)
### 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 download a free PDF copy of this book.

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

gha_language: JavaScript

gha_license_id: MIT


text:
# Use AGS to create a workflow

You can call StartWorkflow to create a workflow.

## Request

Request line

```
POST /gs/workflow  HTTP/1.1
```

Custom request headers

None. For more information, see [Common parameters](/intl.en-US/API Reference/Common parameters.md).

Request body

```
The following code block shows how to create a mapping workflow:
{
      "workflow_type": "mapping",
      "service": "s" (#SLA: [n: normal|s: silver|g: gold|p: platinum])
      "mapping_oss_region": "cn-shenzhen",
      "mapping_fastq_first_filename": "MGISEQ2000_PCR-free_NA12878_1_V100003043_L01_1.fq.gz",
      "mapping_fastq_second_filename": "MGISEQ2000_PCR-free_NA12878_1_V100003043_L01_2.fq.gz",
      "mapping_bucket_name": "gene-shenzhen",
      "mapping_fastq_path": "fastq/MGISEQ2000",
      "mapping_reference_path": "reference/hg19", [Optional]
      "mapping_is_mark_dup": "true",
      "mapping_bam_out_path": "output/bamDirName",
      "mapping_bam_out_filename": "abc.bam"
}

The following code block shows how to create a whole genome sequencing (WGS) workflow:
{
     "workflow_type": "wgs",
     "service": "s" (#SLA: [n: normal|s: silver|g: gold|p: platinum]),
     "wgs_oss_region": "cn-shenzhen",
     "wgs_fastq_first_filename": "MGISEQ2000_PCR-free_NA12878_1_V100003043_L01_1.fq.gz",
     "wgs_fastq_second_filename": "MGISEQ2000_PCR-free_NA12878_1_V100003043_L01_2.fq.gz",
     "wgs_bucket_name": "gene-shenzhen",
     "wgs_fastq_path": "fastq/MGISEQ2000",
     "wgs_reference_path": "reference/hg19",
     "wgs_vcf_out_path": "output/vcf",
     "wgs_vcf_out_filename": "abc.vcf"
}
```

|Parameter|Type|Description|
|:--------|:---|-----------|
|workflow\_type|String|The type of the workflow. Valid values: wgs and mapping.|
|service|String|The type of service-level agreement \(SLA\). Valid values: n, s, g, and p.|
|mapping\_oss\_region|String|The region where the Object Storage Service \(OSS\) bucket that stores data of the mapping workflow is deployed.|
|mapping\_fastq\_first\_filename|String|The name of the first FASTQ file of the mapping workflow.|
|mapping\_fastq\_second\_filename|String|The name of the second FASTQ file of the mapping workflow.|
|mapping\_bucket\_name|String|The name of the OSS bucket that stores data of the mapping workflow.|
|mapping\_fastq\_path|String|The path of the FASTQ files of the mapping workflow.|
|mapping\_reference\_path|String|The path of the reference files of the mapping workflow.|
|mapping\_is\_mark\_dup|String|Specifies whether to mark duplicate values.|
|mapping\_bam\_out\_path|String|The output path of the Binary Alignment Map \(BAM\) file.|
|mapping\_bam\_out\_filename|String|The name of the output BAM file.|
|wgs\_oss\_region|String|The region where the OSS bucket that stores data of the WGS workflow is deployed.|
|wgs\_fastq\_first\_filename|String|The name of the first FASTQ file of the WGS workflow.|
|wgs\_fastq\_second\_filename|String|The name of the second FASTQ file of the WGS workflow.|
|wgs\_bucket\_name|String|The name of the OSS bucket that stores data of the WGS workflow.|
|wgs\_fastq\_path|String|The path of the FASTQ files of the WGS workflow.|
|wgs\_reference\_path|String|The path of the reference files of the WGS workflow.|
|wgs\_vcf\_out\_path|String|The path of the Variant Call Format \(VCF\) file.|
|wgs\_vcf\_out\_filename|String|The name of the VCF file.|

## Response

Response line

```
HTTP/1.1 200 OK
```

Custom response headers

None. For more information, see [Common parameters](/intl.en-US/API Reference/Common parameters.md).

Response body

```
The following sample output is returned when a mapping workflow is created.
{
        JobName: mapping-gpu-66xv7
    }

The following sample output is returned when a WGS workflow is created.
    {
        JobName: wgs-gpu-tvltf
    }
```

|Parameter|Type|Description|
|:--------|:---|-----------|
|JobName|String|The name of the workflow.|

## Examples

Sample requests \(Python\)

```
#! /usr/bin/env python
# coding=utf-8

from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.request import CommonRequest
import os

os.environ.setdefault('DEBUG', 'sdk')

client = AcsClient(os.environ['accessKeyID'], os.environ['accessKeySecret'], 'cn-beijing')

request = CommonRequest()
request.set_accept_format('json')
request.set_method('POST')
request.set_protocol_type('https') # https | http
request.set_domain('cs.cn-beijing.aliyuncs.com')
request.set_version('2015-12-15')

request.add_query_param('RegionId', "cn-shenzhen")
request.add_header('Content-Type', 'application/json')
request.set_uri_pattern('/gs/workflow')
body = '''{"cli_version":"v1.0.1-882299b","wgs_bucket_name":"my-test-shenzhen","wgs_fastq_first_name":"MGISEQ/MGISEQ2000_PCR-free_NA12878_1_V100003043_L01_1.fq.gz","wgs_fastq_second_name":"MGISEQ/MGISEQ2000_PCR-free_NA12878_1_V100003043_L01_2.fq.gz","wgs_oss_region":"cn-shenzhen","wgs_reference_file":"hs37d5","wgs_service":"g","wgs_vcf_File_name":"vcf/MGISEQ_NA12878_hs37d5_13.vcf","workflow_type":"WGS"}'''
request.set_content(body.encode('utf-8'))
response = client.do_action_with_exception(request)
```

url: https://raw.githubusercontent.com/laashub-soa/csk/88398325c72770441e97e901c8d3b28e38d388ff/intl.en-US/User Guide for Genomics Service/AGS API reference/Use AGS to create a workflow.md

repository: laashub-soa/csk

filename: Use AGS to create a workflow.md

repo_name: laashub-soa/csk


text:
# Gauntlet

This application is a basic Python clone of an older Java application used by the gauntlet crew on [GameFAQs' Contest Board](https://gamefaqs.gamespot.com/boards/8-gamefaqs-contests) for ranking things. I created it as part of learning how to use [tkinter](https://docs.python.org/3/library/tkinter.html).

Additional functionality may be added in future if time permits. Things that can still be done:
* Add a 'start screen' that lets the user select which image folder to use.
* Add an option to the GUI to allow the user to change how many losses are required to eliminate a participant.
* Add support for N-way matches, as opposed to always being 2-way.
* Output match history, in addition to the results.
* Clean up documentation.

Usage:
1. Install [Python 3.9](https://www.python.org/downloads/).
2. Clone this repo and open the project's root folder in a command line.
3. Install the requirements using `pip install -r requirements.txt`.
4. Run the app using `python main.py`.
5. The app will use images placed in the `/img` directory as the participants.

branch_name: refs/heads/main


text:
---
title: "Squash Git Commits"
date: 2018-10-16T10:36:05+01:00
draft: false
tags:
    - git
    - zsh
---

Ever made several commits on a feature branch and needed to rebase? Rebasing multiple commits can be tedious if there is a conflict from an early commit, requiring a commit resolution in every commit that follows. It can be practical, therefore, to squash multiple commits into a single commit before rebasing.

 I often make quick commits if I'm required to switch branches, or spiking an idea during development that ends up being permanent. I'm left with messy commit messages that rarely follow [best practice](https://chris.beams.io/posts/git-commit/). Squashing commits to the rescue again! I can then take the time to carefully construct a commit message.

I will be using the oh-my-zsh aliases in this example below

> Required: Z-Shell & [oh-my-zsh](https://ohmyz.sh/)

```
$ glo
5fe9acf97 done
5306d9b9f Vevert 'try out a fix'
da1341005 more wip
ef8bb3f49 try out a fix
471bd09c1 wip
895143a59 start the work
2b2a51e70 (HEAD -> master, origin/master, origin/HEAD) Refactor layout
```

As you can see, the commit history is a mess. Let's squash all the commits since the _head_ of local master into one commit.

```

Now we're in a position to rebase as the impact of a potential conflict has been reduced. Update your local copy of all remote branches and rebase on master.

```
$ gfo
$ grb origin/master
```

Resolve any conflicts using your editor then continue the rebase.

```
$ gaa
$ grbc
```

Confirm the history is as you expect, then push!

```bash
$ gst
$ gp -f # or use gpsup if the branch has not been pushed before
```

> For a list of aliases, simply use the command: `alias`

license: Unlicense


text:
### Reviewing Dependabot's Pull Requests

- Check that the review app on heroku works if there is one.
- If there's no heroku review app pull the branch and check it locally on your machine.
- Rebase if needed.
To do this comment `@dependabot rebase` on the PR and Dependabot will do it for you and 'like' your comment to confirm that the instruction has been received.
- Look at the code diff to see what changes have been made.
(The dependencies on that dependencies may effect something else in your system unrelated to the gem which is being updated).
- Check the PR comment made by dependabot.
It should contain all the infos about commits made and any new entries in the changelog which may have implications for your code.
- Security PRs take precedence over other PRs.
- Different languages should be dealt with by the appropriate developer i.e. JS -> FE, Ruby -> BE.

repository: barnardos/developer-manual

gha_language: Shell

repo_name: barnardos/developer-manual


text:
## Demo

[https://mcpumpafee.com](https://mcpumpafee.com)

## Development

Set up environment variables in `.env` file

```
TWITTER_CONSUMER_KEY=
TWITTER_CONSUMER_SECRET=
TWITTER_ACCESS_TOKEN_KEY=
TWITTER_ACCESS_TOKEN_SECRET=
```

Run server

```bash
npm start
```

## License

MIT

repository: miguelmota/mcpumpafee

repo_name: miguelmota/mcpumpafee


text:
---
title: Risk Modeling
---

  * *Overview:* ["An Introduction to Threat Modeling"](https://ssd.eff.org/en/module/introduction-threat-modeling) (Surveillance Self-Defense)

  * *Guide:* ["Risk Assessment"](http://frontlinedefenders.org/files/workbook_eng.pdf#page=9) (Workbook on Security: Practical Steps for Human Rights Defenders at Risk - Chapter 2)

  * *Guide:* ["Threat Assessment: Chapter 2.5 p. 38"](http://www.odihpn.org/download/gpr_8_revised2pdf#page=38) (Operational Security Management in Violent Environments (Revised Edition))

  * *Guide:* ["Defining The Threshold Of Acceptable Risk"](http://integratedsecuritymanual.org/exercise/defining-the-threshold-of-acceptable-risk) (Integrated Security)

  * *Guide:* ["Guide for Conducting Risk Assessments"](http://csrc.nist.gov/publications/nistpubs/800-30-rev1/sp800_30_r1.pdf) (NIST 800-30)

  * *Report:* ["Risk Thresholds in Humanitarian Assistance"](https://www.eisf.eu/library/risk-thresholds-in-humanitarian-assistance-2/) (European Interagency Security Forum)

repository: SAFETAG/SAFETAG

repo_name: SAFETAG/SAFETAG


text:
# ADM-HW4

- Alessandro Quattrociocchi (1609286)
- Mirko Lozzi (1613091)
- Zhibek Aben - (1875669)

In this homework we have implemented two important algorithms from scratch: the first is HyperLogLog and the second is K-Mean.
Since these two algorithms required several functions and a few lines of code, we decided to organise the project in the following way.
The final notebook contains only the results of the functions, some theoretical sections and explanations of the code.
This allow you to focus on the analysis of the results and the organisation.
There are also four ***.py*** files containing the code used to implement the algorithms and functions required.
In particular:

* ```hash_function.py``` contains the hash function used to implement the HLL.
* ```HLL contains``` the HyperLog algorithm.
* ```global_cleaning``` contains all the functions required for cleaning text such as punctuation, stop words, stemming, some verbs and adverbs.
* ```K_Mean``` contains the algorithm for clustering.

### Useful Documentation and Data

* [HyperLogLog](http://algo.inria.fr/flajolet/Publications/FlFuGaMe07.pdf)
* [Processed strings with hash function](https://drive.google.com/file/d/1CkJc_Swt1FwjWxmPTN8eCWkpMS8bolAy/view?usp=sharing)
* [Clean Dataset](https://drive.google.com/file/d/1UpUaVAGoJQCB16YOH67fpCIM5yA5r1Pa/view?usp=sharing)

path: /2 - Hashing and Clustering/README.md


text:
# ufo-management-server

Management Server component of uProxy for Orgs (UfO)

## Deployment Guide

### Deploy an Instance

The Management Server can be deployed locally or to the cloud. We have setup a one-click to deploy instance on Heroku to facilitate easy updating. That is the preferred method for creating a new instance as it is what customers will use. There is also a means to do this via command line. Both approaches are described here. For reference, app and instance are used interchangeably throughout.

#### Deploy App via Click-to-Deploy

The click to deploy method creates a new app based on a template from github. Heroku will read the configurations already created there and generate a new app for you, with almost no interaction required. Simply follow these steps:

1. Create Your Instance

  1. [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://dashboard.heroku.com/new?template=https://github.com/uProxy/ufo-management-server-flask/tree/master) [Backup Deployment Link if Button Isn't Working](https://dashboard.heroku.com/new?template=https://github.com/uProxy/ufo-management-server-flask/tree/master)
    * It is easier to open this in a new window/tab so you can view the instructions and Heroku at the same time.
    * TODO(eholder): Switch this to production version after beta testing. We want testers to use master in the meantime for quick fixes.
  1. Login if you have an account.
    * If not, create an account, verify your email addres, and come back to click the deployment link again so it takes you to the correct page.
  1. Fill in the app name if desired. Leave all other settings unchanged.
  1. Fill in the RECAPTCHA_SITE_KEY and RECAPTCHA_SECRET_KEY in the Config Variables section. For information on how to create these keys, see [configure Recaptcha for login protection](DeploymentGuide.md#configuring-recaptcha-for-login-protection).
    * Note, when copying the keys from Recaptcha's site, it can sometimes include some of the html form below the key. Please do not paste the extra html into your key on Heroku.
  1. Click the “Deploy” button.
  1. Wait for Heroku to create the app...
    * If you encounter an error here with your credit card info after just creating a new account, it is an issue with Heroku. Simply try clicking deploy again.

1. Enable Clock Process

  * UfO as currently implemented uses two distinct processes (called dynos by heroku): a web process for handling requests, and a clock process to wake up and perform extra jobs based on a schedule.  The steps below explain how to do this.
    * TODO(eholder): Investigate how to enable the clock process automatically.

  1. Once Heroku has finished deploying your app, click the “Manage App” button to navigate to Heroku’s management dashboard.
  1. On the management dashboard, under the Resources tab, click the pencil icon next to the clock dyno to edit it.
  1. Enable the clock dyno and confirm the change.

1. Configuring Your App's Settings

  1. If you have not done this previously, you should [configure Recaptcha for login protection](DeploymentGuide.md#configuring-recaptcha-for-login-protection).
  1. Once complete, you can then navigate directly to the app via clicking the menu button in the top of Heroku and selecting “Open app” or by visiting the following address:
    * `http://<your_instance_name>.herokuapp.com/setup/`
    * The process there will walk you through creating your admin account within the app and configuring oauth, if desired.

#### Deploy App via Command Line

Before deploying a test instance to Heroku, first follow their [steps to install](https://devcenter.heroku.com/articles/getting-started-with-python#introduction) the toolbelt and setup the local environment.
On ubuntu, heroku is installed under `/usr/local/heroku/bin` directory.

To deploy a test instance to Heroku, run the commands listed below. These can be chained on the commandline. Note: `--app` is only required if you have more than one heroku app. If you have multiple apps, then you will have multiple heroku remotes. Use `git remote -v`to view them, but if you use one, the name is like `heroku`.

1. `git checkout <your_dev_branch>`
1. `heroku login (only necessary if you aren’t already logged in)`
1. `heroku create <your_instance_name>`
1. `heroku buildpacks:add heroku/nodejs --app <your_instance_name>`
1. `heroku buildpacks:add heroku/python --app <your_instance_name>`
1. `heroku buildpacks:add https://github.com/uProxy/nginx-buildpack --app <your_instance_name>`
1. `git push <your_heroku_remote_name> <your_dev_branch>:master (optional -f)`
1. `heroku addons:create heroku-postgresql --app <your_instance_name>`
1. `heroku run python setup_database.py --app <your_instance_name>`
1. `heroku ps:scale web=1 clock=1 --app <your_instance_name>`
1. `heroku ps --app <your_instance_name> (optional)`
1. `heroku logs --tail --app <your_instance_name> (optional)`

Now, you can visit your test instance on heroku.
* `http://<your_instance_name>.herokuapp.com/setup/`

### Update an Instance

Similarly to creating an instance, updating an instance can be done via the Heroku UI or via command line. The Heroku UI approach is what customers will use, so refer to that documentation which will be expanded in time. The command line approach is useful for debugging test environments. Each is described below.

#### Update an Instance in Heroku

To update a running instance in Heroku, the instance will need to be connected to the github repository once and then the update process can be easily run afterwards.

##### Connect a Heroku Instance to Github

1. Navigate to the Heroku dashboard for the instance desired, such as the link below:
  * https://dashboard.heroku.com/apps/<your_instance_name>/resources
1. Click the “Deploy” tab at the top.
1. In the “Deployment Method” section, click Github.
1. In the “Connect to Github” section, find your repository for the management server.
  * For the production instance, this will be under the uProxy Organization and named ufo-management-server-flask.
1. Select “Connect” next to your repository.

##### Deploy an Update After Connecting to Github

1. Navigate to the Heroku dashboard for the instance desired, such as the link below:
  * https://dashboard.heroku.com/apps/<your_instance_name>/resources
1. Click the “Deploy” tab at the top.
1. In the “Manual Deploy” section, select a branch to deploy.
  * For the production instance, the branch will be named production.
1. Click “Deploy Branch”.

Optionally, you can also enable automatic deployment from a branch of your choosing in the “Automatic Deploys” section. This is NOT recommended for any branch other than production if using the ufo-management-server-flask repository.

Note: The nightly release uses the master branch with automatic deployment setup. This is for development purposes only and should NOT be used by customers.

#### Update an Instance on Command Line

After the initial creation of a test instance, you can run an abbreviated set of commands to update the test instance with your code change.

1. `git push heroku <your_dev_branch>:master (optional -f)`
1. `heroku ps:scale web=1 worker=1 clock=1 --app <your_instance_name>`
1. `heroku ps --app <your_instance_name> (optional)`
1. `heroku logs --tail --app <your_instance_name> (optional)`

The same steps as updating a test instance apply for updating the production instance. The production instance is named ufo-prod and is accessed at https://ufo-prod.herokuapp.com/ . Before updating the production instance, consult the steps listed under Release.

### Remove an Instance

To tear down the test instance:
* `heroku destroy <your_instance_name>`
The production instance should NEVER BE REMOVED!

### Debug an Instance

To show the status of a running instance:
* `heroku ps --app <your_instance_name> (optional)`
To view the configuration of a running instance:
* `heroku config --app <your_instance_name> (optional)`
To run a local instance:
* `heroku local`
To view the logs of an instance:
* `heroku logs --app <your_instance_name> (optional)`

### Setup SSH Keys to Access Proxy Server

1. Know which user the ssh-client will be using to access the proxy server.  Currently, this is hard-coded to root.
1. Either have an existing key-pair or generate it.
  * `ssh-keygen -t rsa -b 4096 -C<EMAIL_ADDRESS>1. Copy the public key to the user who the ssh-client will be accessing the proxy server.
  * `sudo ssh-copy-id -i <full_path_to_public_key> <root_or_other_user>@<proxy_server_ip_address>`
  * [More details here](https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-14-04) especially if you want to setup other non-root user.
1. Save the corresponding private key to the management server for this proxy server.

### Securing the Server with TLS

When deployed on Heroku, the Management Server utilizes an [nginx buildpack](https://github.com/uProxy/nginx-buildpack) with [our own configuration](https://github.com/uProxy/nginx-buildpack/blob/master/config/nginx.conf.erb#L43) to provide a secure layer for HTTPS/HTTP + TLS. We redirect all traffic to the HTTPS version via a 301 Moved Permanently redirect and also provide the [HTTP Strict Transport Security (HSTS)](https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security) header to prevent clients that have visited via HTTPS to get downgraded to HTTP without the browser recognizing the potential attack. This is automatically configured out of the box during deployment and works by using Heroku’s SSL cert. When using a custom domain name, an SSL cert for that domain must be provided, but from our perspective it will function identically.

Outside of Heroku however, the nginx setup is entirely avoided since we do not anticipate users to deploy with gunicorn or a Procfile (as required by Heroku). We encourage anyone running the management server off of Heroku to use a similar system to nginx to provide their own HTTPS/HTTP + TLS security where available.

### Configuring Recaptcha for Login Protection

The Management Server utilizes [Recaptcha](https://www.google.com/recaptcha/intro/index.html) to prevent brute force login attacks. You can configure a recaptcha project by visiting the [admin setup site](https://www.google.com/recaptcha/admin#list) and registering a new site. You'll want to add your deployed app's domain, such as my-app-name.herokuapp.com. This will generate site and secret keys for your app.

Afterwards, you'll need to inform your deployed app of the site and secret keys that Recaptcha produces. You can do this during deployment or afterwards, but it is recommended during deployment. If doing this during deployment, simply fill in the RECAPTCHA_SITE_KEY and RECAPTCHA_SECRET_KEY in the Config Variables section when deploying your instance on Heroku. The section below shows how to add these after deployment.

#### Adding Recaptcha Keys to a Deployed Instance

Here are the steps to add Recaptcha's site and secret keys as environment variables in your app on Heroku:

1. Visit the [heroku dashboard](https://dashboard.heroku.com/apps).
1. Navigate to your app, such as my-app-name.
1. Go to the Settings tab.
1. Click 'Reveal Config Vars'
1. Scroll to the bottom.
1. Type in RECAPTCHA_SITE_KEY for the key and copy and paste in the value for the site key you received on the [admin setup site](https://www.google.com/recaptcha/admin#list) for your app.
  * Note, when copying this from Recaptcha's site, it can sometimes include some of the html form below the key. Please do not paste the extra html into your key on Heroku.
1. Click Add.
1. Type in RECAPTCHA_SECRET_KEY for the key and copy and paste in the value for the secret key you received on the [admin setup site](https://www.google.com/recaptcha/admin#list) for your app.
  * Note, when copying this from Recaptcha's site, it can sometimes include some of the html form below the key. Please do not paste the extra html into your key on Heroku.
1. Click Add.

That's it! Your app should now pick up the site and secret keys to use recaptcha after several failed logins attempts. If you run into an issue with these not being picked up, we suggest that you redeploy the server by pushing a blank update. For information on that, check the sections above for Update an Instance.

## Troubleshooting

### SQLAlchemy Unable to Open Database/app.instance_path Not Pointing to App Directory

This error is caused by your virtual environment not being setup or not currently running. You can enable your virtual environment with the following command:

`. venv/bin/activate`

Furthermore, if you need to reset your entire environment, you can with the following steps:

1. Make sure venv is turned on: `. venv/bin/activate`
1. Pickup the latest dependencies: `pip install -r requirements.txt and bower install`
1. Create the vulcanized html: `./vulcanize.sh`
1. Reset the database: `rm -fr instance/app.db` and `python setup_database.py`
1. Start the server (if it isn't already): `python run.py`
1. Go through the setup flow. `http://your-app-instance/setup`

### Check That User Keys Are Distributed

* Login to the proxy server machine (as root).
* `docker exec uproxy-sshd cat /home/getter/.ssh/authorized_keys`


text:
# Usage

## Overview

**Notice:** These commands are early alpha and may change significantly between application versions.

oc-bundle has two main modes of operation: `create` and `publish`.

## Prerequisites

### Authentication:
oc-bundle currently retrieves registry credentials from `~/.docker/config.json`. Make sure that your [Red Hat OpenShift Pull Secret](https://console.redhat.com/openshift/install/aws/installer-provisioned) and any other needed registry credentials are populated in `~/.docker/config.json`

### Certificate Trust

oc-bundle currently references the host system for certificate trust information. For now, you must [add all certificates (trust chain) to be trusted to the System-Wide Trust Store](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/security_guide/sec-shared-system-certificates)

## Create
During the create phase, a declarative configuration is referenced to download container images. Depending on the state of the workspace, the behavior of `create` will either package all downloaded images into an imageset or only the missing artifacts needed in the target environment will be packaged into an imageset.

### Create Full
To create a new full imageset, use the following command with the target directory being a new, empty location and the configuration file authored referencing the config spec for the version of oc-bundle:

`oc-bundle create full --dir=<< empty directory >> --config=<< Path to config file >>`

**Note 1:** Depending on the configuration file used, this process may download multiple-hundreds of gigabytes of data. This may take quite a while. Use the optional `log-level=debug` command line flag for more verbose output to track command execution.

**Note 2:** After `oc-bundle create full` has finished, an imageset named bundle_000000.tar will have been created and available in your current directory. Use this file with `oc-bundle publish` to mirror the imageset to a disconnected registry.

### Create Diff

Once a full imageset has been created and published, differential imagesets that contain only updated images as per the configuration file can be generated with the following command:

`oc-bundle create diff --dir=< empty directory >> --config=<< path to config file >>`

**Note 1:** Depending on the configuration file used and the periodicity between running `oc-bundle create diff`, this process may download multiple-hundreds of gigabytes of data, though differential updates should usually result in a significantly smaller imagesets.

**Note 2:** After `oc-bundle create diff` has finished, an imageset named bundle_000000.tar will have been created and available in your current directory. This file must be used in sequence and with a publishing workspace that has a matching UUID.

## Publish

During the publishing phase, an imageset is checked against the state of a publishing workspace and then mirrored from file to a target registry server. Full imagesets must be used in conjunction with an empty workspace and differential imagesets must be published in sequence with a workspace that shares the same UUID as the incoming imageset.

To publish a full imageset use the following command:

`oc-bundle publish --dir=<< Empty Directory >> --archive=bundle_000000.tar --to-mirror=<< fqdn:port of target mirror >>`

To publish a differential imageset use the following command:

`oc-bundle publish --dir=<< previously used dir >> --archive=bundle_000000.tar --to-mirror=<< fqdn:port of target mirror >>`

repository: usrbinkat/bundle

repo_name: usrbinkat/bundle


text:
# API ADVANCED
Questions involving APIs are common for interviews. Sometimes they’re as simple as ‘write a Python script that queries a given endpoint’, sometimes they require you to use recursive functions and format/sort the results.

A great API to use for some practice is the Reddit API. There’s a lot of endpoints available, many that don’t require any form of authentication, and there’s tons of information to be parsed out and presented. Getting comfortable with API calls now can save you some face during technical interviews and even outside of the job market, you might find personal use cases to make your life a little bit easier.

## Starting 🚀

Ubuntu LTS - Operating system reqd.

### TOPICS 📋

- How to read API documentation to find the endpoints you’re looking for
- How to use an API with pagination
- How to parse JSON results from an API
- How to make a recursive API call
- How to sort a dictionary by value

## Files
| File | Description |
| ------------- | ------------- |
| 0-subs.py | Returns the number of subscribers (not active users, total subscribers) for a given subreddit |
| 1-top_ten.py | function that queries the Reddit API and prints the titles of the first 10 hot posts listed for a given subreddit. |
| 2-recurse.py |  function that queries the Reddit API and returns a list containing the titles of all hot articles for a given subreddit |
| 100-count.py |   function that queries the Reddit API, parses the title of all hot articles, and prints a sorted count of given keywords (case-insensitive, delimited by spaces. Javascript should count as javascript |

### Instalation 🔧

```
$ sudo apt-get install -y ruby
```
```
$ gem install puppet-lint -v 2.1.1
```
### Use 🔧
```
$ sudo puppet-lint apply 0-create_a_file.pp
```
```
$ sudo puppet apply 0-create_a_file.pp
```

## Builded in 🛠

* bash
* VsCode

## Authors ✒

* **Juan Sebastián Ocampo** -(https://github.com/darkares23)

## License 📄

This project is licensed under the MIT License - see the LICENSE.md file for details

## Acknowledgments 🎁

* Holberton School (providing guidance) 📢


text:
![GitHub](https://img.shields.io/github/license/secheaper/slash)
![github workflow](https://github.com/secheaper/cheaper/actions/workflows/python-app.yml/badge.svg)
[![DOI](https://zenodo.org/badge/407550383.svg)](https://zenodo.org/badge/latestdoi/407550383)
![Github](https://img.shields.io/badge/language-python-red.svg)
![GitHub issues](https://img.shields.io/github/issues-raw/secheaper/slash)
![Github closes issues](https://img.shields.io/github/issues-closed-raw/secheaper/slash)
![Github pull requests](https://img.shields.io/github/issues-pr/secheaper/slash)
![Github closed pull requests](https://img.shields.io/github/issues-pr-closed/secheaper/slash)
[![codecov](https://codecov.io/gh/secheaper/slash/branch/main/graph/badge.svg?token=I2J7ICDDI9)](https://codecov.io/gh/secheaper/slash)

Slash is a command line tool that scrapes the most popular e-commerce websites to get the best deals on the searched items across these websites.
- **Fast**: With slash, you can save over 50% of your time by comparing deals across websites within seconds
- **Easy**: Slash uses very easy commands to filter, sort and search your items
- **Powerful**: Quickly alter the commands to get desired results

  Installation
  ::
  Flags & Args
  ::
  Examples
  ::
  Use Case
  ::
  Why
  ::
  Contributors
    ::
  Support

---

---

:rocket: Installation
---
1. Clone the Github repository to a desired location on your computer. You will need [git](https://git-scm.com/) to be preinstalled on your machine. Once the repository is cloned, you will then ```cd``` into the local repository.
```
git clone https://github.com/secheaper/slash.git
cd slash
```
2. This project uses Python 3, so make sure that [Python](https://www.python.org/downloads/) and [Pip](https://pip.pypa.io/en/stable/installation/) are preinstalled. All requirements of the project are listed in the ```requirements.txt``` file. Use pip to install all of those.
```
pip3 install -r requirements.txt
```
4. Once all the requirements are installed, you will have to ```cd``` into the ```src``` folder. Once in the ```src``` folder, use the python command to run the ```slash.py``` file.
```
cd src

For Mac
python3 slash.py --search socks

For Windows
python slash.py --search socks
```
:golf: Flags and Command Line Arguments
---
Currently the tool supports the following flags and command line arguments. These flags and arguments can be used to quickly filter and guide the search to get you the best results very quickly.

| Arguments | Type | Default | Description                                                          |
|-----------|------|---------|----------------------------------------------------------------------|
| --search  | str  | None    | The product name to be used as the search query                      |
| --num     | int  | 3       | Maximum number of products to search                                 |
| --sort    | str  | re      | Sort results by relevance (re) or by price (pr)                      |
| --des     | bool | -       | Set boolean flag if results should be sorted in non-increasing order |

:card_index_dividers: Some Examples
---

#### 1. Searching
```--search```  accepts one argument string which it uses to search and scrape the requested products on
the e-commerce websites. So, to use this, run the python script followed by the --search argument and the
search string. The search string should be in double quotes if it have two or more words. Example:
```
For Mac
python3 slash.py --search "philips hue"

For Windows
python slash.py --search "philips hue"
```
```
| timestamp           | title                                       | price   | website   |
|---------------------|---------------------------------------------|---------|-----------|
| 30/09/2021 12:00:58 | Philips Hue White and Color Ambiance A19... | $134.99 | amazon    |
| 30/09/2021 12:00:58 | PARMIDA LED 5/6 inch Smart Recessed Ligh... | $20.99  | amazon    |
| 30/09/2021 12:00:58 | Philips Hue 548610 CFH Smart Light A19, ... | $79.99  | amazon    |
| 30/09/2021 12:01:00 | Philips Hue 3-Pack 60W White Bluetooth S... | $37.88  | walmart   |
| 30/09/2021 12:01:00 | Philips Hue Smart Stand Alone Bridge, Hu... | $57.92  | walmart   |
| 30/09/2021 12:01:00 | Philips Hue White and Color Ambiance Sma... | $89.99  | walmart   |
```
#### 2. Sorting
```--sort``` accepts one or more arguments that determine how the tool sorts and filters the requested products
after scraping. The first value is used to initially sort and filter the results of the scraping. The arguments
following the first one are not required but will be used to further sort the filtered results. Example:
```
For Mac
python3 slash.py --search "philips hue" --sort pr

For Windows
python slash.py --search "philips hue" --sort pr
```
```
| timestamp           | title                                       | price   | website   |
|---------------------|---------------------------------------------|---------|-----------|
| 30/09/2021 12:02:34 | Philips Hue White A19 60W Smart Dimmable... | $14.88  | walmart   |
| 30/09/2021 12:02:33 | T POWER 24V Ac Dc Adapter Charger Compat... | $16.99  | amazon    |
| 30/09/2021 12:02:33 | Philips Hue 1748930VN 8ft Cable Connecto... | $19.99  | amazon    |
| 30/09/2021 12:02:32 | PARMIDA LED 5/6 inch Smart Recessed Ligh... | $20.99  | amazon    |
| 30/09/2021 12:02:34 | Philips Hue White Ambiance A19 Smart Lig... | $24.99  | walmart   |
| 30/09/2021 12:02:34 | Philips Hue White and Color Ambiance Sma... | $29.99  | walmart   |
```
#### 3. Sort Order
The ```--des``` flag can be set to sort the requested products in a non-increasing order. This flag will be
actually used when coupled with ```--sort```. Example:
```
For Mac
python3 slash.py --search "philips hue" --sort pr --des

For Windows
python slash.py --search "philips hue" --sort pr --des
```
```
| timestamp           | title                                       | price   | website   |
|---------------------|---------------------------------------------|---------|-----------|
| 30/09/2021 12:03:42 | Philips Hue Bluetooth Smart Lightstrip P... |         | amazon    |
| 30/09/2021 12:03:42 | Philips - Hue Play HDMI Sync Box - Black... |         | amazon    |
| 30/09/2021 12:03:42 | Lutron Aurora Smart Bulb Dimmer Switch |... |         | amazon    |
| 30/09/2021 12:03:44 | Philips Hue White and Color Ambiance A19... | $199.99 | walmart   |
| 30/09/2021 12:03:44 | Philips Hue White and Color Ambiance 2-P... | $105.87 | walmart   |
| 30/09/2021 12:03:44 | Philips Hue White and Color Ambiance Sma... | $89.99  | walmart   |
```

#### 4. Result length
The maximum number of results that are scraped from each website can be set using the ```--num``` argument. It accepts
an integer value ```n``` and then returns ```n``` results from each website. Note that tool returns a maximum of
the value of ```n``` and the number of results on the webiste. By default this value is set to 3. Example:
```
For Mac
python3 slash.py --search "philips hue" --num 5

For Windows
python slash.py --search "philips hue" --num 5
```
```
| timestamp           | title                                       | price   | website   |
|---------------------|---------------------------------------------|---------|-----------|
| 30/09/2021 12:07:41 | Govee Immersion TV LED Backlights with C... | $82.99  | amazon    |
| 30/09/2021 12:07:41 | Philips Hue 548610 CFH Smart Light A19, ... | $79.99  | amazon    |
| 30/09/2021 12:07:41 | Philips Hue Play White & Color Smart Lig... | $149.99 | amazon    |
| 30/09/2021 12:07:41 | Philips Hue White and Color Iris Corded ... | $99.99  | amazon    |
| 30/09/2021 12:07:41 | Philips Hue White & Color E12 LED Candle... | $49.97  | amazon    |
| 30/09/2021 12:07:42 | Philips Hue 3-Pack 60W White Bluetooth S... | $37.88  | walmart   |
| 30/09/2021 12:07:42 | Philips Hue Smart Stand Alone Bridge, Hu... | $57.92  | walmart   |
| 30/09/2021 12:07:42 | Philips Hue White and Color Ambiance Sma... | $89.99  | walmart   |
| 30/09/2021 12:07:42 | Philips Hue White and Color Ambiance Sma... | $29.99  | walmart   |
| 30/09/2021 12:07:42 | Philips Hue White and Color Ambiance A19... | $199.99 | walmart   |
```

:thought_balloon: Use Case
---
* ***Students***: Students coming to university are generally on a budget and time constraint and generally spend hours wasting time to search for products on Websites. Slash is the perfect tool for these students that slashes all the unnecessary details on a website and helps them get prices for a product across multiple websites.Make the most of this tool in the upcoming Black Friday Sale.
* ***Data Analysts***: Finding data for any project is one of the most tedious job for a data analyst, and the datasets found might not be the most recent one. Using slash, they can create their own dataset in real time and format it as per their needs so that they can focus on what is actually inportant.

:page_facing_up: Why
---
- In a market where we are spoilt for choices, we often look for the best deals.
- The ubiquity of internet access has leveled the retail playing field, making it easy for individuals and businesses to sell products without geographic limitation. In 2020, U.S. e-commerce sales, receiving a boost due to the COVID-19 pandemic, grew 44% and represented more than 21% of total retail sales, according to e-commerce information source Internet Retailer.
- The growth of e-commerce has not only changed the way customers shop, but also their expectations of how brands approach customer service, personalize communications, and provide customers choices.
- E-commerce market has prompted cut throat competition amongst dealers, which is discernable through the price patterns for products of major market players. Price cuts are somewhat of a norm now and getting the best deal for your money can sometimes be a hassle (even while online shopping).
- This is what Slash aims to reduce by giving you an easy to use, all in one place solution for finding the best deals for your products that major market dealers have to offer!
- Slash in its current form is for people who have some understanding of python and are comfortable in using the command line interface to interact with systems.
- Future updates aim to encompass a wide variety of users irrespective of their computer knowledge and background.

:sparkles: Contributors
---

Shubham Mankar

Pratik Devnani

Moksh Jain

Rahil Sarvaiya

Anushi Keswani

:email: Support
---

For any queries and help, please reach out to us at<EMAIL_ADDRESS>


text:
# aws_ssm_provider

A configuration provider for Mix which handles AWS SSM parameters.

## Usage

This package is intended to be used in conjunction with Mix Config.Providers in Elixir 1.9+

To generate the file the config provider will read, run a command similar to

```bash
aws --region us-east-1 ssm get-parameters-by-path --path "/${SECRETS_PATH}/YOUR_PROJECT/" --recursive --with-decryption --query "Parameters[]" \
    > /etc/app_secrets.json
```

AWS recommends the path of the parameter keys follow a pattern similar to `/environment/project/service/config_key`

For example, a typical path you might set in SSM for your elixir project would be `/production/myApp/redix/port`

### Shared Configs

In order to share configs across environments, aws_ssm_provider looks for the magic string `host_app` and replaces it with the environment variable `APP_NAME`

If you had an SSM config that looked like `/production/my_project/host_app/shared_config`, and your environment had a `APP_NAME` variable that was `my_otp_app` then the `shared_config` value would be placed in your app called `my_otp_app`.

### Nesting

This package supports setting application variables that are keyword lists. For example, the path `/production/myApp/myWebApp/database/connection/port` would result in a myWebApp application variable like this

```elixir
[
    database: [
        connection: [
            port: yourValue
        ]
    ]
]
```

### Type Handling

All SSM keys are returned as strings. If you want to set your value as another type, please see the supported types below.

#### Integers

To set an integer in your application config, simply end your SSM path in `/Integer`. For example, if you wanted your port to be `4000` and not `"4000"`, your SSM key would look like `/staging/myApp/port/Integer`

#### Atoms

To set an atom in your application config, simply end your SSM path in `/Atom`.

#### Regular Expressions

To set a regex in your application config, simply end your SSM path in `/Regex`. For example, if you wanted a fileName config to match `"2019.csv"`, your SSM key would look like `/staging/myApp/fileName/Regex`. The value you enter in SSM would be

```bash
(\\d{4}.csv)
```

Notice the parantheses and the escape character for the back slash.

#### Arrays

To set an integer in your application config, simply end your SSM path in `/JsonArray`. For example, if you wanted an array of login keys, your SSM key would look like `/staging/myApp/login_keys/JsonArray`. Each item in your array can be a String (default), or Regex. If you enter your values into the Parameter Store UI in the AWS console, it will handle escaping some characters for you, so you'd want to enter something like `["^.*specialKey\\.secret$/Regex","exact-match-key"]`.

#### Booleans

`"true"` and `"false"` are translated to their respective boolean values.

### System Vars

If you have a variable in your system environment that you want injected in an application configuration, simply end your path in `/FromSystem`, for example: `/staging/myApp/database/host/FromSystem`. When using the system vars, the value of your SSM parameter will be the name of the environment variable. In this case, something like `DB_HOST`.

## Installation

The correct version for your needs depends on the version of Distillery or Elixir your project uses:

- For Distillery versions `2.0.14` and earlier, you want `{:aws_ssm_provider, "~> 0.2.1"}`.
- For Distillery versions `2.1.0` and later, you want `{:aws_ssm_provider, "~> 1.0.0"}`.
- For Elixir versions `1.9` and later (without Distillery), you want `{:aws_ssm_provider, "~> 3.0.0"}`.

The package can be installed by adding `aws_ssm_provider` to your list of dependencies in `mix.exs`:

```elixir
def deps do
  [
    {:aws_ssm_provider, "~> 3.0.0"}
  ]
end
```

The docs can be found at [https://hexdocs.pm/aws_ssm_provider](https://hexdocs.pm/aws_ssm_provider).


text:
# Python - GUI Calculator

## Sections
- [Description](#description)
- [Getting Started](#getting-started)
    - [Dependencies](#dependencies)
    - [Installing](#installing)
    - [Executing](#executing)
- [Author](#author)
- [License](#license)

---
## Description
This program is a simple Tic Tac Toe game made using the Tkinter Python toolkit.
There are two game modes which are included, Player vs Bot, and Player vs Player.

**Player vs Bot:**
Go against the computer, which randomly choses a box to place their O inside. The goal is to get three X's in a row before the computer gets three O's in a row.

**Player vs Player:**
Play with yourself or your friends where Player 1 is X and Player 2 is O. The goal is to get three X's in a row before the opponent gets three O's in a row.

The title screen below is the screen which appears when the program is first run.

Below is the gamboard which is displayed when a gamemode is selected. You can click the buttons to place your X or O.

The winner screen shown below is displayed when either player wins or draws.

---
## Getting Started

### Dependencies
- Python 3.6.0+
- Mac/Windows OS

### Installing
```bash
$ git clone https://github.com/JugalBili/Python-GUI-TicTacToe
```
Or you can download the zip directly from github.

### Executing
To execute to program, open the zip file into an IDE of your choice, or use the following in the termial:
```bash
python TicTacToe.py
```
> **Make Sure** to run the command inside the folder

---
## Author
**Jugal Bilimoria**

August 11th 2020

Project was made as a method for me to fully understand the basic concepts of Python and Tkinter.

---
## License

MIT License

Copyright (c) 2020 Jugal Bilimoria

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

 IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

repository: JugalBili/Python-GUI-TicTacToe

repo_name: JugalBili/Python-GUI-TicTacToe


text:
# Container configuration by config file

Another way to configure the dependency injection container without having to
taint your code with boilerplate marker interfaces is to specify the configuration
inside yaml files.

Before diving into how it is done, just a tiny sample:

```yaml
include:
    - included_config_file.yml
mappings:
  LoginService:
    LoginServiceLDAP:
      scope: request
	  dependencies:
	     ua:
		   scope: request
	LoginServiceDB:{}
  DBService:
    DBServiceMysql:{}
    DBServiceSQLite:
      environment: dev
  HTTPClient:
    HTTPClientLWP:
	  scope: request
```

Following this approach we can see the change on how services are specified:
we map service interfaces to implementation classes, only specifying configuration
when it deviates from the defaults. So let's review these defaults.

## Default configuration values

There are two sets of defaults when writing configuration:

- service declaration defaults
- dependencies injection defaults

### Service declaration defaults

As much as when configuring the container by code, when we declare a service
implementation, we can avoid boilerplate for the common cases.
For a given service implementation declaration, the following values are the
default:

```yaml
mappings:
  Service:
    Implementation:
	   scope: singleton
	   environment: default
	   builder: Moose
       dependencies:
	     *:
		   scope: object
```

So, by default a service is:

- Stateless, only one instance of the service is needed to provide for the
whole application.
- Built by the Moose service factory, the default one.
- Belongs to the default environment
- All of it's dependencies are object-injected (instead of request-injected).

If any of those attribute must change, only the difference must be written, all
other attributes are assumed to have default values. So, for example:

```yaml
mappings:
  LoginService:
    LoginServiceLDAP:
      scope: request
```

The LDAP implementation of the LoginService inherits all default configurations
and overrides the scope of the service, by injecting it as a request-scoped
service whenever it is required, which means it will be created each time for
each service that needs it.

### Dependencies injection defaults

By default, injected attributes of a service have the following default values:

```yaml
mappings:
  Service:
    Implementation:
      dependencies:
        *:
          scope: object
          qualifiers: []
```

The default injection scope for an attribute is object (in contrast to request),
which means that the injected objected is only injected once, when requested
the first time while building the requesting object.

## Configuration parameters

The following code sample shows all possible configuration parameters:

```yaml
include:
    - included_config_file.yml
mappings:
  LoginService:
    LoginServiceLDAP:
      scope: request
	  dependencies:
	     ua:
		   scope: request
	LoginServiceDB:{}
  DBService:
    DBServiceMysql:{}
    DBServiceSQLite:
      environment: dev
  HTTPClient:
    HTTPClientLWP:
	  scope: request
```

### include

A wiring configuration file may include an arbitrary number of different files,
that will be parsed after the content of the current one has been included in the
container.
This means that included files may override service definitions done by the
including file. So, for example, given the following definitions:

moosex-wirings.yml
```yaml
include:
    - wiring-dev.yml
mappings:
  LoginService:
    LoginServiceLDAP:
      scope: request
	  dependencies:
	     ua:
		   scope: request
```

wiring-dev.yml
```yaml
mappings:
  LoginService:
    LoginServiceDB:
      scope: singleton
      environment: development
```

When including the dev wiring file, the LoginService is augmented to have an
implementation on the development environment.

We can also rewrite the LoginServiceLDAP on the other included file:

wiring-override.yml
```yaml
mappings:
  LoginService:
    LoginServiceLDAP:
      scope: singleton
```

The LoginServiceLDAP implementator is redefined on the overriding file, and the
values written on it will completely replace the previous definition.

The name of the file to include can be anything that your file system supports.
It is relative to where the including file resides.

### scope

The service scope defines how the implementation class is instantiated when
injected into a requesting service.

- singleton (default): Only a single instance of the service ever exists. This
is not designed to hold state, but rather to profit from the nature of a
stateless service. Since there's no state, there's no danger in having only one
instance of the service. Almost all of your services should be stateless.
Any requesting service receives this single instance.

- request: The service is instantiated every time it is needed. This is necessary
for stateful services, since otherwise each request service would affect it.

### environment

The environment to which a service implementation belongs to. By default it is
'default'. Can be any arbitrary name.

A container is launched with a given environment, which will be the environment
it will use to search defined services for that environment. So, a service
defined in the development environment will only be fetchable by other services
if the container serving them is launched on that environment.

Auxiliary methods can retrieve services for a given environment.

### builder

A service is built inside the container either by two kind of factories:

- Moose (default): By using this factory, the container will analyze a moose
class and automatically inject dependent services to build an instance.

- Factory: When your moose class instead provides a way to build the declared
service, then it can do so by consuming the MooseX::DIC::ServiceFactory role,
which is an interface that declares the build_service method. This method will
be invoked by the Factory builder to build instances of your declared service.

### dependencies

A key-value hash of dependencies where the key is the name of the attribute,
and the value is a config-hash of injection points config params as seen in the
Dependencies injection defaults section.

repository: loic-prieto/moosex-dic

gha_language: Perl 6

repo_name: loic-prieto/moosex-dic


text:
# CGI Plugin and Examples

The Barracuda App Server and Mako Server do not come with a CGI
plugin. The CGI implementation in this example is implemented in Lua
and uses the
[forkpty plugin](https://realtimelogic.com/ba/doc/?url=auxlua.html#forkptylib)
for the external process management. Note that the forkpty plugin is
only available on the following platforms: Linux, Mac, and QNX.

## Instructions:

1. Copy the CGI scripts in the 'scripts' directory to /tmp/cgi-test/
   mkdir -p /tmp/cgi-test/; cp scripts/* /tmp/cgi-test/
2. Make sure the scripts are 'executable'
   chmod +x /tmp/cgi-test/*
3. Start the Mako Server and load the 'www' directory
   mako -l::www

See the
[Mako Server command line video tutorial](https://youtu.be/vwQ52ZC5RRg)
for more information on how to start the Mako Server.

After starting the Mako Server, use a browser and navigate to
http://localhost:portno, where portno is the HTTP port number used by
the Mako Server (printed in the console). You should be redirected to
http://localhost/cgi/sh.cgi. The file 'sh.cgi' is a basic CGI
shell script.

A Python script is also included. Execute the Python script as follows:

http://localhost/cgi/python.cgi?textcontent=Hello%20World

## The example's Source Code Files:

* www/index.lsp - Redirects to /cgi/sh.cgi
* www/.preload - Loads the CGI Lua module, creates a CGI directory,
  and inserts the directory into the
  [virtual file system](https://realtimelogic.com/ba/doc/?url=GettingStarted.html#VFS)
* www/.lua/cgi.lua - The CGI module

### CGI scripts:

* scripts/sh.cgi - Basic shell based script
* scripts/python.cgi - Python script accepting 'form data'


text:
# My awesome repos

## Packages

- [malhooks](https://github.com/malcodeman/malhooks) - Collection of React Hooks.
- [malcomponents](https://github.com/malcodeman/malcomponents) - Collection of React components.
- [malicons](https://github.com/malcodeman/malicons) - Collection of icons for React.
- [react-popover](https://github.com/malcodeman/react-popover) - The Popover component.
- [react-modal](https://github.com/malcodeman/react-modal) - The Modal component is used to show content on top of an overlay.
- [react-button-group](https://github.com/malcodeman/react-button-group) - A button group is a set of two or more button segments.
- [image-uploader](https://github.com/malcodeman/image-uploader) - Image uploader UI

## React

- [malicons-site](https://github.com/malcodeman/malicons-site) - Documentation site for malicons.
- [react-boilerplate](https://github.com/malcodeman/react-boilerplate) - React boilerplate.
- [apage-client](https://github.com/malcodeman/apage-client) - Single-page websites for all kinds of things.
- [framer](https://github.com/malcodeman/framer) - Interactive design tool.
- [crypto-portfolio](https://github.com/malcodeman/crypto-portfolio) - Bitcoin & cryptocurrency portfolio tracker.
- [confessions-client](https://github.com/malcodeman/confessions-client) - A mutually supportive community where deeply emotional things you can't tell people you know can be told.
- [polaroid-client](https://github.com/malcodeman/polaroid-client) - Polaroid is small, lean and pretty ✨ project-based-learning result heavily inspired by Instagram.
- [reader](https://github.com/malcodeman/reader) - All-in-One news reader.
- [reminders](https://github.com/malcodeman/reminders) - To-Do App.
- [qa-client](https://github.com/malcodeman/qa-client) - Unlimited private questions and answers in a searchable archive.
- [infludb](https://github.com/malcodeman/infludb) - The influencer marketing platform.
- [redux-saga-recipes](https://github.com/malcodeman/redux-saga-recipes) - Redux Saga recipes.
- [asset-tracker-frontend](https://github.com/malcodeman/asset-tracker-frontend) - Software for maintenance & facilities.
- [analytics-frontend](https://github.com/malcodeman/analytics-frontend) - Simple analytics for startups.
- [bakelane-client](https://github.com/malcodeman/bakelane-client) - Recovery and redistribution of safe and nutritious food client.

## React Native

- [noti](https://github.com/malcodeman/noti) - Todo app.

## Next.js

- [company.com-frontend](https://github.com/malcodeman/company.com-frontend) - My company website.
- [bosnianswho.design](https://github.com/malcodeman/bosnianswho.design) - Directory of accomplished Bosnians in the IT industry.
- [loyalty-program](https://github.com/malcodeman/loyalty-program) - Loyalty and engagement program web app, powered by Notion as a database.
- [malcodeman.com](https://github.com/malcodeman/malcodeman.com) - My online portfolio.
- [mersihaceranic.com](https://github.com/malcodeman/mersihaceranic.com) - Mersiha Karamustafić profile page.
- [resumebuilder.dev](https://github.com/malcodeman/resumebuilder.dev) - Free resume builder for developers.
- [datamock](https://github.com/malcodeman/datamock) - Random data generator.
- [blockchain-explorer](https://github.com/malcodeman/blockchain-explorer) - Blockchain information for blocks & transactions.
- [remithub](https://github.com/malcodeman/remithub) - Find, compare and review money transfer providers.
- [nft-marketplace](https://github.com/malcodeman/nft-marketplace) - Simple NFT marketplace using opensea api.
- [cookie-clicker](https://github.com/malcodeman/cookie-clicker) - Cookie clicker clone.
- [image-mods](https://github.com/malcodeman/image-mods) - Tools for working with images.
- [logik](https://github.com/malcodeman/logik) - Platform for logical reasoning tests.
- [yaml-2-env](https://github.com/malcodeman/yaml-2-env) - Simple YAML to .env convertor.
- [pomodoro-app](https://github.com/malcodeman/pomodoro-app) - Small, simple and sweet time management app.
- [bookmark-manager](https://github.com/malcodeman/bookmark-manager) - Bookmark manager for power users.
- [sensei.sh](https://github.com/malcodeman/sensei.sh) - Project based learning hub.
- [lurkstation](https://github.com/malcodeman/lurkstation) - Content oriented reddit client which aims to show reddit images and videos in most efficient way possible.

## Node

- [polaroid-server](https://github.com/malcodeman/polaroid-server) - Simple RESTful API that enable users to create and share content or to participate in social networking.
- [apage-api](https://github.com/malcodeman/apage-api) - Simple RESTful mongoDB API.
- [confessions-server](https://github.com/malcodeman/confessions-server) - Simple RESTful mongoDB API.
- [cmc-api-wrapper](https://github.com/malcodeman/cmc-api-wrapper) - Fast, reliable and unified data APIs to cryptocurrency markets.
- [micro-reddit](https://github.com/malcodeman/micro-reddit) - Microservice for getting direct image | video links from subreddits.
- [qa-server](https://github.com/malcodeman/qa-server) - Simple RESTful API imagined as a private, secure home for organization’s questions and answers.
- [node-boilerplate](https://github.com/malcodeman/node-boilerplate) - Node boilerplate.
- [asset-tracker-backend](https://github.com/malcodeman/asset-tracker-backend) - Simple REST API.
- [analytics-backend](https://github.com/malcodeman/analytics-backend) - Simple graphQL mongoDB API.
- [bakelane-api](https://github.com/malcodeman/bakelane-api) - Recovery and redistribution of safe and nutritious food api.

## Swift

- [i-am-rich-app](https://github.com/malcodeman/i-am-rich-app) - First iOS project.

## Kotlin

- [forum-android-app](https://github.com/malcodeman/forum-android-app) - Simple reddit clone.

## Python

- [micro-instagram](https://github.com/malcodeman/micro-instagram) - Microservice for getting instagram images.
- [micro-klix](https://github.com/malcodeman/micro-klix) - Microservice for scraping klix articles.
- [pygram](https://github.com/malcodeman/pygram) - Static gallery generator.

## Static

- [periodic-grid](https://github.com/malcodeman/periodic-grid) - Utilizes css grid, css modules, viewport units and typescript.
- [sign-up-template](https://github.com/malcodeman/sign-up-template) - Grid based sign up page.
- [gallery-generator-theme](https://github.com/malcodeman/gallery-generator-theme) - Simple instagram-like image gallery.
- [travel](https://github.com/malcodeman/travel) - Website for some imaginary travel agency.
- [code-editor-theme](https://github.com/malcodeman/code-editor-theme) - Template for code editor or similar software.
- [login-page](https://github.com/malcodeman/login-page) - Template for register/login page.
- [blog-template](https://github.com/malcodeman/blog-template) - Minimal blog template.
- [patterns](https://github.com/malcodeman/patterns) - Neat example of CSS Grid and collection of my favourite patterns.
- [things-clone](https://github.com/malcodeman/things-clone) - Yet another personal task manager.
- [freelance-artist](https://github.com/malcodeman/freelance-artist) - Art and Illustration website.

## Strapi

- [company.com-cms](https://github.com/malcodeman/company.com-cms) - CMS for my company website.

## Bots

- [year-progress-bot](https://github.com/malcodeman/year-progress-bot) - Small telegram bot for showing year progress.
- [birthday-bot](https://github.com/malcodeman/birthday-bot) - Birthday bot is a slack app for keeping track of office birthdays.

## Angular

- [gitstalk](https://github.com/malcodeman/gitstalk) - Discover who's upto what on Github.

## Vue

- [weather-app](https://github.com/malcodeman/weather-app) - Shows weather.

## Go

- [weather-api](https://github.com/malcodeman/weather-api) - Microservice for fetching current weather.

repository: malcodeman/my-awesome-repos

repo_name: malcodeman/my-awesome-repos


text:
---
date: '2016-11-28T14:53:03+09:00'
tags: [ 'en', 'rufus-scheduler', 'ruby' ]
---

## rufus-scheduler 3.3.0 released

I have just released [rufus-scheduler](https://github.com/jmettraux/rufus-scheduler) [3.3.0](https://rubygems.org/gems/rufus-scheduler/versions/3.3.0).

Rufus-scheduler is a job scheduling (at, in, every, cron) library available as a [Ruby gem](https://rubygems.org/gems/rufus-scheduler). It is not meant as a cron replacement, it lives within the Ruby process using it and dies with it.

Why the jump from 3.2.x to 3.3.x? It's because of a mistake I made: I was relying on `ENV['TZ']` to get timezoned Time instances. It works fine and cuts the dependency on the [tzinfo gem](https://github.com/tzinfo/tzinfo), but when you're working with multiple threads and one is setting `ENV['TZ']` to `Europe/Helsinki` while another is setting it to `America/Houston`, both might end up with Time instances in Houston or Helsinki. Chaos.

This rufus-scheduler 3.3.0 brings back the tzinfo dependency and uses it to support its `Rufus::Scheduler::ZoTime` class. Instances of ZoTime quack like if they were Ruby Time instances but keep their zone as an instance of `TZInfo::TimeZone`.

Should problems appear after an upgrade to 3.3.0, please fill a clear and detailed issue at [https://github.com/jmettraux/rufus-scheduler/issues](https://github.com/jmettraux/rufus-scheduler/issues).

This `ENV['TZ']` problem was pointed out ([gh-220](https://github.com/jmettraux/rufus-scheduler/issues/220)) by [Musha Akinori](https://github.com/knu). Many thanks to him!

A new feature made it into this 3.3.0, it was requested/contributed by [Piavka](https://github.com/piavka) in [gh-214](https://github.com/jmettraux/rufus-scheduler/issues/214). It's a `Rufus::Scheduler::Job#trigger_off_schedule` method. It lets you trigger a job, off of its schedule. If, during the off schedule run, the job is started "in schedule", overlap settings kick in. Off-schedule or in-schedule, calls to `Job#running?` will return true. It has its uses with repeat jobs.

This release also contains two fixes. One for `.parse_to_time` vs `Date` instances ([gh-216](https://github.com/jmettraux/rufus-scheduler/issues/216)), thanks to [Nicolás Satragno](http://satragno.com). And one for "day 0 cronlines" ([gh-221](https://github.com/jmettraux/rufus-scheduler/issues/221)), thanks to [Ramon Tayag](https://github.com/ramontayag).

Thanks again.

repository: jmettraux/blog

gha_language: Ruby

repo_name: jmettraux/blog


text:
# Curator

## Restore

In order to restore Elasticsearch indices, you must create a new pipeline to deploy 'curator-restore' service.
Define these environment variables to configure manual pipeline:

* **DD_SNAPSHOT_RESTORE_NAME**: Snapshot source name to restore indices. Leave it empty to use last snapshot. Empty by default.
* **DD_SNAPSHOT_RESTORE_INDICES**: Name/expression to filter indices to restore. Accepts wildcards. Leave it empty to restore all indices. Default: `index.name`.
* **DD_SNAPSHOT_RESTORE_RENAME_PATTERN**: Expression to match indices names and prepare text groups to replace, in order to rename restored indices. Leave it empty to keep original names. Empty by default.
* **DD_SNAPSHOT_RESTORE_RENAME_REPLACEMENT**: Replacement for matched indices names, in order to rename restored indices. Leave it empty to keep original names. Empty by default.

Then, you can run deploy task manually.

### Restore with rename example

For example, to restore last snapshot of an index named `test` with a new name `restored_test`, you should define:

```sh
DD_SNAPSHOT_RESTORE_INDICES=test
DD_SNAPSHOT_RESTORE_RENAME_PATTERN=(.+)
DD_SNAPSHOT_RESTORE_RENAME_REPLACEMENT=restored_$$1 # Double dollar to avoid gitlab-ci replacement
```

Remember to use a renamed value which doesn't interfere with existing aliases.

repository: redmic-project/elastic-curator

repo_name: redmic-project/elastic-curator