text:
# hello-graphql
An open source repository demonstrating a full stack GraphQL implementation

__________

Thanks to [Surge](https://www.surgeforward.com/) for their generous support of this and many other open source projects benefiting our community!

![SurgeForward Logo](https://media.surgeforward.com/wp-content/uploads/2018/04/14191701/webinar_email_header.png)

repository: vincilbishop/hello-graphql

gha_language: TypeScript

repo_name: vincilbishop/hello-graphql


text:
---
name: "\U0001F4A1Anything else"
about: "For help, support, features & ideas - please use https://discuss.redash.io \U0001F46B "
labels: "Support Question"
---

We use GitHub only for bug reports 🐛

Anything else should be posted to https://discuss.redash.io 👫

🚨For support, help & questions use https://discuss.redash.io/c/support
💡For feature requests & ideas use https://discuss.redash.io/c/feature-requests

Alternatively, check out these resources below. Thanks! 😁.

- [Forum](https://disucss.redash.io)
- [Knowledge Base](https://redash.io/help)

repository: mozilla/redash

branch_name: refs/heads/master

extension: md

gha_language: JavaScript

license_type: permissive

repo_name: mozilla/redash


text:
win-youtube-dl
==============

A very simple GUI wrapper for youtube-dl (http://rg3.github.io/youtube-dl/download.html) Python script.
This application only works on 64-bit Windows (I'm lazy to make it work on 32-bit Windows).
Technically speaking, this application can work on Linux and Mac OSX, but I don't see a point of
having this application run on them since most Linux or Mac OSX users should be familar with
using a command line.

Download
--------
https://github.com/fredyw/win-youtube-dl/releases

How to build
------------
win-youtube-dl uses Gradle build system (http://www.gradle.org/) and launch4j (http://launch4j.sourceforge.net/)
It also requires at least Java 7 (http://java.com/en/download/index.jsp) to build.

    gradle -Plaunch4j=<launch4j_directory>

How to run
--------------
1. Download win-youtube-dl.zip from https://github.com/fredyw/win-youtube-dl/releases
2. Unzip win-youtube-dl.zip
3. Double click on win-youtube-dl.exe
4. Click on Update button to make sure you always get the latest update

Screenshot
----------
![win-youtube-dl screenshot](https://raw.github.com/fredyw/win-youtube-dl/master/win-youtube-dl.png)

license: MIT

repository: tortlepp/win-youtube-dl

repo_name: tortlepp/win-youtube-dl


text:
Architecture
============

- Separate components (for example, soma-workflow, pyanatomist, vip etc.). Those can be achieved by adding interfaces for each component.
- It is better to build the interface according to the requirements of application.
- To help separate components, it is better to image that each component can have different implementations and each external dependencies can be replaced.

General guideline
==================

- Function is better to be shorter (there may be problems since 25 lines)
- Discriminant names are preferable for functions, classes, files or a set of files. Because it is easy to debug and rename.
- Limit your comments. It is better to make functions or code more clearly by using an explicate name rather than adding a comment.
- Some comments are very important, for example opition explanation.
- Use standard comments which are easy to search and which are adequate for : TODO, FIXME, XXX
- Boy scout rule: Leave the campground cleaner than you found it.
- Write your method from top to down. For example: if a method A use a method B, write A and then B.
- Class order: top -> down, code client -> code interne (???), high level code -> low level code.
- Don't leave prints (proper stdout)

Python code format
=====================

- Pep 8
- Recommandly donot go beyond 80 characters per line, strictly donot go beyond 120 characters.
- A module contains 400 lines in maximum
- All the members of an instance should be explictly declared in the function "__init__" or in the methods using the prefixs by "_init_" or called as constructor (don't add it just-in-time)
- No "import *"
- No relative imports
- Declare import standard python modules, and then add one empty line and the other externe imports (for example, aims, soma_workflow) and at the end import internal modules.
- Use a coherent name with the module for "import something as smthg"
- The private classes are renamed using the prefix double underscore (not yet applied). The protected method use the prefix by one underscore. ??? Pour l’accès par réference const (modification de l’objet autorisé mais pas de la référence), utiliser les properties.???
- The methods "friends" are should use the prefix with «_friend» in order to show which are protected but accessible for the architecture requirements of other classes, but not users.
- Data with list type is defined use a name with plural form.
- To distinguish the file name with path or not, relative or absolute, please use the belowing convention:
    * filename : the file name without the path (basename)
    * filepath : the file name with absolute path
    * file_relative_path : the file name with a relative path

Commit Message
==============

Git format
-------------

- a synthetic line should start with the below tags
- a blank (empty) line will be ignored by git
- a comment can be described by serveral lines

Tag list for the first line
---------------------------

- **ENH**: When adding or improving an existing or new class in term of capabilities,
- **COMP**: When fixing a compilation error or warning,
- **DOC**: When starting or improving the class documentation,
- **STYLE**: When enhancing the comments or coding style without any effect on the class behaviour,
- **REFAC**: When refactoring without adding new capabilities,
- **BUG**: When fixing a bug (if the bug is identified in the tracker, please add the reference),
- **INST**: When fixing issues related to installation,
- **PERF**: When improving performance,
- **TEST**: When adding or modifying a test,
- **WRG**: When correcting a warning.

repository: ilgrad/pylearn-epac

repo_name: ilgrad/pylearn-epac


text:
# Mark Sign Gateway PHP Client

## How to start?

- https://mark-sign.github.io/documentation/

Powered by: [Mark Sign](https://marksign.lt/)

repository: Mark-Sign/gateway-sdk-php

gha_language: PHP

gha_license_id: MIT

repo_name: Mark-Sign/gateway-sdk-php


text:
---
layout: post
title: "Tensorflow"
categories: [Study notes]
---

Initialize your variables, create a session and run the operations inside the session
A placeholder is simply a variable that you will assign data to only later, when running the session. We say that you feed data to these placeholders when running the session.

gha_language: CSS

gha_license_id: NOASSERTION


text:
# Language Support

After completing the exercises in the lesson you will be able to:

- Add a new language to an agent

- Understand how you can override the default translation of the added language

## Exercise 1: Adding a Language to an Agent

Open an agent and navigate to the **Agent-> Configuration -> Language**:

![Agent language configuration](contents/language/images/agent-language-configuration.png)

Click on the Add language button in the Language page which then displays a pop-up menu as shown here:

![Agent language configuration](contents/language/images/language-add-spanish.png)

In the search text field type: Spanish. Next select the menu item _Spanish (es-US)_ to select the US dialect
of the Spanish language.

Save the agent. Open the agent chat window and type the following: `#switch_langage es-US`.
You can now interact with the agent in the Spanish language.

Use Google Translate to formulate Spanish questions from English like the following example (Using the My Assistant agent):

_Order pizza_ => _Ordenar pizza_

## Exercise 2: Overriding Default Language Translation

**TBD Add a screen shot that shows the drop down menu for overriding text**

Existing output to the user is automatically translated but can be overridden by different
responses in the added language.

First you need to add the language to the dialog skill. In this example we are using the **Order Pizza** skill.
Adding a language is done similarly to the agent. Open the skill, navigate to **Configuration -> Language**.
Add the language in the same manner as the previous exercise. Save the skill.

Navigate to the Implementation page and click on node 1. A dialog is then displayed.
Click on the drop down menu that is showing English (US) and select the item Spanish (es-US).
Spanish text is translated from English text by default. You can now override the Spanish as needed.

repository: dgwartney/pandoc-book-template

repo_name: dgwartney/pandoc-book-template


text:
# bridge.ixi-js

Requires
https://github.com/iotaledger/bridge.ixi

`git clone https://github.com/Thoralf-M/bridge.ixi-js`

`cd bridge.ixi-js`

`npm i` or `yarn`

`node bridge.ixi-js.js`


text:
# fix-esm

fix ERR_REQUIRE_ESM with realtime `esbuild` transform.

`require('@gongt/fix-esm')` will register legacy commonjs loader. (and no way to unregister)

When ERR_REQUIRE_ESM happen, it will spawn esbuild to compile target file. loaded module will inside require cache. compiled result will save at `filename.jsc` to speed up next run.

Do nothing when `import '@gongt/fix-esm';`, so if you have project compile to esm, it `import 'cjs-module'`, then `cjs-module` do `require('esm-module')`, this package will not handle.

It's best to use this package in a final-end-user project, not in a library, many people have thier own `fix-esm` method, may cause conflict.

repository: GongT/baobao

repo_name: GongT/baobao


text:
# nlp-project-similar-lyrics

**About the project**

The goal of my project is to find similar songs to a song with the NLP
methods. For now I worked with spacy for extracting repeating nouns and adjectives from
lyrics, as well as with textblob for the sentiment analysis of lyrics.
I plan to expand this project with new methods in the future.
For all methods I only consider the lyrics of the songs, and not other information like
the genre of the song.

I am working alone on this project and it is my project work for my university class
"Advanced Natural Language Processing with Python": https://esther.seyffarth.one/classes/2021-advanced-nlp/.

**The data**

For my project I created a corpus of lyrics which I cannot include do to copyright
reasons. However, now follow instructions on how you can create a corpus for
this project yourself.
I created my corpus in XML and used https://genius.com/ as the source for the lyrics.
You can see how my corpus is structured in the corpus_example_structure.xml file.
Because I wanted to work with XML, it was the easiest way for me to just copy and paste
the lyrics and delete "Chorus", "Verse", "Bridge" etc., so that it is just one connected
text. I thought about using a web scrapper but since I wanted the exact structure you
can see in the file, using it would have been more time-consuming.

**How you can try out the code yourself**

You can find all the packages I used for this project in the requirements.txt file which
you can install with the following command: pip install -r requirements.txt.
The linter I used is also included in the file in case you want to change and add to the code but keep the code style. I decided to follow Google's style and therefore used pylint.

I tried out three different methods to find similar songs. You can combine all of them
or only use one or two. First, I will explain how you work with all methods, for the
use of the single methods see below.

**All methods**

If you open the folder code, you will see eight files.
The module song_information.py is needed for all other files, so you might
want to open that first. The modules lyrics_adjectives.py, lyrics_sentiment.py
and lyrics_topics.py contain functions needed for the different approaches.
If you do not want to try out every method seperately but directly see the results
of all methods combined and compared, you should open all files and run the file results_combined.py. For the code it is necessary that you add the path to your corpus
and the path to the directory in which you want to save the results to the files topics_analysis.py, adjectives_analysis.py, sentiment_analysis.py and combined_results. You can easily find where you have to insert your path by searching for "PATH". You still need to comment in those lines.
If you run the file results_combined.py code you will export the data frames
with all results.
If you want to try out each method seperately first (recommended) and also use the query functions
with which you can for example get song recommendations for single songs or find songs
about a certain topic, you can also take a look at the next section where I explain how
to use each method independently.

**Single methods**

Find similar songs based on main topics

This is the first method for finding similar and you need to open the file
topics_analysis.py and the modules song_information.py and lyrics_topics.py for this.
These are all the files you need to
find similiar songs based on the same main topics. Check out the files for further explanations
and example queries. Do not forget to add the path to your corpus
and the path to the directory in which you want to save the results, to the file topics_analysis.
You can easily find where you have to insert your path by searching for "PATH". You still need to comment in those lines.
NLP method: extract main topics from a text with spacy

Find similar songs based on repeating adjectives

This method is based on the first method and has similar but fewer functions.
For this method you only need the modules song_information.py, lyrics_adjectives.py and the file adjectives_analysis.
Check out the files for further explanations and example queries.
Do not forget to add the path to your corpus and the path to the directory in
which you want to save the results, to the file adjectives_analysis.
You can easily find where you have to insert your path by searching for "PATH". You still need to comment in those lines.
NLP method: extract repeating adjectives from a text with spacy

Find similar songs based on the same sentiment

This method differs from the other methods and uses sentiment analysis to find similar songs.
All the files you need for these method are sentiment_analysis.py and the modules
song_information.py and lyrics_sentiment.py.
Check out the files for further explanations and example queries.
Do not forget to add the path to your corpus and the path to the directory in
which you want to save the results, to the file sentiment_analysis.
You can easily find where you have to insert your path by searching for "PATH". You still need to comment in those lines.
NLP method: sentiment analysis with textblob

repository: TaniaBladier/nlp-project-similar-lyrics

branch_name: refs/heads/main

repo_name: TaniaBladier/nlp-project-similar-lyrics


text:
# Introduction

Castor Queue provides abstractions over queue drivers. You can code to these abstractions in your own projects
and then flexibly change the implementations for one that suits your project better.

## Basic Usage

Every `Castor\Queue\Driver` implementation has a corresponding `Castor\Queue\Factory` one.
The factories use a `Castor\Net\Uri` object to create the driver with the proper configuration. URIs are extremely
flexible and can accommodate complex drivers by allowing to pass options in the form of query parameters.

Factories are intended to be registered in your application using a Dependency Injection framework. For instance, you
can bind `Castor\Queue\CompositeFactory` to the `Castor\Queue\Factory` class and register all the sub factories your
application supports. You can easily swap the active implementation by changing the URI provided to the create method.
The composite factory will find te first driver supported by the passed URI scheme.

```php
<?php

use Castor\Net\Uri;
use Castor\Queue;

$uri = Uri::parse('amqp://localhost');
$factory = new Queue\CompositeFactory();
$factory->add(new Queue\InMemoryFactory());
$factory->add(new Queue\AmqpFactory());
$driver = $factory->create($uri); // This will return a AmqpDriver instance.
```

Once you have a basic driver, you can publish or consume messages.

### Publishing Messages

Publishing a message is as simple as passing a queue name and the message in a string form using the `publish` method.

```php
<?php

use Castor\Queue;

/** @var Queue\Driver $driver */
$driver->publish('queue', 'This is a message to be sent in the queue');
```

### Consuming Messages

Messages can be consumed using the `Castor\Queue\Driver::consume` method. This method takes two arguments: a string with
the queue name, and a callable that will process a message. The callable in turn takes the message as the first argument
and another callable for cancelling the consuming process.

```php
<?php

use Castor\Queue;

/** @var Queue\Driver $driver */
$driver->consume('queue', static function (string $message, callable $cancel) {
    echo $message.PHP_EOL; // This will print the message for every message.
});
```

Cancelling a consumer is designed to stop processing messages and return from the `consume` function. You can use the
cancellation callable to stop the consuming process upon some conditions, like memory limits or number of
messages consumed.

```php
<?php

use Castor\Queue;

/** @var Queue\Driver $driver */
$driver->consume('queue', static function (string $message, callable $cancel) {
    if ($message === 'cancel-me') {
        $cancel();
    }
    echo $message.PHP_EOL;
});
```

## Design Principles

The abstractions are intentionally simplified to support the most common and basic operations. For example, the main
interface `Castor\Queue\Driver` defines only two methods: `publish` and `consume`.

If you need capabilities specific to your queue implementation, it is most likely that the implementation provides
those operations in their public api, but you will have to check for that implementation type using the `instanceof`
operator, so you can be sure you are working with that driver. Then, as part of the logic of your application you
could fallback to other kinds of behaviours.

## Available Implementations

This project contains one implementation that stores messages in memory. This implementation is very useful for testing
purposes, but obviously unsuitable for production environments. If you need more reliable implementations, you can
find them in one of the `castor/*-pack` packages. For instance, `castor/aws-pack` contains the SQS driver, among
other services implementing other Castor interfaces. We personally recommend `castor/amqp-pack`.

## Best Practices for Implementors

If you are using this package to create your own queue implementation, we encourage you to follow these practices.

### 1. Keep the implementation of the interface simple

Stick to what the `publish` and `consume` methods promise to do and nothing else. You can create an extended public
api in your implementation so client code might potentially use it.

For instance, the `Castor\Queue\InMemoryDriver` provides methods to clear a particular queue of messages. While this is
a useful operation, it is not the central part of a queue driver, which is to publish and consume messages. It the users
of your implementation wish to clear the queue, they will have to

Following the Interface Segregation principle, other interfaces might be included in the future if the functionality
is sufficiently common.

### 2. Use good OOP to extend functionality

It is not a responsibility of the driver implementation to do anything else than consuming a queue in a blocking way,
because the `consume` method is thought of to be executed in worker contexts. This means that if you want to add
functionality like limit the messages to consume to a certain number and then terminate the process, or terminate the
process when a certain memory limit is reached, you must handle that in client code. Decorators and composition are always
the best answer in these cases. For instance, this naive implementation cuts the queue process when 100 messages have
been consumed:

```php
<?php

use Castor\Queue\Driver;

class ConsumeLimitDriver implements Driver
{
    private Driver $driver;
    private int $limit;

    public function __construct(Driver $driver, int $limit = 100)
    {
        $this->driver = $driver;
        $this->limit = $limit;
    }

    public function publish(string $queue, string $message) : void
    {
        $this->driver->publish($queue, $message);
    }

    public function consume(string $queue, callable $callback) : void
    {
        $count = 0;
        // We wrap the original callback in our own callback
        $limiter = function (string $message, callable $cancel) use ($callback, &$count) {
            $callback($message); // Process the message passing the original callback.
            $count++;
            if ($this->limit <= $count) {
                $cancel();
            }
        };
        // We pass the modified callback to the decorated driver.
        $this->driver->consume($queue, $limiter);
    }
}
```

You can build a similar implementation to cut execution on memory limits.

### 3. Always provide defaults

If your implementation needs a password or a host or a port, always default to dummy values when reading data from the URI.
For example, in the AMQP implementation, the host is always localhost if an empty host is provided. Similarly, the port
is the one traditionally used by RabbitMQ and the username and password is guest. It is up to client code to provide the
correct values.

repository: castor-labs/queue

repo_name: castor-labs/queue


text:
# v1.8.3

Released 2023-04-02

- fix invalid `access_mode` logic (see #287)

# v1.8.2

Released 2023-04-02

- more comprehensive support to manually set `access_modes`
- more intelligent handling of `access_modes` when `access_type=block`
  - https://github.com/ceph/ceph-csi/blob/devel/examples/README.md#how-to-test-rbd-multi_node_multi_writer-block-feature
  - others? allow this by default
- remove older versions of TrueNAS from ci

# v1.8.1

Released 2023-02-25

- minor fixes
- updated `nvmeof` docs

# v1.8.0

Released 2023-02-23

- `nvmeof` support

# v1.7.7

Released 2022-10-17

- support `csi.access_modes` config value in all zfs-based drivers
- bump deps

# v1.7.6

Released 2022-08-06

- support fo `talos.dev` clusters
- dep bumps

# v1.7.5

Released 2022-08-02

- improved ipv6 iscsi support
- allow using `blkid` for filesystem detection on block devices

# v1.7.4

Released 2022-07-29

- improved ipv6 iscsi support

# v1.7.3

Released 2022-07-28

- more stringent block device lookup logic (see #215)
- ipv6 iscsi support
- dependency bumps
- minor fixes throughout

# v1.7.2

Released 2022-06-28

- support for inode stats
- doc updates
- bump deps

# v1.7.1

Released 2022-06-14

- support for the alpha TrueNAS SCALE 22.12
- Fix invalid class reference

# v1.7.0

Released 2022-06-08

The windows release.

- windows smb, iscsi, and local-hostpath support (requires chart `v0.13.0+`)
- ntfs, exfat, vfat fs support
- `zfs-generic-smb` driver
- synology improvements
  - DSM7 support
  - synology enhancements to allow templates to be configured at various
    'levels'
- testing improvements
  - support (for testing) generating volume_id from name
  - test all the smb variants
  - test all nfs/smb client drivers
- misc fixes
  - wait for chown/chmod jobs to complete (freenas)
  - general improvement to smb behavior throughout
  - better logging
  - better sudo logic throughout
  - minor fixes throughout
- more robust logic for connecting to iscsi devices with partition tables
- massive performance improvement for ssh-based drivers (reusing existing
  connection instead of new connection per-command)
- dep bumps
- trimmed container images
- windows container images for 2019 and 2022

# v1.6.3

Released 2022-04-08

- dep bumps
- more secure permissions on the socket file

# v1.6.2

Released 2022-04-06

- dep bumps
- optimize via object instance reuse of various clients etc
- graceful shutdown of the grpc server

# v1.6.1

Released 2022-03-23

- include `rsync` binary in docker image (see #166)
- minor improvements to logging
- bump deps

# v1.6.0

Released 2022-03-16

This is a **massive** release with substantial changes. Ideally this release
should be installed with chart version `>=0.11.0`. Make note that due to the
updated base image from `buster` to `bullseye` that the filesystem tools have
all been updated as well (`mkfs.foo`, `resize2fs`, `fsck.foo`, etc).

To facilitate the removal `grpc-uds` package a new sister project was created:

https://github.com/democratic-csi/csi-grpc-proxy

Not all environments require the usage of the proxy, but it is enabled by
default with `helm` chart versions `>=0.11.0`.

- update `nodejs` version to `v16`
  - remove dependency on `grpc-uds` package (replaced entirely by
    `@grpc/grpc-js`)
  - remove dependency on `request` package (replaced by `axios`)
  - use native `timeout` functionality for `spawn` operations
- update http clients to use `keep-alive` logic
- add a default 30s `timeout` to `iscsiadm` commands
- base docker image on `bullseye`
- support for `btrfs` as a `fs_type`
- support `s390x` and `ppc64le` docker images

# v1.5.4

Released 2022-03-03

- more descriptive error message for breaking changes introduced in `v1.5.3`

# v1.5.3

Released 2022-03-02

- support for running `freenas-iscsi` and `freenas-nfs` `sudo`-less (see #151)
  - BREAKING CHANGE for `freenas-nfs`, if set `datasetPermissionsUser` and
    `datasetPermissionsGroup` must be numeric user/group IDs, alpha values such
    as `root` and `wheel` will no longer work
- more robust `chown` / `chmod` logic for all zfs drivers
- allow for setting extent comment/description in `freenas-iscsi` and
  `freenas-api-iscsi` (see #158)

# v1.5.2

Released 2022-02-24

- proper capacity reporting for `controller-client-common`

# v1.5.1

Released 2022-02-23

- fix ci flakes
- better support running `zfs` commands as non-root with `delegated`
  permissions

# v1.5.0

Released 2022-02-23

- massive ci overhaul
  - add additional drivers
  - add additional TrueNAS server versions
  - only build `node_modules` once by using artifacts
  - support allow/block listing specific tests
  - better logic waiting for driver socket to appear
- introduce `zfs-local-dataset` driver (see #148)
- introduce `zfs-local-zvol` driver (see #148)
- introduce `local-hostpath` driver
- support manually provisioned (`node-manual`) `oneclient` volumes

# v1.4.4

Released 2021-12-11

- better adherence to expected csi behavior when volume request for less than
  minimum volume size is requested (see #137)
- avoid unnecessary data copy for `ListVolumes` operation

# v1.4.3

Released 2021-12-01

- more appropriate handling of `size_bytes` for snapshots
- more robust handling of `NodePublishVolume` to ensure the staging path is
  actually mounted
- allow control of the `mount` / `umount` / `findmnt` command timeout via
  `MOUNT_DEFAULT_TIMEOUT` env var
- minor fix for `zfs-generic-iscsi` with `targetCli` to work-around Ubuntu
  18:04 bug (see #127)

# v1.4.2

Released 2021-09-29

- general improvements to help ci
- cover most drivers with ci

# v1.4.1

Released 2021-09-21

- `k8s-csi-cleaner` script (see #81)
- bump deps

# v1.4.0

Released 2021-09-21

- more advanced logic for iscsi naming limits (allowing > 63 chars in certain
  circumstances, SCALE, linux, FreeBSD 13+)
- various updates to support running the csi-test tool and conform to expected
  responses/behaviors (full conformance for several drivers!)
- default `fs_type` during `NodeStageVolume` when omitted by `CO`
- automatcally add `guest` mount option to `cifs` shares when creds are absent
- fix `ListVolumes` and `ListSnapshot` behavior on various `zfs-generic-*` and
  `freenas-*` drivers

# v1.3.2

Released 2021-09-09

- fix missing `break` in the `node-manual` driver using `smb` / `cifs`

# v1.3.1

Released 2021-09-08

- support using a template for nfs share comment in `freenas-nfs` and
  `freenas-api-nfs` (see #115)

# v1.3.0

Released 2021-09-02

- use `ghcr.io` for images as well as docker hub (#90)
- introduce api-only drivers for freenas (`freenas-api-*`)
- `smb-client` driver which creates folders on an smb share
- `lustre-client` driver which creates folders on a lustre share
  attaching to various volumes which have been pre-provisioned by the operator
- `synology-iscsi` driver
- various documentation improvements
- support for csi versions `1.4.0` and `1.5.0`
- reintroduce advanced options that allow control over `fsck` (#85)
- advanced options for customizing `mkfs` commands
- better handling of stale nfs connections
- do not log potentially sensitive data in mount commands
- timeouts on various commands to improve driver operations under adverse
  conditions
- various fixes and improvements throughout
- dependency bumps

# v1.2.0

Released 2021-05-12

- add `node-manual` driver

# v1.1.3

Released 2021-04-25

- remove `--force` from unmounts
- proper `iqn` logic for rescans

# v1.1.2

Released 2021-04-12

- fix for hostname based portals
- dependency bumps

# v1.1.1

Released 2021-04-12

- rescan iscsi sessions after login during stage call

# v1.1.0

Released 2021-02-21

- support for csi-v1.3.0
- fix a snapshot issue when requested with specific `snapshot_id`

# v1.0.1

Released 2021-01-29

- targetCli fixes when used in conjunction with `nameTemplate` (see #49)
- multi-stage docker builds to shrink image size dramatically
- using pre-compiled grpc binaries to dramatically speed build times
- dep updates
- remove `fsck` during stage operations due to sig-storage recommendations (see #52)

# v1.0.0

Released 2021-01-07

- initial release

repository: democratic-csi/democratic-csi

repo_name: democratic-csi/democratic-csi


text:
---
title: Export - NestedStack
schema: 2.0.0
uid: tf-nested
---
# Working with Nested Stacks

Where nested stacks are involved, [Export-PSCFNTerraform](xref:Export-PSCFNTerraform) has two modes of operation.

1. The default is to import all nested stacks as `aws_cloudformation_stack` resources, thus leaving the nested stacks owned by CloudFormation.
1. Read all nested stacks and export these to HCL as modules. Enable this with the `-ExportNestedStacks` cmdlet parameter.

When exporting nested stacks, each `AWS::CloudFormation::Stack` resource found in the deployed stack is read and exported to a module in the `./modules` directory of the workspace. The modules take the names of the nested stacks, so will be something like `VpcStack-AGGQ9RLPLCGZ`. Each module (including root) that is found to contain nested stacks will gain a file `module_imports.tf` that declares the submodules. All references to and from the submodules will be resolved where possible.

As noted in [caveats](xref:tf-caveats#nested-stack-import), multiple `AWS::CloudFormation::Stack` resources using the same template source will result in multiple modules being exported.

See the [nested stacks example](xref:tf-example-nested).

repository: fireflycons/PSCloudFormation

gha_language: C#

repo_name: fireflycons/PSCloudFormation


text:
# [kunyora.github.io/kunyora](https://kunyora.github.io/kunyora) · [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](CONTRIBUTING.md)

This repo contains the website documentation powering the [Kunyora website](https://kunyora.github.io/kunyora)

## Getting Started

### installation

1.  Clone the `kunyora-website` repo
2.  cd `kunyora-website`
3.  `cd website` to go into the website portion of the project
4.  `yarn install` to install the website's npm dependencies or (`npm install`)

### Running locally

1.  `yarn run start` to run the development server powered by Docusaurus or `npm install` if not using yarn.
2.  `open http://localhost:3000/` to open the site in your favourite browser

### OverView

The site is built with [Docusaurus](https://docusaurus.io) which is a static site builder for blogs and documentation.To edit the internals of the documentation, you need to familiarize yourself with this builder. Visit the Docusaurus site to learn more about the available configuration options.

Please check the docusaurus documentation for an overview of the website structure built with it.

### Contributing

1.  `git checkout master` from any local folder in your `kunyora-website` repository.
2.  `git pull origin master` to ensure that you have the latest code.
3.  `git checkout -b name-of-your-new-branch`
4.  Make your changes and save changes
5.  Check your package.json file to see how to run locally. it would most likely be `yarn run start` or `npm start`
6.  `open http://localhost:3000/kunyora/versions.html` to see other versions
7.  Test your changes with other browsers for compartibility.
8. `yarn run prettier` to format your code.
9.   Go to the `kunyora-website repo`, you should see the recently pushed branch.

## License

React-Kunyora is [MIT licensed](./LICENSE)

Kunyora is [MIT licensed](https://github.com/kunyora/kunyora/blob/master/LICENSE).

Kunyora documentation is [MIT licensed](https://github.com/kunyora/kunyora-website/blob/master/LICENSE)


text:
---
date: 2020-11-23
title: "Open Source Compliance in the Enterprise"
linkTitle: "Open Source Compliance in the Enterprise"
description: "NCSOFT summarized the Open Source Compliance in the Enterprise book and released it on GitHub for anyone to read."
author: Jiho Han ([@PeterHanJiho](https://github.com/PeterHanJiho))
resources:
- src: "**.{png,jpg}"
  title: "Image #:counter"
  params:
    byline: "Photo: Jiho Han  / CC-BY-CA"
---

## Introducing the Open Source Compliance in the Enterprise book

This book was written by [Ibrahim Haddad](https://www.ibrahimatlinux.com/about.html) and [published](https://www.linuxfoundation.org/compliance-and-security/2018/12/open-source-compliance-in-the-enterprise/) by the Linux Foundation.

<img src="featured-book.png" width="300">

It explains in detail what to consider when building an open source compliance program in a business, and anyone can download it from the following link : [Download](https://www.linuxfoundation.org/compliance-and-security/2018/12/open-source-compliance-in-the-enterprise/)

## Korean summary

NCSOFT summarized the main contents of this book in Korean, and after getting permission from the author, Ibrahim, they released it so that open source people of Korean companies can refer to it.

In particular, NCSOFT shared this on GitHub so that anyone can refer to it, improve it, and continue to develop it.

* GitHub : https://github.com/ncsoft/osc-enterprise-ko/
* License : CC BY 4.0
* Slide : [OSC-Enterprise-ko_Openchain_KWG_20200317_FN.pdf](OSC-Enterprise-ko_OpenchainKWG_20200317_FN.pdf)

## Contributors

| Name            | Company           | Email | Role |
|-------------------|-----------------|------|------|
| Dasom Han   | NCSOFT  |<EMAIL_ADDRESS>| Maintainer |
| Peter Jiho Han  | NCSOFT |<EMAIL_ADDRESS>| Contributor |
---------

repository: OpenChain-Project/OpenChain-KWG

repo_name: OpenChain-Project/OpenChain-KWG


text:
patch-installer
===============

`patch-installer` can be used to create standalone patch scripts.

Features
--------

* Requires diff to build patch scripts
* Requires diff or tar+base64 to deploy patch scripts

USAGE
-----

To create a new standalone patch install script:

	./patch-installer.sh --prev=foo-1.0.0 --next=foo-1.0.1 --create=foo-patch-from-1.0.0-to-1.0.1.sh

You can install the patch by running:

	foo-patch-from-1.0.0-to-1.0.1.sh --install=/path/to/foo

..or just verify the compatibility of target files (install does that too!):

	foo-patch-from-1.0.0-to-1.0.1.sh --check=/path/to/foo

..or export the embedded patch file:

	foo-patch-from-1.0.0-to-1.0.1.sh --get-patch > foo-patch-from-1.0.0-to-1.0.1.diff

TODO
----

* Undo patch feature

repository: thejhh/patch-installer

repo_name: thejhh/patch-installer


text:
# Strings

## Single and double quoted strings

* Unlike Ruby (and like Python), there is really [no difference in the end between using single or double quotes](https://staxmanade.com/2018/03/should-i-use-javascript-single-or-double-quotes/), meaning they both represent a string in the end.

* JSON **allows only double quotes.**

```javascript
let str = "Hello world"
let anotherStr = 'foo bar'
```

To have single quotes inside the single quoted string, escape the inner single quotes with **\\**.

## String concatenation

```javascript
let str = "Hello world"
let anotherStr = 'foo bar'

// concat strings using the + operator.
console.log(str + anotherStr)

// numbers are converted to string when using + and the other operand is a string
let addedResult = "50" + 100;
console.log(addedResult);
typeof(addedResult);

// to convert object to string, call its toString ,method
let numberStr = 100.toString();
typeof(numberStr);

// string to number conversion
addedResult = Number("50") + 100;
console.log(addedResult);
typeof(addedResult);
```

---

## References

* [MDN: Strings In Javascript](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps/Strings)


text:
# facebook.login()

> --------------------- ------------------------------------------------------------------------------------------
> __Type__              [Function][api.type.Function]
> __Return value__      [Event][api.type.Event]
> __Revision__          [REVISION_LABEL](REVISION_URL)
> __Keywords__          Facebook, login
> __See also__          [facebook.logout()][plugin.facebook-v4.logout]
>						[facebook.*][plugin.facebook-v4]
>						[fbconnect][plugin.facebook-v4.event.fbconnect]
> --------------------- ------------------------------------------------------------------------------------------

## Overview

Prompts the user to log in to Facebook. This function can be called even if the user is already logged in. If the user is already logged in but new permissions are requested, the user will be prompted to grant the new permissions. The recommended flow is to request no permissions the first time and then ask for additional permissions as they are needed.

The login comes back in the form of a [fbconnect][plugin.facebook-v4.event.fbconnect] event that is sent to the listener specified within [facebook.setFBConnectListener()][plugin.facebook-v4.setFBConnectListener] or this function itself.

## Syntax

	facebook.login( [listener] [, permissions] )

##### listener ~^(optional)^~
_[Listener][api.type.Listener]._ A listener that responds to [fbconnect][plugin.facebook-v4.event.fbconnect] events. If the listener is a table, it should have a property `"fbconnect"` that is a function.

##### permissions ~^(optional)^~
_[Array][api.type.Array]._ An optional array of strings that correspond to Facebook's publishing [permissions](https://developers.facebook.com/docs/facebook-login/permissions/v2.4#reference). This enables your application to ask the user to grant certain extended permissions to your app. If not supplied, no extended permissions are requested. Use `"publish_actions"` to allow posting to the user's wall. For developer convenience, required permissions such as `"public_profile"` ([reference](https://developers.facebook.com/docs/facebook-login/permissions#reference-public_profile)) and `"user_friends"` ([reference](https://developers.facebook.com/docs/facebook-login/permissions#reference-user_friends)) will be automatically requested if needed.

## Gotchas

* Both <nobr>__read-only__</nobr> and __publishable__ permissions can be specified, but requesting both of these permission types in the same `facebook.login()` call is __not__ allowed — if you attempt to do this, only the <nobr>read-only</nobr> permissions will be requested. For example:

``````lua
-- This call will only request "user_events" as it's a read-only permission
facebook.login( { "user_events", "public_actions" } )
``````

* If your app has a state where it may need to request both <nobr>read-only</nobr> and publishable permissions around the same time, you'll need to perform this as two seperate `facebook.login()` calls, for instance:

``````{ brush="lua" gutter="false" first-line="1" highlight="[26,35]" }
local facebook = require( "plugin.facebook.v4" )

-- Check for a value inside the provided table
local function valueInTable( t, valueToFind )
	for k,v in pairs( t ) do
		if v == valueToFind then
			return true
		end
	end
	return false
end

local function genericFacebookListener( event )
	print( event )
end

-- This listener will handle the request of read-only permissions, then request publishable permissions
local function intermediateListener( event )

	if ( "session" == event.type ) then
		if ( "login" == event.phase ) then
			local accessToken = facebook.getCurrentAccessToken()

			-- Continue only if the user granted the read-only permissions
			if ( valueInTable( accessToken.grantedPermissions, "user_events" ) ) then
				facebook.login( genericFacebookListener, { "publish_actions" } )
			else
				print( "The user did not grant the read-only permissions" )
			end
		end
	end
end

-- Request read-only permissions, followed by publishable permissions
facebook.login( intermediateListener, { "user_events" } )
``````

repository: coronalabs/corona-docs

extension: markdown

gha_language: HTML

repo_name: coronalabs/corona-docs


text:
# Triangulating The Location of the Unicorn
In this portion of the assignment, we'll compute the latitude/longitude location of the unicorn.

## Starter Files
**Download the starter code (in a .zip file) [here](https://stanfordpython.com/res/starter-code/triangulate_startercode.zip)**.

1. `triangulate.py` is the main file that you'll be working with. In it, we'll do the math to extrapolate the unicorn's location.
 	- The `main` function is provided for you. It first calls `load_data('unicorndata.pickle')`, and then calls `clean_data(data)` on the return value from `load_data`. Then, it processes that data by calling `process_data` and prints out the return value (the latitude/longitude location of the unicorn).

## Triangulation

You should now have a bunch of noisy data about the unicorn's location in the form of a list of dicts:

```python
[
	{
		"latitude": ...,
		"longitude": ...,
		"distance": ...
	},
	...
]
```

Note by the way, that the *distance* is distance in *latitude/longitude* units. You don't need to know this, but: we're treating latitude and longitude as though they are coordinates for points in 2D space, and then we're computing the distance between two points in the normal way for 2D space. In reality, latitude and longitude describe a *curved space* (the surface of the Earth), so this way of computing distance is not really accurate. It's fine as long as we're on Stanford's campus, which is small compared to the entire globe, and so effectively behaves like 2D space. You can also notice this effect by the fact that, even though the Earth is curved, if you zoom into any point on the Earth's surface, it appears flat.

The list of dicts should be pickled (see the [documentation](https://docs.python.org/3/library/pickle.html)) and stored in a file called `unicorndata.pickle` (this filename will be used in subsequent steps).

### `load_data(filename)`
First, we need to load the data into the current namespace. To do this, we'll write `load_data(filename)`.

Using `pickle`, fill out the `load_data` function so that it opens the file referenced by `filename` and unpickles the data inside the file, and returns the information. If you run `$ python3 triangulate.py`, you should see something like:

```
(cs41-env)$ python3 triangulate.py
Press Enter to load the unicorn data...
Zeroeth data point: {'latitude': 37.421245948717946, 'longitude': -122.15347566666667, 'distance': 0.013740998028983013}

Press Enter to continue and clean the data...
Warning: no data cleaned. Is clean_data implemented?

Press Enter to continue and process the data...
The unicorn is at None, None.
```

### `clean_data(unicorn_data)`
Most of this assignment will be done in `numpy`, so we need to extract the data into a `numpy`-friendly format. *Note:* we've imported `numpy` as `np` in `triangulate.py`.

`clean_data` should reformat the list of dicts into two numpy arrays, `X` and `y`. `X` should be an `633 x 2` size array where each row corresponds to one data point and is of the form `[latitude, longitude]`. `y` should be an array of size `633` that is a list of distances. `X[i]` corresponds to `y[i]` (i.e., `y[i]` is the noisy distance that we observed from the point `X[i]`).

As a sanity check, here should be some (approximate) properties of your resulting arrays:

```python
np.sum(X, axis=0)  # => array([ 23693.1151959 , -77331.96931533])
np.sum(y)            # => 8.131987200337589
```

You can check those by running the file. At this point, your output should look something like:

```
(cs41-env)$ python triangulate.py
Press Enter to load the unicorn data...
Zeroeth data point: {'latitude': 37.421245948717946, 'longitude': -122.15347566666667, 'distance': 0.013740998028983013}

Press Enter to continue and clean the data...
Row 0: [  37.42124595 -122.15347567], with noisy distance: 0.013740998028983013
np.sum(X, axis=0) # => [ 23693.1151959  -77331.96931533]
np.sum(y) # => 8.131987200337589

Press Enter to continue and process the data...
The unicorn is at None, None.
```

### `process_data(X, y)`
There are two different ways we'll explain about how to process `X` and `y` to produce the latitude and longitude values we're looking for. You only need to implement one of these!

1. **The paraboloid method** is a more common approach to these problems in mathematics. The mathematics is a little bit simpler. This is the **default method**.
2. **The probability method** is a more common approach to these problems in computer science, especially in the AI courses. The mathematics is a much more tricky than the other method. This technique involves a knowledge of probability distributions.

If you'd prefer to use the probability method (or your own method), you should change the two line in `main` that reads:

```python
process_data = process_paraboloid_fit # change this to, e.g., process_prob_maximize
```

Once again, you **only need to write one function** to process the data. It can be either of the two methods we'll explain here, or your own. If you write your own, you'll need to attach another file to your submission explaining your algorithm (see the section on Submitting, at the bottom of this file).

#### `process_paraboloid_fit(X, y)`
Let's begin by discussing the mathematics behind this method. You can skip ahead to the "features matrix" section to implement it if you'd like. Imagine the function `f(x,y) = distance between (x,y) and the unicorn's location`. If we were to plot this function in 3D space as `(x, y, f(x,y))`, it would look like this:

The minimum point of the paraboloid would be the point where the unicorn is hidden. Additionally, the contour plot (horizontal slices) of the above plot is a series of concentric *circles*:

Now consider our data, in the form `(lat, lng, noisy_dist)`. If we were to plot that, it should look very much like that paraboloid. It won't *exactly* be a paraboloid, because the distance is noisy, so instead, we'll try to find the paraboloid that best approximates our data. This technique is called *fitting* a paraboloid to our data.

Once we do that, the minimum point of our paraboloid should be the location of our unicorn.

To fit a paraboloid to our data, we need to know the mathematical formula for a paraboloid. In this formula, `x, y, z` are the axis variables (it's a plot in `x-y-z` space) and the other variables are constants. In particular, `x_0, y_0` is the minimum point of the parabola, and `a, b` affect the shape of the parabola.

This is the *general* formula for a paraboloid, but since our paraboloid has circular cross-sections, that means that `a = b`. So, we can rewrite the formula as:

And, if we let `alpha = 1/a^2`, we can just write:

Since `x, y, z` are parameters used for plotting, this paraboloid is determined uniquely by three variables: `alpha, x_0, y_0`. We need to find those variables based on the observed data (`X` and `y`), and then the unicorn will be at `(x_0, y_0)`, which is the minimum point of the paraboloid (if you don't see why, think about it for a minute!).

If we expand the formula for `z`, we get the following:

Here, we've written the equation as a sum, where each term is of the form `(fitting variables) * (plotting parameters)`. For example, in the term `(-2 * alpha * x_0) * x`, the variables `alpha, x_0`, which appear in the left side of the product, are the fitting variables, and `x` is a plotting variable.

Another way to look at that equation, using the machine learning language, is that the terms `x^2 + y^2, x, y, 1` are the *features* and `alpha, -2*alpha*x_0, -2*alpha*y_0, alpha*x_0^2 + alpha*y_0^2` are the *weights*:

We need to find the correct values for the weights so that the resulting function (which can be expressed as the dot product between the features vector and the weights vector) approximates the given data as best as possible. The technique we'll use for this is called [least-squares regression](https://en.wikipedia.org/wiki/Least_squares) (click on the link for extra information, but you don't need any of it).

To implement it, you need to first make a "features" matrix, where you convert `X` into a new matrix that is `633 x 4`, by mapping a row in `X`, which is of the form `[lat, lng]` into a row in the features matrix of the form `[(lat**2 + lng**2), lat, lng, 1]`.

Then, we need to extract the correct weights corresponding to the features. `numpy` has a built in function to do this, which you can read about [here](https://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.lstsq.html). The code to run it is simply:

```python
w_0, w_1, w_2, w_3 = np.linalg.lstsq(features, y, rcond=None)[0]
```

If you formatted the features matrix as above, we'll now have the following relationships between the weights and the earlier variables:

```python
w_0 == alpha
w_1 == -2 * alpha * x_0
w_2 == -2 * alpha * y_0
w_3 == alpha * (x_0 ** 2) + alpha * (y_0 ** 2)
```

Thus, we can algebraically compute the value of `x_0` as:

```python
x_0 = (w_1 / w_0) * (-1/2)
```

Compute `y_0` yourself and return the pair `x_0, y_0`.

#### `process_prob_maximize(X, y)`
Another way to find the location of the unicorn is using the probability maximization technique. To use this technique, we write down a function `g(x, y)` that represents the *probability that the unicorn is at* `(x,y)`. Then, we use standard ML techniques (or in our case, third-party libraries) to find the coordinates `(x_0, y_0)` that maximize that probability.

The fundamental idea behind this function is that, if the unicorn is at `(U_lat, U_lng)`, then:

where:

In English, the probability that `(x, y)` is the location of the unicorn is equal to the product of the probabilities, for each `i`, that the `i`th point and its `noisy_dist` could have been generated if the unicorn was at `(x, y)`.

For example, let's look at a situation where this probability is small. If the *actual* distance between `(x, y)` and `(lat, lng)` is small, but the `noisy_dist` that was in our data set is very large, then we can be fairly confident that `(x, y)` is not the location of the unicorn, because it isn't consistent with our data. We take the product of all such probabilities to account for all points in our data. (*Note*: we take a *product* because the probability events for each of the `P_i` are independent).

Now, our problem reduces to finding an expression for `P_i`. This is where we have to make some assumptions about how the noise was generated. Assume that the noisy distance was generated from a normal distribution, centered at the actual distance, with variance `0.01` (this assumption is reasonable, and data scientists often make very similar assumptions—talk to Parth if you're interested about why!).

Consider two normal distributions, then. The first normal distribution was used to *generate* the noisy data, so it's centered at the actual distance with variance `0.01`, and the second normal distribution has the *same variance*, but it's centered at the *value of the noisy data that was generated*. They might look something like this, with the first in blue and the second, to the left, in orange:

The value of `P_i`, then, is the value of the blue distribution at the max point of the orange distribution. (*Note*: once again, this is concealing some more complicated math. If you're interested, talk to Parth or take CS 109!). Let's draw that value on the graph:

Here's the cool part. That probability is *equal* to the value of the orange distribution at the max point of the *blue* distribution:

This lets us write out, explicitly, the value of `P_i`:

where `phi(x, mu, V)` is the value of the normal distribution centered at `mu`, with variance `V`, sampled at `x`. In Python, we can use the `scipy` library to get the value of the normal distribution:

```python
dist = numpy.linalg.norm(X[i] - pt)
P_i = scipy.stats.norm.pdf(y[i], dist, 0.01)
```

Now, we're mostly done, with one caveat: multiplying all of the `P_i`s together is not going to work because the values will be too small, so they won't be accurate enough on a computer. Instead, we can use the `np.log` function (natural logarithm) to change the calculation into addition. Recall the earlier formula:

If we take the negative natural log of both sides, since the log function is monotone increasing, the problem changes from *maximizing* the above function to *minimizing* the following function:

Note that taking the negative logarithm to simplify computation is a standard technique in optimization theory. In code:

```python
dist = numpy.linalg.norm(X[i] - pt) # pt == np.array([x, y])
P_i = scipy.stats.norm.pdf(y[i], dist, 0.01)
-np.log(P_i) # sum for every i
```

So, altogether, you should write a function `prob(pt)` that takes in a `numpy` array of the form `[x,y]` and computes a sum, for each row in `X`, of each of the values of `-np.log(P_i)`. Define this function *inside of `process_prob_maximize`* so that it also has access to `X` and `y`.

Now, we have to find a point `(x_0, y_0)` that minimizes `prob`. Luckily, there's a `scipy` tool for that. In `process_prob_maximize(X, y)`, after you define `prob`, you can just call

```python
min_pt = scipy.optimize.minimize(prob, x0=(37.430334,-122.169814))
```

The value `x0` is the position to start testing at. I chose a point that's roughly in the center of Stanford, but you're free to choose another one! `scipy.optimize.minimize` returns a large object, but the minimum point it's found is the `x` attribute, i.e., `min_pt.x`. You should inspect the full output—it has information about whether the minimization succeeded; but even if it didn't, you should still return `min_pt.x`. (*Note*: when `scipy` says the minimization did not succeed, it just means that it couldn't find a minimum point within a reasonable amount of time. It's still probably found a point that's pretty close to the location of the unicorn.)

## Submitting
The only file you need to submit is `triangulate.py`. Not all functions need to be filled out: you only need to fill out functions that you used. Feel free to add additional helper functions in this file.

Additionally, if you developed your own technique to find the location of the unicorn, submit a file called `triangulation_desc` which contains a paragraph or two describing your algorithm (you can submit a text file or a word document or a PDF—whichever is easiest for you).

repository: zsoltlongauer/python-assignments

gha_language: Jupyter Notebook

repo_name: zsoltlongauer/python-assignments


text:
---
title: Masternotdiscoveredexception elasticsearch
author: admin
type: post
date: 2014-08-04T07:25:37+00:00
url: /masternotdiscoveredexception-elasticsearch/
categories:
  - Big Data
  - Cloud
  - Elasticsearch
  - IT
  - Logstash
tags:
  - elasticsearch
  - join node
  - master discovery

---
Sometimes, when you want to join a node to  elasticsearch cluster, this problem may occur (the reason may vary, but I think there are some limitations of using multicast here)

**Solution:**
Uncomment those lines in **elasticsearch.yml**

We tell this host (node) to use unicast discovery instead of multicast, and then specify the master host manually for this node.

<img loading="lazy" class="aligncenter size-full wp-image-901" src="http://nguyenvulong.com/wp-content/uploads/2014/08/Screenshot-08042014-042256-PM.png" alt="Screenshot - 08042014 - 04:22:56 PM" width="561" height="238" srcset="https://nguyenvulong.com/wp-content/uploads/2014/08/Screenshot-08042014-042256-PM.png 561w, https://nguyenvulong.com/wp-content/uploads/2014/08/Screenshot-08042014-042256-PM-300x127.png 300w, https://nguyenvulong.com/wp-content/uploads/2014/08/Screenshot-08042014-042256-PM-500x212.png 500w" sizes="(max-width: 561px) 100vw, 561px" />

repository: nguyenvulong/blog

repo_name: nguyenvulong/blog


text:
# Advent of Code

My - mostly partial - attempts at the yearly [Advents of Code](https://adventofcode.com/).

![](https://raw.githubusercontent.com/Gi11i4m/advent-of-code/master/2022/ops/assets/aoc-banner.jpeg)

Each year has a new and hopefully better setup so instructions for running the solutions are in the respective yearly folders.

So far I've been using TypeScript since I love TypeScript and it allows for pretty clean code in these kinds of challenges. Maybe I'll try a different language some year...

license: Unlicense


text:
---
layout: page
title: About
permalink: /about/
---

Hi, I'm a software engineer currently focused on designing and building out a RESTful service architecture for a Chicago-area company.

I have extensive experience with Python, Django and RESTful design. I've open sourced some of my work, which is used widely in the Django ecosystem. My open source work is geared toward making Django a more attractive option for complex enterprise applications. On the front end, I have designed and built a number of large-scale Angular applications.

In addition to my open-source work, I have some availability on a consultancy basis for development and design. If you would like to discuss collaborating, please <a<EMAIL_ADDRESS>in touch. I enjoy building elegant solutions to challenging problems and iterating as new opportunities emerge.


text:
# NuxioPress

> [Nuxt.js](https://nuxtjs.org) + [ExpressJS](http://expressjs.com) + [Axios](https://github.com/axios/axios) + [Vue Router](https://router.vuejs.org/) + [Vuex](https://vuex.vuejs.org/) + [Passport.js](https://passportjs.org) = :fire:

A Nuxt PWA starter template with Encrypted Cookies, Express.js, Axios, Vue Router, Vuex, Passport.js.

**This template is still under development, feedback welcome!**

## Modules Used

- [PWA Module](https://github.com/nuxt-community/pwa-module) - Supercharge Nuxt with a heavily tested, updated and stable PWA solution.
- [Axios Module](https://github.com/nuxt-community/axios-module) - Secure and easy Axios integration with Nuxt.js.
- [Router Module](https://github.com/nuxt-community/router-module) - Nuxt.js module to use router.js instead of `pages/` directory.
- [DotEnv Module](https://github.com/nuxt-community/dotenv-module) - A nuxt.js module that loads your .env file into your context options.

## Installation

This is a project template for [vue-cli](https://github.com/vuejs/vue-cli).
> Make sure to use a version of vue-cli >= 3.2 (`vue -V`).

repository: tashpriya/nuxiopress

repo_name: tashpriya/nuxiopress


text:
---
date: "2021-04-10"
title: "The .NET Stacks #44: 🐦 APIs that are light as a feather"
tags: [dotnet-stacks]
image: /assets/img/stacks-44-card.png
description: This week, we discuss the FeatherHttp project and Azure Static Web Apps.

---

![Newsletter image](https://daveabrock.com/THE .NET STACKS.png)

Happy Monday! Here's what we're talking about this week:

- **One big thing**: Looking at the FeatherHttp project
- **The little things**: Azure Static Web apps with DevOps, new OSS badges, coding tip
- Last week in the .NET world

***

# One big thing: Looking at the `FeatherHttp` project

We've talked in the past about ASP.NET Core MVC APIs and their role in the .NET Core ecosystem. While MVC has received performance improvements and does what it sets out to do, it carries a lot of overhead and is often reminiscent of the "here you go, have it all" reputation of .NET Framework. It's a robust solution that allows you to build complex APIs but comes with a lot of ceremony. With imperative frameworks like Go and Express, you can get started immediately and with little effort. No one has said the same about writing APIs in ASP.NET Core. It's a bad look on the framework in general, especially when folks want to try out .NET for the first time.

Last year, Dapr pushed cross-platform samples for the major frameworks, and this tweet shows a common theme with MVC:

It does a *REALLY* bad job at showing off C#. The example has 20+ files while all the others have 2-5 🤦♂
— Kristian Hellang (@khellang) November 24, 2019

Can we have solutions that allow you to get started quickly and avoid this mess? What if you aren't a fan of controllers? You could use external libraries like [MediatR](https://github.com/jbogard/MediatR) or [API Endpoints](https://github.com/ardalis/ApiEndpoints), or a [framework like Nancy](https://nancyfx.org/)—but it still feels like the native runtime deserves better. The ASP.NET Core team has [thought about this](https://twitter.com/davidfowl/status/1198870972679372800) for a while.

The [route-to-code alternative](https://docs.microsoft.com/aspnet/core/web-api/route-to-code?view=aspnetcore-5.0) is a great start, which [I wrote about](https://daveabrock.com/2020/12/04/migrate-mvc-to-route-to-code). It allows you to write simple JSON APIs, using an API endpoints model—with some helper methods that lend a hand.

Here's a quick example:

```csharp
app.UseEndpoints(endpoints =>
{
    endpoints.MapGet("/hello/{name:alpha}", async context =>
    {
        var name = context.Request.RouteValues["name"];
        await context.Response.WriteAsJsonAsync(new { message = $"Hello {name}!" });
    });
});
```

It's great, but Microsoft will tell you it's only for simple APIs. Their docs [clearly state](https://docs.microsoft.com/aspnet/core/web-api/route-to-code?view=aspnetcore-5.0#notable-missing-features-compared-to-web-api): *Route-to-code is designed for basic JSON APIs. It doesn't have support for many of the advanced features provided by ASP.NET Core Web API.* This begs the question: will .NET ever have a modern, lightweight API solution that has a low barrier to entry and also scales? Can I have a lightweight API that starts small and allows me to add complex features as I need them?

That is the goal of [FeatherHttp](https://github.com/featherhttp/framework), a project from ASP.NET Core architect David Fowler. Triggered by Kristian's tweet, Fowler says the repo has three key goals: to be built on the same primitives on .NET Core, to be optimized to build HTTP APIs quickly, and having the ability to take advantage of existing .NET Core middleware and frameworks. According to a [GitHub comment](https://github.com/featherhttp/framework/issues/3#issuecomment-564403379), the solution uses 90% of ASP.NET Core and changes the Startup pattern to be more lightweight. You can also [check out a tutorial](https://github.com/featherhttp/tutorial) that walks you through building the backend of a React app with basic CRUD APIs and some serialization.

Here's an example:

```csharp
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;

var app = WebApplication.Create(args);

app.MapGet("/", async http =>
{
    await http.Response.WriteAsync("Hello World");
});

await app.RunAsync();
```

Is this a fun experiment (currently at version *0.1.82-alpha*) or will it make its way into ASP.NET Core? I'm not a mind reader, my friends, but I do know two things: (1) David Fowler is the partner architect on ASP.NET Core, and (2) big objectives for .NET 6 are [to appeal to new folks](https://github.com/dotnet/core/issues/5465) and to [improve the developer inner-loop experience](https://github.com/dotnet/core/issues/5510). I suspect we'll be hearing a lot more about this. Stay tuned.

***

# The little things: Azure Static Web apps with DevOps, new OSS badges, code complexity tip

Last week, Microsoft announced that Azure Static Web Apps supports deployment through Azure DevOps YAML pipelines. I [wrote about it as well](https://daveabrock.com/2021/04/01/static-web-apps-azure-pipelines). It opens doors for many corporate customers who aren't ready to move to GitHub yet—while they've made great strides, GitHub still has some work to do to match the robust enterprise capabilities of Azure DevOps.

I was able to move one of my projects over seamlessly. Unlike GitHub Actions, Azure DevOps handles PR triggers for you automatically, so my YAML is pretty clean:

```yaml
trigger:
  - main

pool:
  vmImage: 'ubuntu-latest'

steps:
  - task: AzureStaticWebApp@0
    inputs:
      app_location: "BlastOff.Client"
      api_location: "BlastOff.Api"
      output_location: "wwwroot"
    env:
      azure_static_web_apps_api_token: $(deployment_token)
```

While it isn’t as streamlined and elegant as the GitHub experience—you need to configure your deployment token manually, and you don’t get automatic staging environments—this should help improve adoption. If you're wondering whether to use Azure Static Web Apps with Azure DevOps or GitHub, [I've got you covered](https://daveabrock.com/2021/04/01/static-web-apps-azure-pipelines#should-i-use-azure-static-web-apps-with-azure-devops-or-github).

***

The ASP.NET Core team [has introduced](https://twitter.com/ben_a_adams/status/1376587282413711364) "good first issue" and "Help wanted" GitHub badges. If you've ever wanted to contribute to ASP.NET Core but didn't know where to start, this might help.

***

Sometimes, it seems that processing a collection of objects is half of a developer's job. It can often be a subject of abuse, especially when it comes to nested loops and their poor performance.

Here's an example of me iterating through a list of `Blogger` objects, checking if a `Url` exists, and adding it to a list. (I'm using [records](https://daveabrock.com/2020/07/06/c-sharp-9-deep-dive-records) and [target-typed expressions](https://daveabrock.com/2020/07/14/c-sharp-9-target-typing-covariants#improved-target-typing) for brevity.)

```csharp
using System.Collections.Generic;

var result = new List<string>();
var bloggers = new List<Blogger>
{
    new("Dave Brock", "https://daveabrock.com", true),
    new("James Clear", "https://jamesclear.com", false)
};

foreach (var blogger in bloggers)
{
    if (blogger.IsTechBlogger)
    {
        var url = blogger.Url;
        if (url is not null)
            result.Add(url);
    }
}

record Blogger(string Name, string Url, bool IsTechBlogger);
```

Instead, try a [LINQ collection pipeline](https://www.martinfowler.com/articles/refactoring-pipelines.html):

```csharp
using System.Collections.Generic;
using System.Linq;

var urlList = new List<string>();
var bloggers = new List<Blogger>
{
    new("Dave Brock", "https://daveabrock.com", true),
    new("James Clear", "https://jamesclear.com", false)
};

urlList = bloggers.Where(b => b.IsTechBlogger)
                  .Select(u => u.Url)
                  .Where(u => u is not null).ToList();

record Blogger(string Name, string Url, bool IsTechBlogger);
```

***

# 🌎 Last week in the .NET world

## 🔥 The Top 4

- Nish Anil [writes about monitoring and observability in cloud-native ASP.NET Core apps](https://devblogs.microsoft.com/aspnet/monitoring-and-observability-in-cloud-native-asp-net-core-apps).
- Dave Brock [uses Azure Static Web Apps with Azure DevOps pipelines](https://daveabrock.com/2021/04/01/static-web-apps-azure-pipelines).
- Michael Shpilt [maximizes the power of logs as applications scale](https://michaelscodingspot.com/maximizing-the-power-of-logs-as-your-application-scales/).
- Vladimir Khorikov asks: [are static methods evil?](https://enterprisecraftsmanship.com/posts/static-methods-evil/)

## 📢 Announcements

- Azure Static Web Apps [now supports deployment with Azure DevOps](https://azure.microsoft.com/updates/public-preview-azure-static-web-apps-now-supports-deployment-with-azure-devops).
- GitHub Desktop [now supports cherry-picking](https://github.blog/2021-03-30-github-desktop-now-supports-cherry-picking/).
- Alvin Ashcraft [has released his book on WinUI 3.](https://mailchi.mp/e7c5133c9388/learn-winui-3-book-and-ebook-now-available?e=0eceb6f972&_lrsc=3fe8d675-aafa-4cf2-a5af-e2b4de71c460).
- Nicholas Blumhardt [announces Serilog Expressions 2.0](https://nblumhardt.com/2021/03/serilog-expressions-2/).
- PostSharp 6.9 is live [with Visual Studio Tooling performance improvements](https://blog.postsharp.net/post/postsharp-6-9-visual-studio-tooling-performance-improvements.html).
- Andrew Clinick [announces Project Reunion 0.5](https://blogs.windows.com/windowsdeveloper/2021/03/29/announcing-project-reunion-0-5).
- .NET Standard 1.3 is [no longer supported in AWS SDK for .NET version 3.7](https://aws.amazon.com/blogs/developer/net-standard-1-3-is-no-longer-supported-in-aws-sdk-for-net-version-3-7/).
- David Guida's [OpenSleigh project](https://www.opensleigh.net/) has been [sponsored by JetBrains](https://twitter.com/DavideGuida82/status/1376896675579449351).

## 📅 Community and events

- Matt Lacey [builds a Visual Studio extension to navigate between ANY files](https://www.mrlacey.com/2021/03/here-i-made-way-to-navigate-between-any.html).
- For community standups: Xamarin [previews .NET 6 updates](https://www.youtube.com/watch?v=su3ntRjEN1I) and ASP.NET [talks about 12-factor apps](https://www.youtube.com/watch?v=xRlDuXJ3t08).
- Because NuGet stores download counts in Int32, in [80 weeks the NewtonSoft.Json package will overflow it](https://twitter.com/JamesNK/status/1377400586950172672).
- Microsoft Build [will occur on May 25-27](https://www.zdnet.com/article/its-official-microsoft-build-will-be-may-25-to-27/).

## 🌎 Web development

- Matthew Jones [continues writing a Tetris game in Blazor](https://exceptionnotfound.net/tetris-in-blazor-part-2-cells-the-grid-and-the-game-state/).
- Mukesh Murugan builds a chat application [with Blazor, Identity, and SignalR](https://codewithmukesh.com/blog/realtime-chat-application-with-blazor/).
- Niels Swimberghe [deploys Blazor WebAssembly apps to DigitalOcean](https://swimburger.net/blog/dotnet/how-to-deploy-blazor-webassembly-to-digitalocean-app-platform).
- Sundaram Subramanian [writes about using the MudBlazor library for breadcrumbs](https://www.c-sharpcorner.com/article/breadcrumbs-for-blazor-using-mudblazor/).
- David Hayden [works with ASP.NET Core user secrets and the Secret Manager tool](https://www.davidhayden.me/blog/asp-net-core-user-secrets-and-secret-manager-tool).
- Claudio Bernasconi [writes a Blazor dialog component in .NET 5](https://www.claudiobernasconi.ch/2021/03/26/blazor-modal-dialog-component/), and also [handles CSS in Blazor](https://www.claudiobernasconi.ch/2021/03/31/blazor-css-handling/).
- Marinko Spasojevic [works with Material UI in Blazor](https://code-maze.com/blazor-material-ui-configuration-and-theme-customization/).

## 🥅 The .NET platform

- Khalid Abuhakmeh [handles exceptions with ASP.NET Core ExceptionHandlerMiddleware
](https://khalidabuhakmeh.com/handling-aspnet-core-exceptions-with-exceptionhandler-middleware).
- Matthew MacDonald [writes about the future of Windows apps](https://medium.com/young-coder/the-future-of-windows-apps-demystified-17d1f9e325d1).
- Peter Vogel [writes about Project Reunion](https://www.telerik.com/blogs/project-reunion-why-desktop-developers-care).

## ⛅ The cloud

- Paul Michaels [writes about auto-deleting Azure Service Bus messages when idle](https://www.pmichaels.net/2021/03/27/azure-service-bus-auto-delete-on-idle/).
- Khalid Abuhakmeh [builds mono-repos with GitHub Actions](https://khalidabuhakmeh.com/building-mono-repositories-with-github-actions).
- Jon Gallant [works with Azure REST APIs with Postman's OAuth 2.0 Provider](https://blog.jongallant.com/2021/03/azure-rest-apis-postman-oauth2/).
- Aaron Powell [writes about simplifying auth for Azure Static Web App APIs](https://www.aaron-powell.com/posts/2021-03-30-making-auth-simpler-for-static-web-app-apis/).

## 📔 Languages

- Tom Deseyn [writes about C# 9 top-level programs and target-typed expressions](https://developers.redhat.com/blog/2021/03/30/c-9-top-level-programs-and-target-typed-expressions/).
- Shawn Wildermuth [demystifies bitwise operators in C#](http://wildermuth.com/2021/03/28/Coding-Shorts-Demystifying-Bitwise-Operators-in-C).

## 🔧 Tools

- Clyde D'Souza [explores GitHub Actions fundamentals](https://codeburst.io/fundamentals-of-github-actions-d35dc3102447).
- Richard Reedy [writes about the .NET Upgrade Assistant](https://www.telerik.com/blogs/jump-starting-migration-dotnet-core-with-upgrade-assistant).
- Scott Hanselman [writes about recent updates to the Windows Terminal](https://www.hanselman.com/blog/the-windows-terminal-made-better-with-the-command-palette-plus-multiple-actions-in-one-command).
- Julio Sampaio [stress tests .ET apps with Apache JMeter](https://www.red-gate.com/simple-talk/dotnet/software-testing/load-stress-testing-net-apps-with-apache-jmeter/).
- Yannick Reekmans [adds the Developer PowerShell and Developer Command Prompt for Visual Studio to Windows Terminal](https://techcommunity.microsoft.com/t5/microsoft-365-pnp-blog/add-developer-powershell-and-developer-command-prompt-for-visual/ba-p/2243078).
- James Montemagno [explores code Generation from XAML in Visual Studio](https://montemagno.com/code-generation-from-xaml-in-visual-studio/).

## 📱 Xamarin

- Luis Matos [handles global errors ](https://luismts.com/global-error-handling-xamarin-forms/).
- Sam Basu [provides another MAUI update](https://www.telerik.com/blogs/sands-of-maui-issue-2).
- James Montemagno [sets Up an M1 Mac for Xamarin development](https://montemagno.com/setting-up-an-m1-mac-for-xamarin-development/).

## 🏗 Design, testing, and best practices

- Jason Farrell [addresses a misconception that serverless is good for APIs](https://jfarrell.net/2021/03/28/common-misconception-2-serverless-is-good-for-apis/).
- James Shore [writes about TDD](https://www.jamesshore.com/v2/books/aoad2/test-driven_development).
- Oleksii Holubiev [writes about .NET authentication](https://hackernoon.com/net-authentication-security-notes-a64w35fg?source=rss).
- Genevieve Michaels [writes about providing feedback to your manager without being a jerk](https://blog.trello.com/how-to-give-your-manager-feedback).
- Derek Comartin [discusses the pitfalls of using REST APIs for microservices](https://codeopinion.com/rest-apis-for-microservices-beware/).
- Patrick Smacchia [writes about 8 books for .NET developers](https://blog.ndepend.com/8-books-to-improve-as-a-net-developer/).
- Rossitza Fakalieva [unit tests some C# 8 and 9 features](https://www.telerik.com/blogs/lets-give-some-unit-testing-love-to-csharp-8-9-features).
- James Hickey writes about [scaling your auth system](https://fusionauth.io/learn/expert-advice/identity-basics/making-sure-your-auth-system-scales/).

## 🎤 Podcasts

- The Adventures in .NET podcast [talks about application monitoring](https://devchat.tv/adventures-in-dotnet/net-062-innocent-application-performance-monitoring-with-innocent-bindura-from-raygun/).
- The 6-Figure Developer podcast [talks about reactive DDD with Vaughn Vernon](https://6figuredev.com/podcast/episode-189-reactive-ddd-with-vaughn-vernon/).
- The .NET Core Podcast [discusses C# and .NET for beginners with Vijesh Salian](https://dotnetcore.show/episode-73-c-sharp-and-net-for-beginners-with-vijesh-salian/).
- The Complete Developer podcast [talks about side hustle failures](https://completedeveloperpodcast.com/side-hustle-fails/).

## 🎥 Videos

- Over at Ask the Expert, [a discussion with Dr. Brian Kernighan, the inventor of "Hello, World."](https://channel9.msdn.com/Shows/Ask-the-Expert/Ask-the-Expert-Hello-Brian-A-conversation-with-Dr-Brian-Kernighan-creator-of-hello-world)
- The On .NET Show [integrates PowerApps with .NET Web APIs](https://channel9.msdn.com/Shows/On-NET/Integrating-PowerApps-with-NET-Web-APIs), [discusses the .NET Upgrade Assistant](https://www.youtube.com/watch?v=L5Fy1-CTCLo), and [integrates PowerApps with .NET Web APIs](https://www.youtube.com/watch?v=VLqdRpwniwk).
- The ASP.NET Monsters [discuss Microsoft Identity with Christos Matskas](https://www.youtube.com/watch?v=LgNc-IA8d1g).
- The AI Show [extracts information from documents with Form Recognizer](https://channel9.msdn.com/Shows/AI-Show/Extract-information-from-your-documents-with-new-capabilities-in-Form-Recognizer).

gha_language: Ruby


text:
# Overview

This runs some code that drives a 7-segment display that is connected to a
Raspberry Pi.
The display can work in various ways (clock, countdown timer, etc.),
which is exposed via a gRPC interface.

## Installation Requirements on the Raspberry Pi

The following needs to be installed on the Raspberry Pi that is going to run the
gRPC server.

_These were done on a fresh install of the "lite" version of Raspbian GNU/Linux
9 (stretch)._

- [Enable kernel support for I2C](https://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/configuring-i2c). (This is done via `sudo raspi-config`.)
- It's a good idea to do this before installing the other packages: `sudo apt-get update`
- Many of the scripts use `git rev-parse --show-toplevel`, so `git` must be
  installed: `sudo apt-get install git`
- This adds `easy_install`: `sudo apt-get install python-setuptools`
- `sudo easy_install pip`
- Installing `grpcio` relies on this: `sudo apt-get install python-dev`
- Installs the `grpcio` Python package for the gRPC server (warning: this may
  take over 30 minutes): `sudo python -m pip install grpcio`
- Used to read `config.toml`: `sudo python -m pip install toml`
- This is what makes it possible to control the 7-segment display:
  `sudo easy_install Adafruit_LED_Backpack`
- `yarn` to install all the dependencies in the Yarn workspace.
- Run `npm rebuild --build-from-source grpc` after running `yarn` due to
  https://github.com/grpc/grpc/issues/13258. (Note that this step may take
  hours: we should figure out how to cross-compile this instead.)

## i2c Permissions

(You can skip this step if the user running the gRPC server already has
read/write access to `/dev/i2c*`. Use `id` to see if your user is already in the
`i2c` group.)

By default, the permissions of the `i2c` devices should look like this:

```
$ ls -l /dev/i2c*
crw-rw---T 1 root i2c 89, 0 Feb 13 23:48 /dev/i2c-0
crw-rw---T 1 root i2c 89, 1 Feb 13 23:48 /dev/i2c-1
```

They are owned by `root` and in the group `i2c`. If you want to avoid running
this service as `root`, then you should put the user who will run the service
(in my case, `pi`) in the `i2c` group:

```
sudo adduser pi i2c
```

**Note you have to log out and back in for the changes to take effect!**

Alternatively, if you want to permanently change the permissions of these
devices rather than a user's groups, you can add a
[`udev` rule](http://www.reactivated.net/writing_udev_rules.html) so that
these devices are in the `pi` group:

```
echo 'ACTION=="add", KERNEL=="i2c-[0-1]*", GROUP="pi"' \
  | sudo tee --append /etc/udev/rules.d/00-i2c.rules
```

Changes to `udev` rules require a reboot to take effect:

```
sudo reboot
```

## gRPC Authentication

Run `./scripts/create_certs` to generate `server.crt` and `server.key` in the
`certs/` folder. The gRPC server needs both `server.crt` and `server.key`
while a gRPC client needs only `server.crt`.

## Develop and Deploy

Assuming that you are developing the code on a machine other than the Raspberry
Pi where the software will ultimately run, you should perform the initial build
steps on your local machine:

- Edit `config.toml` so that it has the proper values for your Pi.
- Run `./scripts/create_certs`.
- Run `./scripts/gen_app_json`.
- Run `./scripts/gen_grpc`.

Now you are ready to push the code to the Pi. Do this by running:

```
./scripts/deploy
```

Note that `./scripts/deploy` will not copy your local `node_modules` folder because
you likely had to run `npm rebuild --build-from-source grpc` locally on the Pi and so
you do not want the version of grpc built on your local machine to overwrite the one
that was built for the Pi.

Now ssh over to the Pi and `cd` to the directory where you pushed `rpi-clock`.
From the root of the project, run each of the following in its own terminal
(currently, each is a server that runs forever in the foreground):

- `./scripts/run_segment7_server`
- `./scripts/run_controller`
- `./scripts/run_webserver`

## systemd

Install `Adafruit_LED_Backpack` so systemd has access to it:

```
sudo pip3 install --system Adafruit_LED_Backpack
```

Write the following to `/etc/systemd/system/rpi-clock.service`
(using the appropriate value on your system for `ExecStart`):

```
[Unit]
Description=clock on 7-segment display

[Service]
Type=simple
ExecStart=/home/pi/src/rpi-clock/src/simple-server/main.py

[Install]
WantedBy=multi-user.target
```

Set the permissions appropriately:

```
sudo chmod 644 /etc/systemd/system/rpi-clock.service
```

Now you should be able to do:

```
sudo systemctl status rpi-clock
sudo systemctl start rpi-clock
```

Run this to ensure it runs when the Raspberry Pi reboots:

```
sudo systemctl enable rpi-clock
```

## Troubleshooting

Unless you have changed it, your Pi likely defaults to having WiFi
power saving turned _on_, which is not a great setting for something like a
server that you want to be able to connect to 24/7. Reading through
[this answer](https://raspberrypi.stackexchange.com/questions/34794/how-to-disable-wi-fi-dongle-sleep-mode),
you should diagnose this by running the following on your Pi:

```
iw wlan0 get power_save
```

If that returns:

```
Power save: on
```

Try turning power save off by running:

```
sudo iw wlan0 set power_save off
```

To make this change permanent, consider adding `iwconfig wlan0 power off`
to your [`/etc/rc.local`](https://www.raspberrypi.org/documentation/linux/usage/rc-local.md)
so it will take effect on reboot.

repository: bolinfest/rpi-clock

repo_name: bolinfest/rpi-clock


text:
---
layout: default
---

# 1993-06-08 - Re: CERT: the letter from CERT to berkeley.edu admin

## Header Data

From<EMAIL_ADDRESS>To: Eric Hughes<EMAIL_ADDRESS>Message Hash: a623bb024f4f1d68faaf4adead64f54d12b6e8caac6902f7168bae830d2dc886

Message ID<EMAIL_ADDRESS>Reply To: _N/A_

UTC Datetime: 1993-06-08 20:59:09 UTC

Raw Date: Tue, 8 Jun 93 13:59:09 PDT

## Raw message

```
{% raw  %}From<EMAIL_ADDRESS>Date: Tue, 8 Jun 93 13:59:09 PDT
To: Eric Hughes<EMAIL_ADDRESS>Subject: Re: CERT: the letter from CERT to berkeley.edu admin
Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

	 >Any public spooling directory is fair game for their antics. [...]
	 >My guess is that your CERT problems have NOTHING to do with
	 >PGP distribution.

	 There is only one directory on the cypherpunks site that is writable,
	 and that is the incoming directory and it's not readable.

It doesn't have to be.  Anyone could create ``incoming/.. '', stick
some files in it, and tell his/her friends.  The new directory would
be readable.

Again, I'm not speaking hypothetically here.  In our case, it was ..^T,
and contained pirated PC software.  (We decided not to infect those files
with viruses...  We didn't even replace them with programs that just
printed nasty messages.)

{% endraw %}
```

## Thread

+ Return to [June 1993](/archive/1993/06)

+ Return to "[smb@research.att.com](/authors/smb_at_research_att_com)"

+ 1993-06-08 (Tue, 8 Jun 93 13:59:09 PDT) - Re: CERT: the letter from CERT to berkeley.edu admin -<EMAIL_ADDRESS>


text:
# Selected Projects in Data Science, Machine Learning, and NLP, etc.

---

### Angel Reese v. Caitlin Clark: Few-shot learning Sentiment Analysis with GPT-3.5

Sentiment analysis is target-oriented, aiming to identify opinions or attitudes towards topics or entities. In this project, I built a text classifier using OpenAI's Chat API, combined with a semantic similarity pipeline using SBERT for generating optimized prompt examples.

[![](https://img.shields.io/badge/Python-white?logo=Python)](#) [![](https://img.shields.io/badge/Jupyter-black?logo=Jupyter)](#) [![](https://img.shields.io/badge/PyTorch-white?logo=pytorch)](#) [![](https://img.shields.io/badge/YouTube-black?logo=youtube)](#)

[![](https://img.shields.io/badge/Twitter-white?logo=Twitter)](#) [![](https://img.shields.io/badge/OpenAI-black?logo=openai)](#) [![](https://img.shields.io/badge/HuggingFace_Transformers-white)](#)

[View code on Colab](https://colab.research.google.com/drive/1QdwMAsxRfX_XVrdrPs0Rfdxqs-Yyoid8?usp=sharing)

---

### Creating a Cross-Cultural music reccomendation system with Machine Learning

Developed a cross-cultural music recommendation system using Spotify API, audio feature extraction, unsupervised learning, clustering algorithms, matrix factorization, content-based and collaborative filtering to generate personalized playlists tailored to taste profiles.

For this, I used various ML techniques including: (i) Kmeans++, KNN (ii) Content-Based Filtering (iii) Collaborative Filtering (KnnBasic) (iv) Matrix Factorization (Singular Value Decomposition, Alternating Least Squares, and Non-negative Matrix Factorization)

[![](https://img.shields.io/badge/Python-white?logo=Python)](#) [![](https://img.shields.io/badge/Jupyter-black?logo=Jupyter)](#) [![](https://img.shields.io/badge/sklearn-white?logo=scikit-learn)](#) [![](https://img.shields.io/badge/Spotify-black?logo=Spotify)](#)

[View code on Colab](https://colab.research.google.com/drive/1Jg6GWEcf4zMfkK2gsJuHeObspYo4_o5d?usp=sharing)

---

### spotify2mp3 - Downloading your favorite Spotify Playlists to your local folder.
This Project makes use of HTTP requests, the Spotify API, YouTube API, and finally selenium to import a Spotify playlist to a local folder on your device.

[![](https://img.shields.io/badge/Python-white?logo=Python)](#) [![](https://img.shields.io/badge/YouTube-black?logo=youtube)](#) [![](https://img.shields.io/badge/sklearn-white?logo=scikit-learn)](#)
 [![](https://img.shields.io/badge/Spotify-black?logo=Spotify)](#)
[![](https://img.shields.io/badge/Jupyter-white?logo=Jupyter)](#) [![](https://img.shields.io/badge/Selenium-black?logo=Selenium)](#)

[View code on GitHub](https://github.com/williamzabet/spotify2mp3)

---

## Other Various Projects
A selection of smaller projects demonstrating specific data science and ML skills.

- [Solving CSP's using Forward Checking, LCV, MRV, and constraint propagation](https://github.com/williamzabet/6511-CSP-Problem-Solver)
- [Finding the Shortest Path with Dijkstras and A*](https://github.com/williamzabet/6511-Shortest-Path)
- [An Exploratory Analysis on Crime Rate in DC using various ML techniques](https://github.com/williamzabet/Crime-in-DC)


text:
# MorF
Gender classifier built with the Tensorflow and Keras API, and trained with 95,000 names + genders from [Data World](https://data.world/howarder/gender-by-name).
This is project for my own learning, meaning as I learn more about machine learning, I will (ideally) update the classifier and improve its' accuracy.

## Status
Last recorded model accuracy: 90.2% ~~79%~~ ~~77.5%~~ ~~74.5~~ ~~70.5~~ (80.4% better than randomly guessing)

## Getting Started

To get a local copy up and running follow these simple steps.

### Installation

1. Clone the repo
   ```sh
   git clone https://github.com/francisdbillones/MorF.git
   ```
2. Install Python packages
   ```sh
   python3 -m pip install -r requirements.txt
   ```

### Training with your own data
If you want to train the model with your own data, pass an argument to `MorF.py`:
```sh
python3 MorF.py data.csv
```

`data.csv` is a CSV file with headers `name` and `gender`. A 1 corresponds to female, and a
0 corresponds to male. These must be ***first names*** only, and contain at least one name-gender entry.

## Using the pre-trained model

The model is provided through the `model` directory.

Load it into memory using Keras:
```py
import tensorflow.keras as keras
model = keras.models.load_model('model')
```

## License

Distributed under the MIT License. See `LICENSE` for more information.

repository: francisdbillones/MorF

repo_name: francisdbillones/MorF