text:
---
layout: post
title:      "PracticeBuddy (Rails Project)"
date:       2017-12-23 23:32:06 -0500
permalink:  practicebuddy_rails_project
---

Whew! After about a week of building, I’m excited to announce that I have finally completed my Rails project! Rails was a challenging but also immensely rewarding section of the course, and I am beyond excited to start on JavaScript. But before I do, how about a quick “encore” to recap the project.

***Omg... another music post!?***

As I have mentioned in a few other blog posts—such as, [Why Are You Doing This To Yourself](http://kyleblee.com/2017/05/02/why_are_you_doing_this_to_yourself/), [Code (in the Key of C Major)](http://kyleblee.com/2017/05/18/code_in_the_key_of_c_major/), and [Why Brands Should Be More Like Brands](http://redpegmarketing.com/news/why-brands-should-be-more-like-bands/)—I come from a fairly musical background. I mean, my parents don’t play any instruments, and I didn’t start playing at the ripe age of 5; but I picked up a guitar for the first time in a middle school music class and I haven’t put it down since. Hell, I was even a music school dropout before deciding that a degree in marketing was probably a better move, in terms of maintaining a “stable income”.

While there have been ebbs-and-flows in the amount of time I have dedicated to the craft of music, it has always had an effect on the way I think and perceive the world. So, when I was brainstorming ideas for my Rails project, it was only natural that a couple ideas related to music popped up. One of them is actually something I’ve been thinking about for a while. It aims to solve a problem that most instrumentalists have had to solve on their own—often in a fairly “manual” way.

***The Problem***

Part of becoming a better musician (particularly for improvisers) is internalizing a vast and ever-growing vocabulary of musical phrases. These musical phrases—often called “licks”, “chops”, etc—are like a “bag of tricks” that a musician can pull out and use, on the spot, in various playing situations.

There are many ways to learn these phrases, such as: transcribing solos off of records, buying lick books and play alongs, swapping ideas with friends, and writing your own. However, learning the lick is really just the beginning of the process. In order to keep them fresh and usable, a player has to constantly review phrases they have learned in the past. This can become overwhelming, as serious musicians—through years of practice—will often learn hundreds upon hundreds of unique phrases, for dozens of tonal situations. I mean, that’s a lot to keep track of…

***Welcome to PracticeBuddy!***

PracticeBuddy is meant to serve as a sort of repository for a player’s constantly evolving musical vocabulary. It helps musicians keep track of all their licks—key details about each phrase, as well as dates when it should be practiced again—so that they can focus more on perfecting each lick, and worry less about remembering the ones they haven’t used in a while.

By organizing your practice routine, and making sure you never forget a lick, PracticeBuddy helps you become a better musician and improviser.

Alright, you’ve got the idea; now let’s get specific about how it works.

***Landing Page / Sign Up / Sign In***

A signed out user will first be greeted with the landing page at `root_path`. This is a simple view that has a quick summary on *PracticeBuddy* and a navbar with links that take users to *Sign In* or *Sign Up*. Not much else to talk about here.

The *Sign Up* page has fields for name, email, and password; which is all the information we need to instantiate a new `User` object and persist it to the database. Each of these attributes has validations defined on the `User` model:
* A *name* must be present
* An *email* must be present, unique, and adhere to typical email formatting (for which I used a `gem` called `validates_email_format_of`)
* A *password* must be present and is validated through `bcrypt` and the `has_secure_password` macro

You can also sign up via Facebook, which I implemented using the following gems: `omniauth`, `omniauth-facebook`, and `dotenv`.

To sign in, the user simply enters their email—which is unique and is used to identify that user in the database—and their password, which is authenticated through `bcrypt`. For this demonstration, I’ll be using an account that I have already seeded with data, so the views are more representative of what an active user would see.

***We’re in! (the Home view)***

Once a user has successfully signed up / signed in, the first view they are shown is the `sessions#index` view (`home_path`). This page is meant to be a summary of that day’s practice schedule and shows the user licks which are most important for them to focus on.

To collect this information, the app uses class level scope methods to query relevant data and organize it into sections:
* **Licks of the Day**—rounds up all the `Lick` objects whose `scheduled_practice` attribute (datetime) matches the current date
* **Overdue Licks**—selects all of the `Lick` objects that were scheduled to be practiced at a past date, but haven’t yet been practiced
* **Sloppiest Licks**—this section displays licks which have the lowest integers in their `performance_rating` column. The user specifies this number, from 1 to 5, whenever they practice a lick and it’s meant to represent how well they could execute the lick that day—could they play it smoothly with confidence, or was it sloppy with mistakes? This helps them stay on top of phrases that require extra attention and practice
* **New Backing Tracks**—this final section shows them the most recently created backing tracks (created by any user), so they can glance through them and add any they like to their own licks for future practice sessions.

***Licks***

`Lick` objects, and the various CRUD actions that can be performed on them, are really the main feature of the app, since that’s what the whole concept is based around. `Lick` resources are nested under `User`, as they are specific to the individual, practicing musician.

I will talk mostly about the `licks#index`, `licks#new`, and `licks#edit` actions/views here, since that is where most of the “action” really is.

*licks#index (URL: /users/:id/licks*

Each user has a `licks#index` view where they can see all of the licks they have created. There are *filter* and *sort* select tags available for easily narrowing results to specific licks that the user is interested in. Behind the scenes, class level scope methods are querying the collection of licks that the user is looking for and then running them through a number of sort methods to prepare them for being rendered on the page. The view changes slightly depending on which sort selection has been made (for example, dates appear next to licks when *Date Last Practiced* or *Scheduled Practice Date* have been selected, or headers appear when *Tonalities* or *Artist* have been chosen, etc).

*licks#new and licks#edit (URL: /users/:id/licks/new or /users/:user_id/licks/:id/edit)*

`licks#new` and `licks#edit` share the same form, which is written in a partial and rendered into each view. You will see fields (generated through the `form_for` helper) for all of the attributes that are directly associated with a lick, such as: name, bpm, current key, link, performance rating, scheduled practice, and description.

You will also see a collection select for `Artist`, as well as collection check boxes for `Tonalities` and `BackingTracks`. `Artist`, `BackingTracks`, and `Tonalities` also have nested forms that will instantiate objects that are already associated with this particular `Lick`. These associated objects are instantiated through custom setter methods, such as: `Lick.new_backing_track=`, `Lick.new_tonalities=`, and `CustomSetters::InstanceMethods.new_artist=` (which is included in both `Lick` and `BackingTrack` models, to keep things DRY).

***BackingTracks***

An additional class, called `BackingTrack`, has been included so that users can easily access online play along tracks to apply their musical phrases to. Similar to the `Lick` class, the full suite of `BackingTrack` CRUD actions are available as nested resources under `User`.

Unlike the `Lick` class, however, users can access additional `backing_track#show` and `backing_track#index` actions in routes outside of the nested resources. While licks are purposely specific to each individual user, I wanted `BackingTracks` to be more “communal”. By having nested routes and routes that aren’t nested, a user can see their personal `BackingTracks` (`/users/:id/backing_tracks`) or see all of the `BackingTracks` that have been created by any user (`/backing_tracks`). Users can also add any `BackingTrack` to their licks, for use in future practice sessions.

There is also a nested form (well, a nested field, really) on `backing_tracks#new` and `backing_tracks#edit` for the associated `Artist` class, so that users can build `Artist` objects off of the `BackingTrack` they are currently creating / updating. This is done through the module `CustomSetters::InstanceMethods`, whose `.new_artist=` setter method is also used during mass assignment for `Lick` objects.

***Errors / Flash Messages***

Finally, error messages and simple error highlighting (via the `field_with_errors` class) have also been implemented so that when validation fails, the reason is clearly expressed to the user. Furthermore, flash messages are used throughout the site to communicate short notices, such as: “Lick created!”, “Backing Track deleted!”, and “Hmm, we can’t seem to find a lick like that.” Both errors and flash messages are rendered into relevant views using partials.

***Now, get back to practicing! Or... JavaScript.***

So, that’s *PracticeBuddy*! A simple tool to help musicians keep track of all the musical phrases they have learned in the past and make sure that each one is ready to go for their next gig or jam session. Now, it's time to practice some chops! And after that, I think I’ll get going on the JavaScript section.

Until next time!


text:
# MyInteger

The MyInteger class implements (almost) arbitrary length integers that can be added, subtracted, and multiplied. This was an exercise for my own amusement, but it also shows that you can write short, but powerful code using itertools and rich comparison methods. The code is also statically typed, and was developed using Test Driven Development.

To install:
```
git clone git@github.com:lkindrat-xmos/MyInteger.git
pip install -e MyInteger
```

Example:
```
>>> from my_integer import MyInteger
>>> n = MyInteger(2**65)
>>> n
36893488147419103232
>>> int(n) == 2**65
True
>>> n + n == n * MyInteger(2) == MyInteger(2**66)
True
```

license: MIT

repository: lkindrat-xmos/MyInteger

branch_name: refs/heads/main

extension: md

license_type: permissive

repo_name: lkindrat-xmos/MyInteger


text:
# Burger
  ![License Badge](https://img.shields.io/static/v1?label=License&message=MIT_License&color=blue)

  Name: Matheus Bolson
  GitHub user name: mathbolson

  ## Table of contents:
  * [description](#description)
  * [Installation](#Installation)
  * [Usage](#usage)
  * [License](#license)
  * [Testing](#testing)
  * [Questions](#questions)

  ## Description:
  This is a restaurant app that lets users add the names of burgers and eat them!

  <img width="1440" alt="Screen Shot 2020-10-04 at 2 01 43 PM" src="https://user-images.githubusercontent.com/66330168/95027018-39ae4180-064a-11eb-888e-5c205b6aed83.png">

  ## Installation:
  - Clone the github repo to your local computer. - run 'npm init'
  - run on your teminal 'npm i express'
  - run on your termina 'npm mysql express-handlebars'
  ## Usage:
  [Heroku Link](https://burger-eatery.herokuapp.com/)
  I tried my best to fix my heroku but it doesn't seem to work at all.
  [Portfolio Update Link](https://github.com/mathbolson/Portfolio)

  ## license:
  MIT_License

  ## Contributing:

  ## Testing:

  ## Questions:
  Contact Matheus Bolson with any questions at<EMAIL_ADDRESS>

repository: mathbolson/Burger

branch_name: refs/heads/master

repo_name: mathbolson/Burger


text:
# pre-commit hooks

These scripts placed in this repository work as pre-commit hooks. Their primary purpose is to check code and commit messages for sensitive (unwanted) content before publishing them.

It is recommended that you install the pre-commit hooks as early as possible, so that all changes can be checked at each commit.

## vkey checker

Edit your .pre-commit-config.yaml to call pre-commit hook

```
-   repo: https://github.com/rfuehrer/pre-commit
    rev: v1.12
    hooks:
    -   id: vkeycheck
```

repository: rfuehrer/pre-commit

repo_name: rfuehrer/pre-commit


text:
# Installation
> `npm install --save @types/ip`

# Summary
This package contains type definitions for ip (https://github.com/indutny/node-ip).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ip

Additional Details
 * Last updated: Mon, 31 Dec 2018 18:25:27 GMT
 * Dependencies: @types/node
 * Global values: none

# Credits
These definitions were written by Peter Harris <https://github.com/codeanimal>, BendingBender <https://github.com/BendingBender>.


text:
# BuckleScript Bindings for Argon2

Based on [node-argon2](https://github.com/ranisalt/node-argon2).

## Install

```
npm install @leeor/bs-argon2 --save
```

## API

### The `Argon2.hash` type

To promote security of the generated hashes, a special type is used to represent the output of the hashing functions. This should be used for protecting at the type level against leakage and usage of these values in sensitive areas (such as code that is used by both client and server).

### hash

Hash a `string` or a `Node.Buffer.t` returning an `Argon2.hash`.

```Reason
type hashInput =
  | String(string)
  | Buffer(Node.Buffer.t);

let hash:
  (
    ~hashLength: int=?,
    ~timeCost: int=?,
    ~memoryCost: int=?,
    ~parallelism: int=?,
    ~type_: hashMode=?,
    ~version: version=?,
    ~salt: Node.Buffer.t=?,
    ~saltLength: int=?,
    ~associatedData: Node.Buffer.t=?,
    hashInput
  ) =>
  Js.Promise.t(hash);
```

### hashRaw

Hash a `string` or a `Node.Buffer.t` returning a `Node.Buffer.t`.

```Reason
type hashInput =
  | String(string)
  | Buffer(Node.Buffer.t);

let hashRaw:
  (
    ~hashLength: int=?,
    ~timeCost: int=?,
    ~memoryCost: int=?,
    ~parallelism: int=?,
    ~type_: hashMode=?,
    ~version: version=?,
    ~salt: Node.Buffer.t=?,
    ~saltLength: int=?,
    ~associatedData: Node.Buffer.t=?,
    hashInput
  ) =>
  Js.Promise.t(Node.Buffer.t);
```

### needsRehash

Return whether the hash needs to be recomputed due to changed options/version.

```Reason
let needsRehash:
  (~timeCost: int=?, ~memoryCost: int=?, ~version: version=?, hash) =>
  bool;
```

### verify

Verify a given `string` or `Node.Buffer.t` against a previously generated hash.

```Reason
type hashInput =
  | String(string)
  | Buffer(Node.Buffer.t);

let verify: (hash, hashInput) => Js.Promise.t(bool);
```

### Js.Json.t Enconding/decoding

Use the following two functions when (de)serializing generated hashes:

```Reason
let hashToJson: hash => Js.Json.t;
let jsonToHash: Js.Json.t => hash;
```

Note: in its current implementation, `jsonToHash` will raise an exception if the decoding fails.

gha_language: Reason

gha_license_id: MIT


text:
# Devops Kanban

> A Minimal Kanban for Azure Devops

[![Build Status](https://travis-ci.org/caiobep/devops-kanban.svg?branch=master)](https://travis-ci.org/caiobep/devops-kanban)
[![Netlify Status](https://api.netlify.com/api/v1/badges/6c692f33-19e2-430f-a9c1-ef296fb18336/deploy-status)](https://app.netlify.com/sites/serene-beaver-89e6e1/deploys)

## Features

- Taks View
  - [] Tasks Card
  - [] Card Color Based On Status

- Sprint View
  - [] Points Left
  - [] Days Left
  - [] Points Per Day Left
  - [] Card Color Based on Task Status

## Getting Started

To run the project on your machine you'll need [NodeJS](https://nodejs.org/en/).
See Deployment for notes on how to deploy on a live system.

### Installing

After clonning, you'll need to install the dependencies by running

```bash
  npm install
```

### Running

To run the application, run

```bash
  npm start
```

### Running the Tests

To run the project tests use

```bash
  npm test
```

## Deployment

To deploy the project on a live system, you'll need to run

```bash
npm run build
```

Then you get the static files that you can use on any CDN or webserver

To know more about development check [CRA Docs on deployment instructions](https://facebook.github.io/create-react-app/docs/deployment#docsNav)

## Contributing

Please consider reading our [CONTRIBUTING.md] for details on our code of conduct, best practices and styleguides.

## Versioning

We use [SemVer](https://semver.org/) for versioning

## License

This project uses the MIT License. You can check it on [LICENSE.md](./LICENSE.md)

repository: caiobep/devops-kanban

repo_name: caiobep/devops-kanban


text:
---
layout: default
---

# 1995-12-06 - Re: News on Congressional Debate on Exon

## Header Data

From: Jason Burrell<EMAIL_ADDRESS>To: "Timothy C. May"<EMAIL_ADDRESS>Message Hash: c4e113bd1965c3c335b993e394b0fe16a8e7f53722d30800ff5a4cadbb051b71

Message ID<EMAIL_ADDRESS>Reply To<EMAIL_ADDRESS>UTC Datetime: 1995-12-06 19:30:36 UTC

Raw Date: Wed, 6 Dec 95 11:30:36 PST

## Raw message

```
{% raw  %}From: Jason Burrell<EMAIL_ADDRESS>Date: Wed, 6 Dec 95 11:30:36 PST
To: "Timothy C. May"<EMAIL_ADDRESS>Subject: Re: News on Congressional Debate on Exon
In-Reply-To<EMAIL_ADDRESS>Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

On Wed, 6 Dec 1995, Timothy C. May wrote:

>
> I just heard (12:15 EST) that the House has adopted language similar to the
> original Exon-Coates language in the Senate (as opposed to the White
> language, which was less restrictive in that it dealt with material that
> was "harmful" to children, interpreted to mean child porn).
>
> It looks like Internet Service Providers will soon be held liable for
> "indecent material" passed by their systems. I would expect most ISPs will
> drop the alt.binaries.* newsgroups as a first step, and maybe other groups
> as well.

*Sigh*. Are we really ready to go back to UUCP? It looks like we'll have
to. That is, if someone doesn't set up a couple cryptographically enhanced
subnets first, or come up with some better idea. Interesting prospect,
actually.

Anyone wish to comment on the prospect of a double blind server, set
outside U.S. borders, that can act as an interface to the rest of the
world, perhaps encrypting or stego'ing the data transfered between it and
the user? Basically, an anonymous remailer that acts as a cross between
an NNTP, POP3, and SMTP servers.

> If the Exon Bill really does go into effect, and age limits on access are
> imposed, I'll be looking for what we've always joked about: the
> "Information Superhighway Driver's License."

God help us all.

--
Jason Burrell
South Texas Communications

{% endraw %}
```

## Thread

+ Return to [December 1995](/archive/1995/12)

+ Return to "[attila <attila@primenet.com>](/authors/attila_attila_at_primenet_com_)"
+ Return to "[Jason Burrell <jburrell@crl.com>](/authors/jason_burrell_jburrell_at_crl_com_)"
+ Return to<EMAIL_ADDRESS>(Timothy C. May)](/authors/tcmay_at_got_net_timothy_c_may_)"

+ 1995-12-06 (Wed, 6 Dec 95 09:33:21 PST) - [News on Congressional Debate on Exon](/archive/1995/12/f112bc68215bb2f0b0e988050a7e3f925ada0d0d876b339ee79126038f6521d3) -<EMAIL_ADDRESS>(Timothy C. May)_
  + 1995-12-06 (Wed, 6 Dec 95 11:30:36 PST) - Re: News on Congressional Debate on Exon - _Jason Burrell<EMAIL_ADDRESS>  + 1995-12-06 (Wed, 6 Dec 95 12:30:13 PST) - [Re: News on Congressional Debate on Exon](/archive/1995/12/0e941f53494cb255b98bbdc784145b87a79f7f8bece55911bbbf3a6615f79bd7) - _attila<EMAIL_ADDRESS>


text:
MacCustomControl
===========

This sample shows how to create a reusable, Custom User Interface Control in a Xamarin.Mac app and add it to a storyboard in Xcode's Interface Builder.

repository: undeadinu/mac-samples

repo_name: undeadinu/mac-samples


text:
# gnome-shell-extension-containers

**Containers** is a gnome-shell extension to manage linux container, run by [libpod](https://github.com/containers/libpod) and https://podman.io

Supported actions:
- start
- stop
- remove
- pause
- restart
- top resources
- shell - opens a shell in a new termainl
- stats - open statistics in a new terminal, updating live
- logs  - following logs in a new termianl
- view and copy most of the `inspect` info

# Install using your browser

See the [gnome extensions page](https://extensions.gnome.org/extension/1500/containers/)

# Install from source

Checkout `master` branch for latest available, or `gnome-shell-x.xx` for a specific version.

Clone, Pack, and Install

```console
$ git clone https://github.com/rgolangh/gnome-shell-extension-containers
$ make all
```

Enalble using `make enable` or using 'Tweaks' -> Extensions -> toggle 'Containers'

gha_language: JavaScript


text:
---
title: "Talking with Young Children about Deportation Worries"
date: 2017-12-11T19:28:00Z
draft: true
cover:
  thumb: "/img/iwa0ullrg6g-david-beale_l.jpg"
  image: "/img/iwa0ullrg6g-david-beale_c.jpg"
  credit: "David Beale"
  url: "https://unsplash.com/@davidbeale"
---

There is no magic answer to help children understand something that even the adults are struggling to understand.
Children and families are worried about their safety in these uncertain times. Donald Trump has made some very
disrespectful, frightening, and racist statements particularly about our immigrant communities. It is understandable
that young children are scared and worried for the safety of their families.

Each parent knows their child best. Here are some guidelines to help families support their young children.

## Children need to feel safe

In times of crisis, children want to know who will take care of them. They're dependent on adults for their survival and
security. They need a clear message that their parents are doing all they can to take care of them and to keep them
safe. Let your child know your safety plan and let them spend time with adults who may care for them if you are taken
into custody.

> "Momma is working with our church and friends to make sure we have a plan if something scary happens."

> "It is the Momma and Daddy’s job to keep kids safe. We will worry about what to do so you can feel safe and play with
your friends."

## Limit your child's exposure to news and information

The younger the children are, the more likely they are be drawn to high intensity expression of feelings. The news and
images on TV are most often much too graphic and disturbing for young children.

## Turn off the TV

When there's something tragic in the news, many parents get concerned about how to talk to their children. It's even
harder than usual if we're struggling with our own worries.

In times of crisis it is normal to turn to the news for information. However; too much of this can make us feel
hopeless, insecure, and even depressed. It is helpful to limit television viewing. Our children need us to spend time
with them.

 They listen to their parent’s worries and conversations on the phone.
They know that something is happening. Young children will almost always imagine the worst when not given support and
guidance. Talk with your children and ask them how they are feeling.

You can share in simple terms how you feel. This will help your child learn to talk about how they feel.

> "I'm sad about the news, and I'm worried. But I love you, and I'm here to care for you."

It is important to let children know it’s okay to feel sad and scared. They certainly don't need to hear all the details
of what's making us sad or scared, but if we can help them accept their own feelings as natural and normal, their
feelings will be much more manageable for them. Angry feelings are part of being human, especially when we feel
powerless. One of the most important messages we can give our children is:

> "It's okay to be angry, but it's not okay to hurt ourselves or others."

## Answer their questions to the best of your ability, at an age appropriate level, but use as few words as possible

Preschool aged children need simple sentences repeated often. They need you to do your best to show them that you are
calm, strong, and there for them. You are all that your children know of safety so even if you don’t feel safe do your
best to help your child see that the adults are looking out for them.

> "Sometimes scary things happen; but Momma, Abuela, Daddy, is here to keep you safe."

> "Daddy had to go back to Mexico but we will talk to him on the phone and try to come back together again soon.
Daddy always loves you even if he is far away."

## Children might act out in ways that do not seem to directly connect to their worries

Play is one of the important ways young children have of dealing with their concerns. Of course, playing about violent
news can be scary and sometimes unsafe, so adults need to be nearby to help redirect that kind of play into nurturing
themes.

A young child may have a harder time at preschool saying goodbye, they may be clingier, they may cry more often.
They may have troubles going to sleep at night. This is a normal response to fear. This is often a way that children
ask for more comfort from the adults in their life.  Little by little, as the adults around
them become more confident, hopeful and secure, our children probably will, too.

> "When I was a boy and I would see scary things in the news, my mother would say to me, "Look for the helpers. You will
always find people who are helping." To this day, especially in times of "disaster," I remember my mother's words and
I am always comforted by realizing that there are still so many helpers – so many caring people in this world."

> Mr. Rogers - [Early Child Mental Health Program](http://www.ecmhp.org/)


text:
XMLPath - A Scala typesafe XML dsl
====================================

Topics
------

- anti-xml, a scala-xml replacement
- monocle (lens and other optics), aka how to get/set/update immutable data structures
- scala dynamics, an unknown language feature

------

The problem
===========

Typesafe xml manipulation, without boilerplate.

Out of scope
=============

Parsing.
This session will cover only XML to XML transformations.

------

What's wrong with plain scala.xml?
====================================

- unintuitive api, especially when you neeed to update an elem
  - [SO: Modifying nested elements in xml](http://stackoverflow.com/questions/970675/scala-modifying-nested-elements-in-xml)
  - [SO: How to change attribute on Scala XML Element](http://stackoverflow.com/questions/2569580/how-to-change-attribute-on-scala-xml-element)
- unfriendly type hierarchy
- not so typesafe

------

Let's try with an extension method-based solution...

```scala
object ElemOps {

  implicit class ExtendedElem(val value: Elem) extends AnyVal {
    def findOrCreateElem(label: String): Elem = {
      value.child
        .find(_.label == label)
        .getOrElse(XML.loadString(s"<$label/>"))
        .asInstanceOf[Elem]
    }

    def addAttribute(label: String, name: String, newValue: String): Elem = {
      val elem: Elem = value.findOrCreateElem(label)
      val attributes: MetaData = elem.attributes.append(new UnprefixedAttribute(name, newValue, Null))
      val updatedElem = Elem(elem.prefix, elem.label, attributes, elem.scope, true, elem.child: _*)

      val orderElem = Elem(value.prefix, value.label, value.attributes, value.scope, true, value.child: _*)
      orderElem.copy(
        child = orderElem.child.filterNot(_.label == label).+:(updatedElem)
      )
    }
}
```

Too. Much. Pain.

-----

anti-xml, just why?
===================

- The original author is [Daniel Spiewak](https://github.com/djspiewak)
- I forked from [this other fork](https://github.com/arktekk/anti-xml)
- Provide abstractions to declaratively navigate the document: Zippers (cool, but out of topic in this session)
- More type-safety and more friendly operators/methods
- cleaner/simpler ADT:

```scala
    sealed trait Node
    case class ProcInstr(target: String, data: String) extends Node
    case class Elem(prefix: Option[String], name: String, attrs: Attributes, namespaces: NamespaceBinding, children: Group[Node]) extends Node
    case class Text(text: String) extends Node
    case class CDATA(text: String) extends Node
    case class EntityRef(entity: String) extends Node
```

Nice, but we were talking about manipulations..

------

Monocle
=======

A set of typeclasses that let us get/set/update immutable data structures.

![](https://raw.github.com/julien-truffaut/Monocle/master/image/class-diagram.png)

[Spoiler](http://julien-truffaut.github.io/Monocle/optics.html)

------

Lens
====

```scala
object Lens {
  def apply[S, A](get: S => A)(set: A => S => S): Lens[S, A] = ???
}
```

A Lens is an optic used to zoom inside a Product, e.g. case class.

Because `case class` `.copy` method alone doesn't scale well..

------

Let's define some adts

```scala
  case class Address(number: Int, streetName: String)
  case class Person(name: String, age: Int, address: Address)
  case class Employee(person: Person, jobTitle: String)

  val address = Address(10, "High Street")
  val john = Person("John", 20, address)
  val employee = Employee(john, "Senior vegetarian griller")
```

---------

Why should I even care about `Lens`?

```scala
  val updatedEmployee = employee.copy(person =
      employee.person.copy(
        address = john.address.copy(number = 5)
      )
  )
```

Nobody likes boilerplate code.

```scala
scala> val address2streetNumber = Lens[Address, Int](_.number)(n => a => a.copy(number = n))
address2streetNumber: monocle.Lens[Address,Int] = monocle.PLens$$anon$7@52a51de1

scala> val address2streetNumber2 = GenLens[Address](_.number)
address2streetNumber2: monocle.Lens[Address,Int] = $anon$1@7685acc1

scala> address2streetNumber.get(address)
res1: Int = 10

scala> address2streetNumber.set(5)(address)
res2: Address = Address(5,High Street)

scala> address2streetNumber.modify(_ + 1)(address)
res3: Address = Address(11,High Street)
```

------

Lens composition
================

And we can go further, because composition and typesafety just works.

```scala
scala> val person2address = GenLens[Person](_.address)
person2address: monocle.Lens[Person,Address] = $anon$1@695abc3b

scala> val person2StreetNumber = person2address composeLens address2streetNumber
person2StreetNumber: monocle.PLens[Person,Person,Int,Int] = monocle.PLens$$anon$1@6d487ff0

scala> person2StreetNumber.get(john)
res4: Int = 10

scala> person2StreetNumber.set(2)(john)
res5: Person = Person(John,20,Address(2,High Street))
```

------

Optional
========

Similar to `Lens`, but the element that the `Optional` focuses on may not exist.

```scala
object Optional {
   def apply[S, A](_getOption: S => Option[A])(_set: A => S => S): Optional[S, A] = ???
}
```

Prism
=====

A `Prism` is an optic used to select part of a Sum type (also known as Coproduct), e.g. sealed trait.

```scala
object Prism {
  def apply[S, A](_getOption: S => Option[A])(_reverseGet: A => S): Prism[S, A] = ???
}
```

-----

Let's define a simple hierarchy

```scala
sealed trait Json
case object JNull extends Json
case class JStr(v: String) extends Json
case class JNum(v: Double) extends Json
case class JObj(v: Map[String, Json]) extends Json
```

And have some fun with `Prism`

```scala
scala> val jStr = Prism[Json, String]{
     |   case JStr(v) => Some(v)
     |   case _       => None
     | }(JStr)
jStr: monocle.Prism[Json,String] = monocle.Prism$$anon$7@19f59d6d

scala> jStr("hello")
res6: Json = JStr(hello)

scala> jStr.getOption(JStr("Hello"))
res7: Option[String] = Some(Hello)

scala> jStr.getOption(JNum(3.2))
res8: Option[String] = None
```

---------

Traversal
=========

A `Traversal` is the generalisation of an Optional to several targets.
In other word, a `Traversal` allows to focus from a type S into 0 to n values of type A.

The most common example of a `Traversal` would be to focus into all elements inside of a container (List, Option, ...).

```scala
scala> import scalaz.std.list._   // to get the Traverse instance for List
import scalaz.std.list._

scala> val xs = List(1,2,3,4,5)
xs: List[Int] = List(1, 2, 3, 4, 5)

scala> val eachNumber = Traversal.fromTraverse[List, Int]
eachNumber: monocle.Traversal[List[Int],Int] = monocle.PTraversal$$anon$5@5e9ba509

scala> eachNumber.set(0)(xs)
res9: List[Int] = List(0, 0, 0, 0, 0)

scala> eachNumber.modify(_ + 1)(xs)
res10: List[Int] = List(2, 3, 4, 5, 6)
```

---------

Putting things together: XMLPath
=======

- A simple-but-powerful DSL to manipulate an XML
- Supporting only `Elem` manipulation (no `ProcInstr`, `Text`, `CDATA`, `EntityRef`)
- Typesafe
- Inspired by [Circe/JsonPath](https://julien-truffaut.github.io/jsonpath.pres/#1) by Julien Truffaut
- Let's you access/manipulate a Json using a simple dsl

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

Illumination
============

Why don't I just "port JsonPath to XML"?
- Not possible. XML is far less structured than json and complex.

So, let's focus only on the `Elem` part.
And, **we can view an `Elem` as a container which contains a list of other `Elem`s (children)**.

Remember `Traversal`?

```scala
final case class XMLTraversalPath(e: Traversal[Elem, Elem])
```

Just add some `Dynamic`, and ...
You're welcome.

----

Samples
=======

```scala
import com.codecommit.antixml.XMLPath._
import com.codecommit.antixml._
```

Get all children

```scala
val input1 =
  <A Attr="01234">
    <B>
      <C Attr="C"></C>
      <C Attr="C"></C>
    </B>
    <B>
      <C Attr="C1"></C>
    </B>
  </A>.convert
```

```scala
scala> root.B.C.getAll(input1)
res11: List[com.codecommit.antixml.Elem] = List(<C Attr="C"/>, <C Attr="C"/>, <C Attr="C1"/>)
```

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

Return nothing if the selected nested child is missing

```scala
scala> root.B.Missing.getAll(input1)
res12: List[com.codecommit.antixml.Elem] = List()
```

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

Set a node multiple times

```scala
val input2 =
  <A Attr="01234">
    <B>B</B>
    <B>B</B>
  </A>.convert
```

```scala
scala> root.B.set(<Other/>.convert)(input2)
res13: com.codecommit.antixml.Elem =
<A Attr="01234">
    <Other/>
    <Other/>
  </A>
```

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

Modify a node in a nested child

```scala
val input3 =
  <A Attr="01234">
    <B>
      <C Attr="Yep"/>
      <C Attr="Nope"/>
    </B>
  </A>.convert
```

```scala
scala> val res = root.B.C.modify(_.addAttributes(Seq(("OtherAttr", "bar"))))(input3)
res: com.codecommit.antixml.Elem =
<A Attr="01234">
    <B>
      <C Attr="Yep" OtherAttr="bar"/>
      <C Attr="Nope" OtherAttr="bar"/>
    </B>
  </A>
```

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

Modify a missing node

```scala
val input5 =
  <A Attr="01234">
    <C></C>
  </A>.convert
```

```scala
scala> root.Missing.modify(_.addAttributes(Seq(("OrderLinesAttr", "hello"))))(input5)
res14: com.codecommit.antixml.Elem =
<A Attr="01234">
    <C/>
  </A>
```

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

Modify a nested node with index

```scala
val input6 =
  <A Attr="01234">
    <B>
      <C/>
      <C>
        <D>
          <E Attr="E0"/>
          <E Attr="E1"/>
        </D>
        <D>
        </D>
        <D>
          <E Attr="E0"/>
        </D>
      </C>
    </B>
  </A>.convert
```

------

```scala
scala> root.B(0).C(1).D(2).E.modify(_.addAttributes(Seq(("OtherAttr", "bar"))))(input6)
res15: com.codecommit.antixml.Elem =
<A Attr="01234">
    <B>
      <C/>
      <C>
        <D>
          <E Attr="E0"/>
          <E Attr="E1"/>
        </D>
        <D>
        </D>
        <D>
          <E Attr="E0" OtherAttr="bar"/>
        </D>
      </C>
    </B>
  </A>
```

References
==========

- On maven central -> `"com.al333z" %% "anti-xml" % "0.7.5"`
- [anti-xml fork](https://github.com/AL333Z/anti-xml)
- [Monocle](https://github.com/julien-truffaut/Monocle)
- [Circe/JsonPath](https://github.com/circe/circe)

gha_language: Scala

gha_license_id: NOASSERTION


text:
# Embed

```jsx
import { Embed } from './embed'
<Embed
  title="Embed generated by boilerplate"
  code="console.log(props)"
  type="Code type"
/>
```

# Code types

Embed entries contain code. Different code types each have a different purpose.

## html

For media use. The entire code is inserted into the dom.

### Example

```html
<iframe
  id="player"
  type="text/html"
  width="640"
  height="390"
  src="http://www.youtube.com/embed/M7lc1UVf-VE?enablejsapi=1&origin=http://example.com"
  frameborder="0"
></iframe>
```

## js-action

Called on every action a visitor clicks.

### Example

```js
console.log('js-action event', eventId, props)
ReactGA.event({
  category: 'Navigation',
  action: eventId,
})
```

### Available variables

- eventId, the eventId specified with the action in the CMS
- props, all props that are passed to `src/page-template.tsx`.

## js-app

Called once at the start of the first page render. Not called on consequent page
renders.

### Example

```js
console.log('js-app event', props)
ReactGA.initialize('UA-000000-01')
```

### Available variables

- props, all props that are passed to `src/page-template.tsx`.

## js-page-section

Called when a page section scrolls into view.

### Example

```js
console.log('js-page-section event', eventId, props)
ReactGA.event({
  category: 'Navigation',
  action: eventId,
  nonInteraction: true,
})
```

### Available variables

- props, all props that are passed to the page section.
- eventId, the eventId specified with the page section in the CMS. The eventId
  is postfixed with `-in-viewport` or `-out-viewport`.

## js-page

This runs at the start of every page render.

### Example

```js
console.log('js-page event for path', props.path)
ReactGA.pageview(props.path)
```

### Available variables

- props, all props that are passed to `src/page-template.tsx`.

## youtube

This embeds a pre configured youtube player that uses the code field to play that video.

repository: jaccomeijer/wheelroom

repo_name: jaccomeijer/wheelroom


text:
# detect-porn
Draft project for nudity detection with simple convolutional neural network in Keras

## Getting Started

1. Clone repo.
2. Choose class mode in congif.yaml and set path to model.
3. Run model on any image:
```
python predict.py --img_path image.jpg
```
4. You can evaluate model on dataset:
```
python eval.py
```
5. You can train model on dataset:
```
python train.py
```

## Dataset

If you need the dataset please send to me message on buliginleo @ yandex.ru

### Results:

| Class_mode  | Accuracy |
| ------------- | ------------- |
| 2 classes (erotic_and_porn, legal)  | 0.8946  |
| 3 classes (erotic, porn, legal) | 0.7300 |

### Classes:

* Legal - images without naked people
* Erotic - images with half-naked people (for example, in swimsuits)
* Porn - images with completely naked people or sex scenes

repository: Hadryan/detect-porn

repo_name: Hadryan/detect-porn


text:
# statfs

## Intro
statfs - copies information relating to mounted filesystems

## Description
The `statfs` system call obtains details of the mounted file system specified
by the path. The information is stored in the struct `statfs`, which is
returned to the user at `buf`. The `statfs` system call is commonly used for
finding out the total size of the file system, the number of available
blocks or the number of free blocks.

## Arguments
* `path`:`const char*`[U] - path of the mounted file system
* `buf`:`struct statfs*`[U] - pointer to a buffer where the statfs data will be stored

### Available Tags
* K - Originated from kernel-space.
* U - Originated from user space (for example, pointer to user space memory used to get it)
* TOCTOU - Vulnerable to TOCTOU (time of check, time of use)
* OPT - Optional argument - might not always be available (passed with null value)

## Hooks
### sys_statfs
#### Type
Kprobe
#### Purpose
To keep track of when and how often the `statfs` system call is used.

## Example Use Case
The `statfs` system call could be used to gather file system statistics, such as the size and number of free blocks, for monitoring the health of the system.

## Issues
None.

## Related Events
* mount (from which relevant statfs information can be obtained)

> This document was automatically generated by OpenAI and needs review. It might
> not be accurate and might contain errors. The authors of Tracee recommend that
> the user reads the "events.go" source file to understand the events and their
> arguments better.

repository: aquasecurity/tracee

gha_language: Go

repo_name: aquasecurity/tracee


text:
# flx
Fast, character-based search library in Rust

[Documentation](https://docs.rs/flx)

Inspired by [flx for emacs](https://github.com/lewang/flx), uses the same basic algorithm.

This is basically the search function in BIS in a separate library. It works somewhat decently for bash history.

To use:
```toml
flx = "0.1"
```

repository: jrasky/flx

repo_name: jrasky/flx


text:
### [CVE-2020-8271](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-8271)
![](https://img.shields.io/static/v1?label=Product&message=Citrix%20SD-WAN%20Center&color=blue)
![](https://img.shields.io/static/v1?label=Version&message=n%2Fa&color=blue)
![](https://img.shields.io/static/v1?label=Vulnerability&message=Relative%20Path%20Traversal%20(CWE-23)&color=brighgreen)

### Description

Unauthenticated remote code execution with root privileges in Citrix SD-WAN Center versions before 11.2.2, 11.1.2b and 10.2.8

### POC

#### Reference
No PoCs from references.

#### Github
- https://github.com/ARPSyndicate/cvemon
- https://github.com/stratosphereips/nist-cve-search-tool

repository: trickest/cve

gha_language: HTML

repo_name: trickest/cve


text:
---
layout: "post.11ty.js"
title: "Post Summer Break / Vue.js with Salesforce.com Survey"
date: "2017-08-29"
tags:
  - "Blog"
  - "Salesforce"
  - "SalesforceDeveloper"
  - "VueJS"
slug: "post-summer-break-vue-js-with-salesforce-com-survey"
---

Hello There!

Some of you may have been wondering where I was last week.  Well it was family vacation time so there wasn't much development getting done.

I'm back and ready to get back to the Salesforce Mobile SDK with Ionic Framework stuff but before I do...

## Vue.js with Salesforce.com

I'm working on something for learning to use Vue.js with Salesforce.com and would greatly appreciate you help.  If you could help me by filling out the following survey it would make it easier to address the needs that I may miss without your input.

> Of course if iframes aren't your thing I understand completely so here is a link to the same survey [Vue.js with Salesforce.com Survey](https://goo.gl/forms/bdFWggC1jHRnCLfJ3)

<iframe src="https://docs.google.com/forms/d/e/1FAIpQLSe-PuRuZ4Ilc9xIOZp1Xe2xHU63J8NOPVpGAT_sIa9GJGRRog/viewform?embedded=true" width="760" height="750" frameborder="0" marginwidth="0" marginheight="0">Loading...</iframe>

## Conclusion

Thanks for your time!

Now we can get back to that Mobile SDK stuff.

Oh yeah don’t forget to sign up for [**The Weekly Stand-Up!**](https://wipdeveloper.wpcomstaging.com/newsletter/) to receive free the [WIP Developer.com](https://wipdeveloper.wpcomstaging.com/) weekly newsletter every Sunday!

repository: BrettMN/wipdeveloper-wordpress-archive

repo_name: BrettMN/wipdeveloper-wordpress-archive


text:
# Changelog

## 1.2.0

- Update `babel` monorepo to `v7.0.0`
- Update dependency `style-loader` to `^0.23.0`

## 1.1.0

- Installed `webpack-bundle-analyzer`
- Changed `@babel/preset-env` preset configuration to import polyfills based on usage. Babel will add a specific import for each polyfill into each file if the file uses an API that requires a polyfill in the supported environments.
- Update dependency `webpack-serve` to `v2` (note: the `dev` option in webpack-serve has been renamed to `devMiddleware`)
- Updated `babel` monorepo to `v7.0.0-rc.1`

## 1.0.1

- Added `cssnano` plugin to `postcss-loader` to optimise CSS
- Update dependency `style-loader` to `^0.22.0`
- Update dependency `webpack-cli` to `v3`
- Update dependency `postcss-loader` to `v3`
- Update dependency `css-loader` to `v1`

## 1.0.0

- Upgraded API to expose `createConfig` function (see breaking changes below)
- Updated loaders for CSS delivery (`mini-css-extract-plugin-loader` vs `style-loader`) (see breaking changes below)
- Added loaders for CSS files (previously only SCSS files were supported)
- Improved unit tests for `build`
- Added functional tests for `watch`
- Updated dependency `vue-loader` to `v15`
- Update babel monorepo dependencies to `v7.0.0-beta.55`
- Update dependency `autoprefixer` to `v9`

### Breaking Changes

**1.**

Previously we exported a single config object. Now we export `{ baseConfig, createConfig, mergeConfig }`.

**Previously, the base config was extended like this:**

```js
const config = require('@deloitte-digital-au/webpack-config');

config.entry = {
    main: [
        './src/index.js',
    ],
};

module.exports = config;
```

**Now, the base config is extended like this:**

```js
const { createConfig } = require('@deloitte-digital-au/webpack-config');

module.exports = createConfig({
    entry: {
        main: [
            './src/index.js',
        ],
    },
});
```

**2.**

The module rule matching files with an extension of `.js.scss` has been removed. If you would like your CSS to be embedded into a JavaScript file and served with `style-loader`, simply `import` it into a JavaScript file. If you would like your CSS to be extracted to a CSS file, add it to an entry point or `@import` it into another CSS / SCSS file.

## 0.0.8

- Update babel monorepo dependencies to v7.0.0-beta.55
- Update dependency autoprefixer to v9

## 0.0.7

- Fixed missing `'@babel/runtime/regenerator'` issue

## 0.0.6

- Upgraded to Babel 7
- Added scoped babel preset packages
- Class properties is now supported out of the box
- Webpack dynamic imports is now supported out of the box [#23](https://github.com/DeloitteDigitalAPAC/webpack-config/issues/23)
- Destructuring is now supported out of the box
- Generators is now supported out of the box
- Babel env is now supported out of the box

### Breaking Changes

**1.**

You will need to make changes to your `.babelrc` or `babel` property in the package.json file.

If not using React, Change:

`presets: ["env"]`

for `presets: ["@deloitte-digital-au/babel-preset-app"]`

Or if using React, change:

`presets: ["env", "react"]`

for `presets: ["@deloitte-digital-au/babel-preset-app-react"]`

**2.**

Install babel 7 cli.

`npm install @babel/cli --save-dev`

**3.**

Upgrade to the babel 7 polyfill if you are using a polyfill

`npm uninstall babel-polyfill --save-dev`

`npm install @babel/polyfill --save-dev`

## 0.0.5

- Added support for environment to be defined in NODE_ENV environment variable or Webpack CLI's `--mode` flag.
- Bug fix: CSS Loader should not try to resolve url(), because this Webpack config does not process images.

## 0.0.4

- Changed `eslint-config-deloitte` to `@deloitte-digital-au/eslint-config`.
- Changed `stylelint-config-deloitte` to `@deloitte-digital-au/stylelint-config`.

## 0.0.3

- Update dependency webpack-serve to v1
- Added lots of code comments
- Added '~/' src alias for imports
- Now affixes 'bundle' to bundle file names
- Now includes hash in chunk file names
- Fix now resolves .scss and .css modules
- Turned on 'strictExportPresence'
- Disable 'require.ensure' as it's not a standard language feature.
- NODE_ENV now equals 'development' in dev mode
- Changed default dev tool to 'cheap-module-source-map' in favour for source files in browser dev tools
- Added NamedModulesPlugin in dev mode for performance testing

repository: popecode/webpack-config

repo_name: popecode/webpack-config


text:
# gulp-boilerplate

A gulp ITCSS Sass based boilerplate for individuals and teams.

Lints and concatenates JS files.
Compiles Sass files and automatically adds vendor prefixes.
Exports both minified JS and CSS files with header info.
Generates SVG sprites.

[Download Gulp Boilerplate](https://github.com/neutraltone/gulp-boilerplate/archive/master.zip)

## Contents

* [Getting Started](#getting-started)
* [File Structure](#file-structure)
* [Working with the Source Files](#working-with-the-source-files)
* [Options & Settings](#options--settings)
* [License](#license)

## Getting Started

### Dependencies

Make sure these are installed first.

* [Node.js](http://nodejs.org)
* [Gulp](http://gulpjs.com) `sudo npm install -g gulp`

### Quick Start

1. In bash/terminal/command line, `cd` into your project directory.
2. Run `npm install` to install required files.
3. When it's done installing, run one of the task runners to get going:
  * `npm start` automatically watch for changes and compile files, lints JavaScript and server and synchronise changes to the browser via [Browsersync](https://www.browsersync.io/) accordingly;
  * `npm run lint:sass` lints your sass using [stylelint](https://github.com/stylelint/stylelint). Rules can be found in the [`.stylelint`](https://github.com/neutraltone/gulp-boilerplate/blob/master/.stylelintrc) config file.
  * `npm run lint:js` lints your JavaScript using [eslint](https://github.com/eslint/eslint). Rules can be found in the [`.eslintrc`](https://github.com/neutraltone/gulp-boilerplate/blob/master/.eslintrc) config file.
  * `npm run build` manually compile files and lint JavaScript without serving the files to the browser.
  * `npm run build:sass` manually compiles just your sass.
  * `npm run build:js` manually compiles just your JavaScript.
  * `npm run build:images` manually optimizes just your images.
  * `npm run build:svg-sprite` manually compiles all your SVG's in a SVG sprite.

## File Structure

Add your files to the appropriate `src` subdirectories. Gulp will process and and compile them into `dist`.

* Content in subdirectories under the `js` directory will be concatenated;
* Image files (including svg files) placed in the `img` directory will be optimised and copied into the `dist/assets/img` directory;
* SVG files placed in the `src/sprite` directory will be optimized and compiled into the `dist/assets/img` directory as a `sprite.svg` file.

```
gulp-boilerplate/
├── dist/
│   ├── assets/
│   │   ├── css/
│   │   │   ├── critical.min.css
│   │   │   └── main.min.css
│   │   ├── fonts/
│   │   │   └── # font files
│   │   ├── img/
│   │   │   └── # image files
│   │   └── js/
│   │       └── scripts.min.js
│   ├── .htaccess
│   ├── favicon.icon
│   ├── humans.txt
│   ├── index.html
│   ├── manifest.json
│   ├── robots.txt
│   ├── service-worker.js
│   ├── # static assets
├── src/
│   ├── img/
│   │   ├── # image files
│   │   ├── touch/
│   │   │   ├── apple-touch-icon.png
│   │   │   ├── chrome-touch-icon-192x192.png
│   │   │   ├── icon.png
│   │   │   └── ms-touch-icon-144x144-precomposed.png
│   ├── js/
│   │   └── # script files
│   ├── scss/
│   └── sprite/
├── .babelrc
├── .editorconfig
├── .eslintrc
├── .gitignore
├── .stylelintrc
├── gulp-options.json
├── gulpfile.babel.js
├── LICENSE
├── package.json
└── readme.md
```

## Working with the Source Files

### Sass

This project uses the ITCSS structure and makes use of imports to allow for a critical stylesheet to be generated alongside you main stylesheet.

Sass files are located in `src` > `sass`. Gulp generates minified and unminified CSS files. It also includes [autoprefixer](https://github.com/postcss/autoprefixer), which adds vendor prefixes for you if required by the last two versions of a browser.

### JavaScript

JavaScript files are located in the `src/js` directory.

All script files placed in this directory will be concatinated and minified into a single `scripts.min.js` file compiled directly into the `dist/assets/js` directory.

### Images

Image files placed in the `src/img` directory will be optimised and copied into the `dist/assets/img` directory. The `src/touch` directory contains some placeholder images various touch devices. These are compiled into the subdirectory `dist/assets/img/touch` and referenced, if required, in the head of `dist/index.html`.

*Note:* Although the `images` task has image optimisation enable through the [imagemin](https://www.npmjs.com/package/gulp-imagemin) plugin images can sometimes be further optimise with [ImageOptim](https://imageoptim.com/) and [b64.io](http://b64.io/).

### SVG sprite

SVG files placed in the `src/svg` directory will be compiled into a single SVG sprite named `sprite.svg` and compiled to the `dist/assets/img` directory. This can then be loaded into the page with ajax via a snippet which resides in the `<head>` of `dist/index.html`.

## Options and Settings

### Updating Project Details

Open up `package.json` to change the name, version, URL and other data about the project. The following values are used in the banner which is inserted in the top of the compiled files.

* Name;
* Title;
* URL;
* Author;
* Version;
* License.

### Changing the Directory Structure

Inside `gulp-options.json` you'll find a json object of directory paths. Adjust the paths to suit your workflow.

```
{
  "src": {
    "src": "src",
    "scss": "src/scss/**/*.scss",
    "img": "src/img/{,*/}*.{jpg,jpeg,png,gif,svg}",
    "sprite": "src/sprite/{,*/}*.svg",
    "js": "src/js/**/*.js",
    "vendor": "src/js/vendor/**/*.js"
  },
  "dest" : {
    "dist": "dist",
    "css": "dist/assets/css",
    "img": "dist/assets/img",
    "js": "dist/assets/js"
  }
}
```

## Thanks

* [gpmd](https://github.com/gpmd/itcss-boilerplate) - For their ITCSS boilerplate.
* [Chris Ferdinandi](https://github.com/cferdinandi) - For his Gulp Boilerplate which parts of this were inspired by.

## License

The code is available under the [MIT License](https://github.com/neutraltone/gulp-boilerplate/blob/master/LICENSE.md).


text:
---
layout: article
title: Rich and structured variational posteriors
comments: true
categories: data_science
image:
  teaser: jupyter-main-logo.svg
---

In mean-field variational family, the latent variables are mutually independent and each latent variable $$z_j$$ is governed by its own variational factor, the density $$q_j(z_j)$$ in the total variational density $$q(z) = \prod_j q_j(z_j)$$. One way to expand the family is to add dependencies between the variables. this is called structured variational inference. Another way to expand the family is to consider mixtures of variational densities, i.e., additional latent variables within the variational family.

## more expressive distributions
- Dustin Tran and Rajesh Ranganath have put out an awesome series of papers that allow for more expressive distributions, based on marginalizing out a latent variable, to be used as variational approximations
    + [Hierarchical Variational Models](https://arxiv.org/abs/1511.02386): HVMs augment a variational approximation with a prior on its parameters, which allows it to capture complex structure for both discrete and continuous latent variables.
    + [Variational Gaussian Process](https://arxiv.org/abs/1511.06499):  a Bayesian nonparametric variational family, which adapts its shape to match complex posterior distributions.

## deterministic transformations of the posterior
- Danilo Rezende and Shakir Mohamed introduced the normalizing flows framework [3], which constructs an expressive approximate distribution by composing invertible maps. [blog](https://tonghehehe.com/blog/2017/1/1/vae)

    + [Variational Inference with Normalizing Flows](http://proceedings.mlr.press/v37/rezende15.pdf)
        *  blog post [casmls](https://casmls.github.io/general/2016/09/25/normalizing-flows.html)
        * A normalizing flow describes the transformation of a probability density through a sequence of invertible mappings. By repeatedly applying the rule for change of variables, the initial density ‘flows’ through the sequence of deterministic invertible mappings. At the end of this sequence we obtain a valid probability distribution and hence this type of flow is referred to as a normalizing flow.
        * We can understand the effect of invertible flows as a sequence of expansions or contractions on the initial density.
        * With an appropriate choice of transformations fK, we can initially use simple factorized distributions such as an independent Gaussian, and apply normalizing flows of different lengths to obtain increasingly complex and multi-modal distributions.
        * if we start from an initial density q0(z) and evolve its samples z0 through the infinite transformations i.e. (a Langevin stochastic differential equation), the resulting points will be distributed according to Boltzmann distribution, i.e. the true posterior.
        * Hamiltonian Monte Carlo can also be described in terms of a normalizing flow on an augmented space with dynamics resulting from the Hamiltonian.
        * To allow for scalable inference using finite normalizing flows, we must specify a class of invertible transformations that can be used as an efficient mechanism for computing the determinant of the Jacobian.
        * Three class of normalizing flows are used. 1) Flows with linear-time computation of the Jacobian. 2) Volume-preserving flows with Jacobian-determinant equal to one while still allowing for rich posteriors (e.g. Non-linear Independent Components Estimation (NICE)). 3) infinitesimal flows i.e. stochastic differential equations (e.g. Hamiltonian variational approximation or [train a dynamical system to invert a random walk](http://www.inference.vc/icml-paper-unsupervised-learning-by-inverting-diffusion-processes/))
        * deterministic layers are used to map the data to the **parameters** of the flow (u,w,b). Each transformation $$uh(W^T z_{t-1}+b)$$ can be interpreted as an MLP with a bottleneck hidden layer with a single unit (w and u are vector weights and h is nonlinearity). Since information goes through the single bottleneck, a long chain of transformations is required to capture high-dimensional dependencies.

    + [Improved Variational Inference with Inverse Autoregressive Flow](https://arxiv.org/pdf/1606.04934.pdf)
        1. Start with fully-factorized Gaussian approximate posterior and use the VAE reparameterization trick to get y = mu + epsilon*sigma. Mu and sigma are inferred through the encoder network.
        2. Let the encoder approximate L(x) and use that to update y.
        3. "One step of linear IAF then turns the fully-factorized distribution of y into an arbitrary multivariate Gaussian distribution: z = L(x)·y". apply a step of IAF, and you can turn your fully-factored Gaussian into a conditional multivariate Gaussian which you then fit by optimizing the variational lower bound.

        you're not really changing the KL term on the latents from the VAE (so you're still optimizing mu and sigma to make y look like a standard normal), but by throwing the "lower triangular inverse Cholesky matrix" into the mix, we add an additional set of parameters L(x) that allow us to transform the (posterior?) distribution over the latents into a multivariate Gaussian without actually having to directly optimize or specify the multivariate Gaussian.
    + [Density estimation using Real NVP](https://arxiv.org/pdf/1605.08803v1.pdf)

    + [Made: masked autoencoder for distribution estimation]()
        * Autoregressive autoencoder

## Adding additional latent variables.

expand the family is to consider mixtures of variational densities, i.e., additional latent variables within the variational family.
    + [Auxiliary Deep Generative Models](https://arxiv.org/abs/1602.05473)

    + [DEEP UNSUPERVISED CLUSTERING WITH GAUSSIAN MIXTURE VARIATIONAL AUTOENCODERS](https://arxiv.org/pdf/1611.02648.pdf)
        - blog post:  http://ruishu.io/2016/12/25/gmvae/

## Gradually improve variational approximation

In our approach, we first specify a simple class of approximations — e.g. Gaussians with diagonal covariance — and then optimize the corresponding variational objective, resulting in the best reachable approximation (in the KL-sense) that a diagonal Gaussian can do. We then expand the variational family in one of two ways: add structure to the covariance, add a component and form a mixture.
    + [IMPROVING VARIATIONAL APPROXIMATIONS](http://andymiller.github.io/2016/11/23/vb.html)

## Implicit posteriors (GAN)

Implicit distributions (transformation models) like GANs can help solve the restricted mean field assumption. [IWAE-AAE](https://casmls.github.io/general/2017/04/24/iwae-aae.html)
    + [ALI - BiGAN](https://arxiv.org/abs/1606.00704, https://arxiv.org/abs/1701.04722)

    + [Deep and Hierarchical Implicit Models](https://arxiv.org/abs/1702.08896)
        blog post: [](http://dustintran.com/blog/deep-and-hierarchical-implicit-models)

        As a practical example, we show how you can take any standard neural network and turn it into a deep implicit model: simply inject noise into the hidden layers. The hidden units in these layers are now interpreted as latent variables. Further, the induced latent variables are astonishingly flexible, going beyond Gaussians (or exponential families (Ranganath, Tang, Charlin, & Blei, 2015)) to arbitrary probability distributions. Deep generative modeling could not be any simpler!

## Structured state space models
    + [Black box variational inference for state space models](https://arxiv.org/abs/1511.07367)

## Other

Other methods for dealing with restricted mean field posterior.
    + [Integrated non-factorized variational inference](https://papers.nips.cc/paper/5068-integrated-non-factorized-variational-inference.pdf)
        - MCMC can provide samples from exact posterior but is time-consuming and convergence assessment is difficult. Deterministic alternatives include the Laplace approximation, variational methods, and expectation propagation (EP).

        - Inspired by INLA, we propose a hybrid continuous-discrete variational approximation, which enables us to preserve full posterior dependencies and is therefore more accurate than the mean-field variational Bayes (VB) method.

        - To make the variational problem tractable, the variational distribution q(x, θ|y) is commonly required to take a restricted form. For example, mean-field variational Bayes (VB) method assumes the distribution factorizes into a product of marginals, q(x, θ|y) = q(x)q(θ), which ignores the posterior dependencies among different latent variables (including hyperparameters) and therefore impairs the accuracy of the approximate posterior distribution.

        - We propose a hybrid continuous-discrete variational distribution $$q(x|y, θ)q_d(θ|y)$$, where $$q_d(θ|y)$$ is a finite mixture of Dirac-delta distributions. Clearly, $$q_d(θ|y)$$ is an approximation of $$q(θ|y)$$ by discretizing the continuous (typically) low-dimensional parameter space of θ using a grid G with finite grid points.  The use of $$q_d(θ)$$ is equivalent to numerical integration, here used to overcome factorized posteriors in variational inference.

    + [Copula variational inference](https://arxiv.org/pdf/1506.03159.pdf)

        - copula vi is a new variational inference algorithm that augments the mean-field variational distribution with a copula; it captures posterior dependencies among the latent variables. We derived a scalable and generic algorithm for performing inference with this expressive variational distribution.


text:
# Microservices Logs Pre-processing Pipelines
----

This pack contains a set of **pre-processing** pipelines for sources dedicated to microservices logs. This includes popular engines including Docker, Kubernetes, and Pivotal Cloud Foundry (PCF). Furthermore, there are pipelines for both JSON format and CRIO/Containerd formatted logs. Lastly, there are also pipelines for multi-line logs.

## List of pipelines and what they do
- **JSON_single_line_events** Use as preferred pipeline for single line JSON events. This uses a parser function and minimal regex for optimized performance
- **JSON_Multiline_via_Regex-Extract** Use when you know there are multi-line events in your logs. Ideally, you have a dedicated HTTP token or source for this dataset to miminize regular expressions and maximize throughput. Multiline logs might look like this:
```
{"log": "2021-02-09 11:19:04.816 ERROR [nio-8080-exec-4] x.x.x.exceptions.RestExceptionHandler: 422 Status Code - EntityNotFoundException - XXXXXXXXXXXXXXXXXXXXXXXXX", "stream": "stderr", "time": "2020-10-05T00:00:30.082640485Z"}
{"log": "xxxx.xxx.microservices.exceptions.EntityNotFoundException: XXXXXXXXXXXXXXXXXXXXXXXXX", "stream": "stderr", "time": "2020-10-05T00:00:30.082640485Z"}
{"log": "   at xxx.xxx.microservices.service.XXXXXXX.lambda$getXXXData$3(XYXYXYXYX.java:139) ~[classes!/:na]", "stream": "stderr", "time": "2020-10-05T00:00:30.082640485Z"}
{"log": "   at java.base/java.util.Optional.orElseThrow(Optional.java:408) ~[na:na]", "stream": "stderr", "time": "2020-10-05T00:00:30.082640485Z"}
```
- **JSON_Universal** Alternative pipeline to the single-line and multi-line policies. This is heavy with regular expression, so use cautiously
- **PCF_Universal** Universal pipeline for all single-line PCF events
- **CRI_Universal** Universal pipeline for single-line or multi-line logs with CRIO format similar to this:
```
2021-02-09T11:19:04.815514933+00:00 stdout F 2021-02-09 11:19:04.814 DEBUG 1 --- [nio-8080-exec-8] x.x.x.service.DocumentService            : retrieved: []
2021-02-09T11:19:04.817387066+00:00 stdout P 2021-02-09 11:19:04.816 ERROR 1 --- [nio-8080-exec-4] x.x.x.exceptions.RestExceptionHandler    : 422 Status Code - EntityNotFoundException - XXXXXXXXXXXXXXXXXXXXXXXXX
2021-02-09T11:19:04.817387066+00:00 stdout P xxx.xxx.microservices.exceptions.EntityNotFoundException: XXXXXXXXXXXXXXXXXXXXXXXXX
2021-02-09T11:19:04.817387066+00:00 stdout F    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) ~[spring-web-5.2.7.RELEASE.jar!/:5.2.7.RELEASE]
```

## Requirements

Please be sure to perform the following:

* Assign this pack as the pre-processing pipeline for any LogStream sources that process microservices logs. This can include Splunk HEC, Elastic, HTTP, TCP JSON.
* As a best practice, create different tokens for different known datasets
  - (e.g. different token for containerized application generating web access logs, different token for applications using log4j, etc.)
  - This will help with simpler downstream filtering to apply the correct pipelines without repeated regular expressions.
* At the source level, also create the following metadata fields to simplify downstream processing. Fields:
 1.  **containerization_engine**. Assign it values such as **'kubernetes'**, **'k8s_crio'**, or **'docker_json'**
 2.  **multiline**. Assign this to the value: **_raw.regmatch('\n.*\n') ? true : false**
 3.  Load event breaker rules for multi-line logs and to ensure the correct timestamp is processed. See next section.

## Loading Event Breaker rules
Add the below event breaker rules:
- Go to **Knowledge | Event Breaker Rules | Add New | Advanced Mode**
- Copy the below JSON and paste into the newly created rule.
- Apply one of these rules when capturing incoming data at the source to have it correctly parsed
- Modify the event breaker rule to suit your timestamp format or deviations in your log format

**Ruleset to import**
```
{
  "id": "Multiline-TimestampAtBeginning",
  "lib": "custom",
  "rules": [
    {
      "condition": "_raw.match(`\"(log|message|msg|line)\":`)",
      "type": "regex",
      "timestampAnchorRegex": "/(log|message|msg|line)/",
      "timestamp": {
        "type": "auto",
        "length": 150
      },
      "timestampTimezone": "local",
      "timestampEarliest": "-420weeks",
      "timestampLatest": "+1week",
      "maxEventBytes": 51200,
      "disabled": false,
      "eventBreakerRegex": "/(?=\"(?:log|message|msg|line)\":\\s*\"\\s*\\d{4}-\\d{2}-\\d{2})/m",
      "name": "JSONFileFormat",
      "fields": [
        {
          "name": "multiline",
          "value": "/\\n.*\\n/.test(_raw) ? true : false"
        }
      ]
    },
    {
      "condition": "_raw.match(`[\\d\\-T:.+]+\\s+\\w+\\s+[FP]+`)",
      "type": "regex",
      "timestampAnchorRegex": "/^[\\d\\-T:.+]+\\s+\\w+\\s+[FP]\\s+/",
      "timestamp": {
        "type": "auto",
        "length": 150
      },
      "timestampTimezone": "local",
      "timestampEarliest": "-420weeks",
      "timestampLatest": "+1week",
      "maxEventBytes": 51200,
      "disabled": false,
      "eventBreakerRegex": "/^(?=[\\d\\-T:.+]+\\s+\\w+\\s+[FP]+\\s+\\d{4}-\\d{2}-\\d{2})/m",
      "fields": [
        {
          "value": "/\\n.*\\n/.test(_raw) ? true : false",
          "name": "multiline"
        }
      ],
      "name": "RFC3339Nano "
    },
    {
      "condition": "/^\\d{2}\\s+\\w{3}\\s+\\d{4}\\s+\\d{2}:\\d{2}:\\d{2}\\s+\\w+\\s+\\[[^\\]]+\\]/.test(_raw) || sourcetype=='java' || sourcetype=='tomcat' || sourcetype=='catalina.out'",
      "type": "regex",
      "timestampAnchorRegex": "/^/",
      "timestamp": {
        "type": "auto",
        "length": 150,
        "format": "%d\\s%b\\s%Y %H:%M:%S"
      },
      "timestampTimezone": "local",
      "timestampEarliest": "-1420weeks",
      "timestampLatest": "+1week",
      "maxEventBytes": 51200,
      "disabled": false,
      "eventBreakerRegex": "/(?=^\\d{2}\\s+\\w{3}\\s+\\d{4}\\s+\\d{2}:\\d{2}:\\d{2})/gm",
      "name": "Multline_Timestamp_atbeginning",
      "fields": [
        {
          "name": "multiline",
          "value": "/\\n.*\\n/.test(_raw) ? true : false"
        }
      ]
    }
  ],
  "description": "Multiline log formats"
}
```
**End of ruleset to import**
__Note: subsequent releases of this Pack will include the event breaker rules when it's supported in the framework__

## Release Notes

### Version 0.5 - 2021-06-28
First release.
Pipelines for JSON & CRIO formats from docker, kubernetes, containerd, and crio. Includes pipelines for multi-line events
Pipelines for Pivotal Cloud Foundry

## Contributing to the Pack
---
Discuss this pack on our Community Slack channel [#packs](https://cribl-community.slack.com/archives/C021UP7ETM3).

## Contact
---
The author of this pack is Ahmed Kira and can be contacted at<EMAIL_ADDRESS>
## License
---
This Pack uses the following license: [`Apache 2.0`](https://github.com/criblio/appscope/blob/master/LICENSE).


text:
# Orthogons

This project aims to come up with some useful grids for design that
are not boring (like the kinds you get out of the box with a Bootstrap
or a Foundation).

It is motivated by Jen Simmons’ excellent [Layout Land
video series][layout-land]. In a [particularly amazing
episode][fr-units-video], she points to the *[content-out
layout][content-out-layout]* philosophy (articulated Mark Boulton and
Nathon Ford, drawing from Linda van Deursen).

My simple summary of the idea is this:

- Don’t start with a uniform grid just because; that’s context-free to
  the point of being generic.
- Take a good look at the content you have, and define relationships
  and structure based on this.
- Use this structure to build out suitable grids, and further, use
  [special ratios of widths and heights][orthogons] when doing so to
  make your design feel really organic!

In this repository, you’re going to find some experiments with these
ideas as I attempt to arrive at a more human layout for [my personal
website][my-site].

## Experiments with non-uniform grids

### 1. A look at the 12 orthogons of Wersin

This is a really basic first step, where I simply visualise all these
[special ratios][orthogons] on a 4 column grid. The first column
starts one unit wide, and the rest subsequently grow in multiples of
the ratio.

![12 orthogons of Wersin][exp-1-screenshot]

[The code][exp-1-code] in the repository has generators (in Python) that can be
tweaked for more columns (and ratios).

### 2. A simple article template

TODO: With outsets, asides, different width images, etc.

## Discussions and contributing

If you’d like to talk about this stuff or contribute to it, I’d love
to hear from you:

- You can talk to me like a human [on twitter][my-twitter]
- You can introduce your idea or suggestion as a [GitHub
  issue][gh-issue]
- You can introduce your idea or suggestion with code as a [GitHub
  pull request][gh-pull-request]

Do not be intimidated if you are new or inexperienced at this
stuff. All ideas are welcome and this is a safe place to share them.

## Copyright and license

Copyright (c) 2018 [Harish Narayanan][my-site].

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.

[orthogons]: https://en.wikipedia.org/wiki/Dynamic_rectangle
[layout-land]: https://www.youtube.com/channel/UC7TizprGknbDalbHplROtag
[fr-units-video]: https://www.youtube.com/watch?v=ZPtpzuRajzM
[content-out-layout]: https://alistapart.com/article/content-out-layout
[my-site]: https://harishnarayanan.org/
[my-twitter]: https://twitter.com/copingbear
[gh-issue]: https://github.com/hnarayanan/orthogons/issues
[gh-pull-request]: https://github.com/hnarayanan/orthogons/pulls
[exp-1-code]: https://github.com/hnarayanan/orthogons/tree/master/experiment-1
[exp-1-screenshot]: https://github.com/hnarayanan/orthogons/raw/master/experiment-1/screenshot.png

repository: hnarayanan/orthogons

repo_name: hnarayanan/orthogons


text:
# polybar-vpn-controller

Manage your VPN via this polybar module. The module reports the VPN's status in one of three states: `[<ip_address> | connecting... | No VPN ]`, where the IP address is your public IP given after connecting to Mullvad. With optional dependencies, `<ip_address>` will be replaced with `<city> <country>`.
- left-click to connect and disconnect
- right-click to access an optional rofi menu and select between your favorite locations as well as 35 countries
- middle-click to copy your public IP address to the clipboard

![](vpn-module-demo.gif)

###### (The polybar theme seen in the gif was modified from polybar-5 provided by [Aditya Shakya](https://github.com/adi1090x/polybar-themes) and originally designed by [Benedikt Vollmerhaus](https://gitlab.com/BVollmerhaus))

### vpn support
**The stock settings are intended for use with [Mullvad VPN](https://mullvad.net).**

The module is scripted to facilitate other VPN's, but compatibility will depend on your VPN's API. See the `vpn_module.sh` script user settings to judge whether this code can easily be adapted for your choice of VPN.

It'd be great to make this module more robust for other VPN's, so please contribute other setups. Thanks!

## dependencies (assuming Mullvad VPN):
- `mullvad-vpn` (or `mullvad-vpn-cli`)

Mullvad is available in the [AUR](https://aur.archlinux.org/packages/mullvad-vpn/). Use your own VPN otherwise and see configuration for setup details.

### optional dependencies:
- `rofi` 				  - allowser menu-based control of the VPN
- `geoip` and `geoip-database` - together provide country info instead of public address
- `geoip-database-extra`  - also provides city info
- `xclip`                 - allows copying ip address to clipboard

The optional dependencies can be found in the [Arch Package Repository](https://www.archlinux.org/packages/).

## configuration

### polybar module

This setup assumes that your `polybar` configuration is at `~/.config/polybar`.

```
[module/vpn]
type = custom/script
exec = $HOME/.config/polybar/scripts/vpn_module.sh
click-left = $HOME/.config/polybar/scripts/vpn_module.sh --toggle-connection &
click-right = $HOME/.config/polybar/scripts/vpn_module.sh --location-menu &
click-middle = $HOME/.config/polybar/scripts/vpn_module.sh --ip_address &
interval = 5
format =  <label>
format-background = ${color.mb}
```

### install

To setup a VPN other than Mullvad, read the configuration tips in `vpn_module.sh`. Modify as necessary.

```
git clone https://github.com/shervinsahba/polybar-vpn-controller.git
cd polybar-vpn-controller
cp fonts/* $HOME/.local/share/fonts/
cp vpn_module.sh $HOME/.config/polybar/scripts/
cat vpn_user_module >> $HOME/.config/polybar/user_modules.ini
```
After installation add `vpn` to your `config.ini` modules.

repository: properlypurple/waybar-vpn-controller

repo_name: properlypurple/waybar-vpn-controller


text:
# MarsRoverPhotos
NASA Mars Rover Photo API to download photos from a given day

This app uses NASA's Mars Rover Photo API to download photos from a given day. It accepts a GET request with a single parameter "earth_date" with a value in the form YYYY-MM-DD. It uses NASA’s API to look for photos on that date. If that date contains any images, the app will download all of them and save them to a directory named as the date that they came from. The JSON response to the GET request return whether the api call to NASA was successful and how many images were downloaded and saved.

### Setup
Follow these steps to configure the properties locally.
- Edit the properties.properties file in the app root for your specific setup
*properties.properties*
```
SERVER_PORT=9080
NASA_PHOTO_API=https://api.nasa.gov/mars-photos/api/v1/rovers/curiosity/photos
NASA_API_KEY=DEMO_KEY
IMAGES_FOLDER=c:\Projects\MarsRoverPhotos\images\
```
- The IMAGES_FOLDER is where the app will place the photos that are downloaded.  There will be a subfolder created for each earth date for which images are requested.  The "images" folder must exist prior to starting the server.
- The NASA_API_KEY of "DEMO_KEY" will work for a limited time.  To request your own API key, go to this web site: https://api.nasa.gov/index.html
- Execute 'npm install' from the app root to load dependencies
- Execute 'npm start' from the app root to start the server
- The following are some example URL's given port 9080 above:
  - http://localhost:9080/api/photos?earth_date=2015-10-04
  - http://localhost:9080/api/photos?earth_date=2015-10-05
  - http://localhost:9080/api/photos?earth_date=2015-10-06
- Documentation for the NASA Mars Rover Photo API can be found here: https://api.nasa.gov/index.html

repository: cstolcpart/MarsRoverPhotos

repo_name: cstolcpart/MarsRoverPhotos


text:
---
layout: page1
title: Personal Elevation
tags: [about, Jekyll, theme, moon]
date: 2016-03-21
comments: false
---

![image-title-here](iofc.jpg){:class="img-responsive width=176 height=71"}

 Initiatives of Change
Initiatives of Change (IofC) is an organization that inspires, equips and connects change makers to address world needs, starting with themselves.

![image-title-here](lmad.jpg){:class="img-responsive width=176 height=71"}

 Let's Make a Difference - National Youth Conference

“Let’s Make A Difference” is a national youth conference held every year at Asia Plateau, Panchgani, India  which aims at strengthening moral and ethical values. I am a part of the LMAD family since 2011 and have actively participated in 6 national conferences.

Coordinator at National Youth Conference, Asia Plateau, Panchgani, India, 2015

Coordinator at Regional Youth Conference, Baramati, India, 2013

Having interacted with people around the world through this cause and understanding the problems they face has seamlessly increased my interpersonal intelligence and made me more self-aware than ever.

Testimonial

Scene Recognition using Transfer Learning

October - December 2017

Description

The project includes scene recognition including different scene categories such as: Kitchen, Bedroom, and Corridor. Furthermore, implementing different classification techniques and comparing them is also part of our study. The project attempts to solve this problem using Convolutional Neural Networks. This project also utilizes and compares various approaches such as Transfer Learning and the bag-of-words model for the purpose of indoor scene recognition.

Methodology

- Implemented Transfer Learning using a pre-trained Convolutional Neural Network.

                            - Additionally, designed a Convolutional Neural Network model from scratch in MATLAB

                            - Compared the above mentioned approaches, earlier implemented Nearest Neighbour and SVM classifier approaches.

Results

 The results of the study are listed in the table below.

I. Confusion Matrix (Bag of Features with Nearest Neighbor Classifier). The figure below shows confusion matrix for scene classification using Bag of Features with Nearest Neighbor Classifier:

II. Confusion Matrix (Bag of Features with SVM Classifier). The figure below shows confusion matrix for scene classification using Bag of Features with SVM Classifier:

III. Confusion Matrix (CNN built from scratch). The figure below shows confusion matrix for scene classification using CNN designed from scratch :

IV. Confusion Matrix (Transfer Learning with a Pre-Trained CNN). The figure below shows confusion matrix for scene classification using Transfer Learning with a pre-trained network.:

Conclusion

Through this project, we learned all about the intricacies of convolutional neural networks and their use in image recognition tasks. Based on the comparative results, we concluded that Neural Networks perform better than other classification methods used in this project for the purpose of indoor scene recognition. We also saw that the bag-of-words model was more confident in classifying images from the kitchen, whereas the CNNs were most confident about classifying corridors. Another important observation was that to improve the accuracy of CNNs, a huge dataset of objects or scenes is required.

                                        Code Repository Link

                                        Project-Report


text:
## Sponsored Markdown Time Ladies

Master Build Status: [![Build Status](https://travis-ci.org/BenThomasSutton/sem.svg?branch=master)](https://travis-ci.org/BenThomasSutton/sem)

Develop Build Status: [![Build Status](https://travis-ci.org/BenThomasSutton/sem.svg?branch=develop)](https://travis-ci.org/BenThomasSutton/sem)

License: [![LICENSE](https://img.shields.io/github/license/benthomassutton/sem.svg?style=flat-square)](https://github.com/benthomassutton/sem/blob/master/LICENSE)

Releases: [![Releases](https://img.shields.io/github/release/benthomassutton/sem/all.svg?style=flat-square)](https://github.com/benthomassutton/sem/releases)

Trying to remember how this _magic_ works

> "How do you wanna do this?"
>
>"I would like to rage"

Reasons why its gid:
* Great DM
  * Mathew Mercer is a hero
* Great Cast
* Amazing Music
* Custom Battle Maps

Buy some [Critical Role][CritRoleShop] stuff.

![oh look its them][CritRoleLogo]

[CritRoleShop]: http://critroleshop.co.uk

[CritRoleLogo]: https://444vno15v5re20btub322y5h-wpengine.netdna-ssl.com/wp-content/uploads/2018/02/CriticalRole_Logo_Black.jpg

repository: BenThomasSutton/sem

repo_name: BenThomasSutton/sem


text:
# Changelog

## Unreleased

- Bumped `@actions/core` from 1.2.2 to 1.2.6

## Version 1.2.0

- Pulling owner name from problem matcher file when removing it

## Version 1.1.0

- Updated problem matcher regex to handle rules without line numbers such as [`unicode-bom`](https://stylelint.io/user-guide/rules/unicode-bom) ([#2](https://github.com/xt0rted/stylelint-problem-matcher/pull/2))

## Version 1.0.0

- Initial release

repository: HazuInc/stylelint-problem-matcher

repo_name: HazuInc/stylelint-problem-matcher


text:
TimeAnnounceOjisan
==================

A *ShellScript* for *Mac*-like Time Announcement

# Quickstart

1. Satisfy the requirements. ( See *Requirements* )
2. Just download the script and put it anywhere you want.
3. Edit variables. ( See *Variables* )
4. Schedule a `cron` job for the script.
5. Now, forget about it and have a cup of coffee! Time will tell.

# Requirements

## Notification OSD

- Gnome 3, dbus
 - On the other environments, modify `pid` variable
- libnotify

## Announcement

- [Festival][festival], a speech synthesis system
 - If you use *Google Translate TTS API*, this is **not required**.
- wget
- mpg123
 - these two are required, if you use Google Translate TTS API.

## Optional Requirement for Scheduled Jobs
- cron

[festival]: https://wiki.archlinux.org/index.php/Festival "Festival - ArchWiki"

# Variables

There are a few variables you *need* to edit.

- `uname`
 - your username: ( e.g., `Taro` )
- `notify`
 - `yes` / `no`
 - whether you want the notification OSD or not
- `engine`
 - `festival` / `google`
 - which speech engine you use
 - Google's one is unofficial. Use it at *your own risk*.

Open the script, and edit these values. You will find them at the top.

# Detailed Installation

First, place the script into any folder you want to. In this instruction, it is `/home/Taro/`.

Then, open it and edit like this:

```sh
uname=Taro      # your username
notify=yes      # do you want a notification OSD? ( yes / no )
engine=festival # which speech engine you use     ( festival / google )
```

Finally, set up a scheduled job using `crontab`. If you want announcement once every hour, it would be:

```
0 * * * * /home/Taro/announce.sh
```

Done! Enjoy!

license: Unlicense

repository: kadopoly/TimeAnnounceOjisan

repo_name: kadopoly/TimeAnnounceOjisan


text:
This is the source code for mac_environment.

It is a install- and maintenance-tool for the full parentNode web stack development environment for Mac OS / OS X.
See https://parentnode.dk/blog/installing-the-parentnode-web-stack-on-mac-os for further instructions.

#About parentNode.dk
parentnode.dk is a Copenhagen based open source project and part of think.dk, a think tank & center for acceleration of  change.

Visit https://think.dk or https://parentnode.dk for more information.

# Licenses:
mac_environment is licensed as follows:

##Source code:
https://github.com/parentnode/mac_environment/blob/master/MIT-LICENSE.md

# Contributing to parentNode

Any help is welcome.

Please contact us at [contribute@parentnode.dk](mailto:contribute@parentnode.dk)


text:
# SPOJ-history-Django-App

It basically crawls through a user's page and generate a list of questions correctly answered, sorted in ascending order(according to time of submission).

Uses concept of MultiProcessing to speed up Crawling.

Just enter your spoj handle.

Example : my spoj handle is chunky_2808, so i have to just enter chunky_2808.

Hosted On : https://spojcrawl.herokuapp.com/

You can also sort TAG questions according to no of users:

Suppose you want to solve problems of Dynamic Programming(http://www.spoj.com/problems/tag/dynamic-programming), then simply add dynamic-programming in the box and you will get the questions sorted according to no of users.

Deployed on :https://spojcrawl.herokuapp.com/tags/

NOTE : The Project is created solely for purpose of learning.

gha_language: Python


text:
# lacat

This is a simple utility that exports CEF records from a Logger archive file.
It prints them to stdout by design, allowing the user to redirect them to a
file or pipe them into something else (grep, awk, whatever) for further
manipulation.

It is written in python (targetting 2.7 and 3.5) using only the standard
python library.  If you want to use the kafka integration, you will need to
install the optional `kafka-python` dependency.

## License

See accompanying LICENSE file.

tl;dr - MIT

## Usage

```
$ ./lacat -h
Usage: lacat [options] path_to_dat path_to_meta
Extracts cef events from Logger Archive files to stdout

Why is it called lacat?
    Because "Logger_Archive_cat" was too long to type.

Options:
  -h, --help            show this help message and exit
  -j, --json            export as json instead of raw cef
  -f FILTER, --filter=FILTER
                        specify a key=val to filter records by. multiple -s
                        k=v allowed
  -d DIRECTORY, --directory=DIRECTORY
                        specify a directory full of dat and csv files
  -k KAFKA_TOPIC, --kafka-topic=KAFKA_TOPIC
                        send events to kafka topic
  --kafka-servers=KAFKA_SERVERS
                        connect to kafka server name (can be comma-separated
                        list)
```

The usage is hopefully quite straightforward and the implementation is quite
fast.  I'm still optimizing it a bit to squeeze a bit more performance so check
back here for revisions.

## Installation

Place the file `lacat` in your path and make the file executable:
`chmod +x lacat.`

If you want to use the kafka integration install the kafka library:

```
pip install kafka-python
```

## Examples

Export raw CEF and capture in the file outfile.cef

```
./lacat ArcSight_Data_1_0504403158265495556.dat ArcSight_Metadata_1_504403158265495556.csv  > outfile.cef
```

Export raw CEF and send to a Kafka cluster

```
./lacat ArcSight_Data_1_0504403158265495556.dat ArcSight_Metadata_1_504403158265495556.csv -k lacat-events --kafka-servers=kafka1:9092,kafka2:9092,kafka3:9092
```

Export all CEF records, one per line in JSON format, and capture in outfile.json

```
./lacat -j ArcSight_Data_1_0504403158265495556.dat ArcSight_Metadata_1_504403158265495556.csv  > outfile.json
```

Filter results by limiting output to destination IP <IP_ADDRESS>

```
./lacat -f dst=<IP_ADDRESS>  ArcSight_Data_1_0504403158265495556.dat ArcSight_Metadata_1_504403158265495556.csv
```

Filter results by limiting output to destination IP <IP_ADDRESS> and UDP events
only.

```
./lacat -f dst=<IP_ADDRESS> -s proto=UDP  ArcSight_Data_1_0504403158265495556.dat ArcSight_Metadata_1_504403158265495556.csv
```

Multiple -s options can be specified to create an AND condition.  You can
always specify -j to get each record output in JSON.

repository: hpsec/lacat

repo_name: hpsec/lacat


text:
> <i>They say that Data Science is the sexiest job of the 21st Century and rightly so. Data, be it structured or unstructured has power. The goal is to turn data into information, and information into insight that could change the life of a patient, or change the world. </i>

#### The goal of this interactive application is to allow the user to play with data and intelligently recommend the user to make data science decisions using meta learning. This is an attempt to use machine learning to improve machine learning.

#### Steps:

**Data**

Load a CSV file (later on load data from DB). Identify ID and targets. Checkout the metadata. Look at histograms of rows, columns and features. Identify outliers in histograms and clean them out interactively! Clean out near zero variance columns.

**Discovery**

Look at univariate, bivariate and multivariate relationships between the features and the target. Get rid of collinear and multi-collinear features using simple plots.

**Feature engineering**

Add new features!

**Transformations**

Perform numerical and categorical transformations.

**Impute missing values**

Impute missing values by mean / median.

**Slicing and ranking**

Select subset of data and important (ranked) features.

**Learning & Predictions**

Machine Learning


text:
# Minimal Metadata Serialization

Minimal metadata serialization example for .NET Core

## What's it?

.NET Core natively supports metadata serialization with `System.Reflection.Metadata`. So, you can create a .NET Core assembly on disk and then load it dynamically and consume it.

## Why?

There weren't much examples online before creating this repository. So, this repository is created as an example.

## What about serializing an `Assembly`?

If you want to serialize a dynamically generated `Assembly` at runtime, you can use [ILPacker](https://github.com/Lokad/ILPack).

## Contributing

Please create an issue in [the GitHub repository](https://github.com/osman-turan/Minimal-Metadata-Serialization) for suggestions and questions. Pull-requests are much appreciated. But, please make sure you have created an issue before working on any pull-requests.

## Authors

- [Osman Turan](https://osmanturan.com/)

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.


text:
---

**Please note:** This project is not actively maintained, it may no longer work and may depend on out of date dependencies.

---

## What is this?
Kauri is a cloud based system for monitoring your off-grid energy systems. It consists of several components including the software which interacts with your energy sensors, the server that collects and processes your data, and the frontend which lets you view all your data from any internet connected device.

![The Kauri status page.](docs/resources/summary-page-small.png)

### Features
* Collect data from energy sensors on-site and store them in the cloud. This means you can access your sensor data from anywhere in the world!

* Calculate the state of charge of the battery using the [B42SOC algorithm](resources/about-b42soc.md). This lets you better plan when you need to use a generator. Kauri also provides a full history of the state of your system to track trends over time.
![The state of charge graph](docs/resources/soc-graph-small.png)

* Get information about the energy provided from each of your [energy sources](docs/energy-sources.md). This means you can identify exactly how much energy your solar generation provides in comparison to wind, etc.
![The energy sources graph](docs/resources/daily-energy-sources-graph-small.png)

* Get information about the consumption of the building.

* Predicts the future state of the system using historical data through [several methods of prediction patterns](docs/future-state.md).
![The future states page in Kauri showing the future state of the system.](docs/resources/future-state-small.png)

* View the live status of the energy system, including the current energy flows, state of charge and future state of the system.

* Highly configurable - tweak everything from the low voltage trigger time to the colour of your solar generation in graphs.

* Support for as many buildings as you need on a single Kauri server.

* Support for multiple bridge clients per building.

* Full user management - users can create accounts for others and give others access to their buildings.

### Components of Kauri
![A diagram of the components of Kauri.](docs/resources/system-components.png)

This project contains the frontend and backend components of Kauri.

**[The Kauri Bridge project is also available on GitHub.](https://github.com/jordancrawfordnz/kauri-bridge)**

**[Read more about the development of Kauri in "Monitoring an off-grid system with Kauri"](https://jc.kiwi/kauri-energy-monitor/)**

## [What do I need?](docs/what-do-i-need.md)
There are quite a few moving parts involved in Kauri. Before you get started, be sure to check you have everything you need.

**If you just want to have a play with Kauri for now, there are options to work with example datasets and on your local system, so keep reading!**

## [Setting up](docs/setting-up.md)
See the setting up guide for information on how to get Kauri running in your development or production environment.

## [Getting started](docs/getting-started.md)
See the getting started guide to learn how Kauri works and get Kauri collecting, processing and predicting the future using your data.

## API Documentation
When you have an instance of the API running you can access the StrongLoop API Explorer at `http://localhost:3000/explorer` to experiment with the API.
## Contributing
I am not actively developing this project but if you find a bug or anything that could make the system better, please raise an issue on GitHub.

Even better, if you have a chance, feel free to fork the repository, make your change and open a merge request to have it merged in.

## Licence
[MIT](LICENSE)

repository: jordancrawfordnz/kauri-energy-monitor

repo_name: jordancrawfordnz/kauri-energy-monitor


text:
# Static Code Analysis Tools

### PMD
PMD scans Java source code and looks for potential problems
Problems range from breaking naming conventions and unused code or varibales to performance and complexity of code, not forgetting lots of possible bugs
The PMD project also supports JavaScript, PLSQL, Apache Velocity, XML and XSL. It also ships with a CPD, a tool to detect duplicated code in several languages.

![PMD](/style-guide/assets/images/pmd.png)

PMD integrates with several tools and editors, including Eclipse, NetBeans, IntelliJ IDEA, TextPad, Maven, Ant and Emacs.
You can suppress warnings (in a variety of ways) and you can also write your own rules in either Java or XPath.

https://pmd.sourceforge.io/pmd-5.4.1/pmd-java/rules/index.html

### Checkstyle
As the name implies, Checkstyle checks that your code adheres to a coding standard.
The tool is configurable, which makes it able to support different code style conventions. Two examples are the Sun Code Conventions and Google Java Style (although the one from Sun hasn’t been maintained since 1999).
![Checkstyle](/style-guide/assets/images/checkstyle.png)

You can find a configuration file for Google’s Java Style on the checkstyle repository.
https://github.com/checkstyle/checkstyle/blob/3e4367941c3e9680703e8ea8400abbd5dc78e1d9/src/main/resources/google_checks.xml

### FindBugs

FindBugs looks for bugs in Java Code, and this means over 400 different bugs.
http://findbugs.sourceforge.net/bugDescriptions.html
Patterns are separated into several categories: bad practice, correctness, malicious code vulnerability, multithreaded correctness, performance, security and dodgy code (two additional categories exist, with just a couple of patterns each: experimental and internationalization).

![FindBugs](/style-guide/assets/images/findbugs.png)

### SonarCube

SonarQube® is an automatic code review tool to detect bugs, vulnerabilities and code smells in your code.
 It can integrate with your existing workflow to enable continuous code inspection across your project branches and pull requests.

SonarQube can perform analysis on up to 27 different languages depending on your edition. The outcome of this analysis will be quality measures and issues.

SonarQube collects and analyzes source code, measuring quality and providing reports for your projects.

Note: SonarQube is in no way competing with any of the above static analysis tools, but rather it complements and works very well with these tools.

![Sonarcube](/style-guide/assets/images/sonarcube1.png)
![Sonarcube](/style-guide/assets/images/sonarcube2.png)

repository: nissan-ajith-padmakumar/style-guide

repo_name: nissan-ajith-padmakumar/style-guide