text:
---
layout: post
title: It's not Singletons, it's your language
categories:
tags: programming singletons
stopwords:
last_modified:
original_url:
---

Every so often I run across some programmer who says that Singleton objects are bad, and I then go reading to see what people are saying about Singletons. I'm struck how often their complaints are limitations of their language and misapplication of object-orientation principles.

<!--more-->

The Singleton comes from Object-Oriented Design Patterns, a Smalltalk book (later ported to C++) that described how you can arrange and connect objects to solve various organizational problems. Think about this as you read people's complaints. This book was originally written for one language then lightly edited to use a completely different language with different ideas.

## Object-Orientation

Smalltalk, invented in the 1970s at Xerox Park, is largely attributed to its main evangelist, Alan Kay ([The Early History Of Smalltalk](http://worrydream.com/EarlyHistoryOfSmalltalk/). He [accidentally coined "object-oriented](https://www.quora.com/What-did-Alan-Kay-mean-by-I-made-up-the-term-object-oriented-and-I-can-tell-you-I-did-not-have-C++-in-mind), although he later says that it wasn't a good description of what he was actually doing. His idea, loosely, was that things ("objects") would talk to each other by sending and receiving messages. Different receivers, completely unrelated to each other, could handle the same messages. You don't care if you have the right Type, and you didn't need to know all the Types and bindings and relationships ahead of time. This made the syntax of Smalltalk very simple.

C++, invented in the late 1970s and early 1980s, as "C with Objects" and later its final name, was a different beast. You can write C in a way that has the concept of classes and objects. That's the way C++ originally worked—it transpiled code to the equivalent C. But, C doesn't have the same ideas, designs, or goals as Smalltalk. It doesn't think in terms of messages, and it really wants to know everything ahead of time (or you have to play weird games to get around that).

## Design Patterns

The idea of a "design pattern" comes out of architecture (as in buildings and whatnot). Christopher Alexander wanted to create a vocabulary for common concepts that architects could use to maintain consistency throughout a plan. These patterns would help you decide what you needed to do.

The [Design Patterns: Elements of Reusable Object-Oriented Software](https://amzn.to/3uljGkD) uses the same term, but adds another wrinkle. The authors include sample implementations. We all know how that is going to work out. Once you show concrete code, people think that the code is the pattern.

The two are not the same. Mark Jason Dominus explains it in his presentation ["Design Patterns" Aren't](https://perl.plover.com/yak/design/).

## The Singleton

The [Singleton Pattern](https://www.oodesign.com/singleton-pattern.html) has too stated intents:

* Ensure that only one instance of a class is created.
* Provide a global point of access to the object.

But, these intents are not the actual intents. The real intent, as expressed in the rest of the description of the idea, is that a program can share something which having to coordinate with anything else that also wants to share the thing. The stated intents are not the revealed intents

The "one instance" leads astray the literal minded. I don't care if there's a single instance, two instances, or some other number. In that regard, "Singleton" is a bad name for a pattern. It's pre-maturely specifying the number of things to share, and excluding from the concept that we might want to share more than one thing.

Some people also focus on the "global point of access" to mean it's a global variable with global state. Well, every class name you create is a global *point* of access. But, it doesn't have to be global either. Parts of the program that don't need it don't even need to know about it.

These misapprehensions arise because the software "design patterns" are received as code, and the C++ examples come from a language that actively gets in your way because it already has opinions about how you should do things. The online version uses JAva:

{% highlight c++ %}
class Singleton {
	private static Singleton instance;

	private Singleton() {
		...
	}

	public static synchronized Singleton getInstance(){

		if (instance == null)
			instance = new Singleton();

		return instance;
	}

	...

	public void doSomething()
	{
		...
	}
}
{% endhighlight %}

The code example has to work hard to avoid having a constructor. There's a private inner class `Singleton` with the same name as the public class. That's mostly because most examples are generic, and this is about as generic as you can get. You can't call `new` on the public class because you'd get a different object. And, not calling `new` calls out that there's something funny about this arrangement.

Consider the same thing in Perl, which lets you do practically anything you want. You don't keep creating objects. You create it once and reuse it, but since no method name is special in Perl, it doesn't matter that you use `new`. Call `new` as many times as you like without creating more objects. The programmer doesn't even have to know they are using a Singleton (and that's the point!)

{% highlight perl %}
package Singleton {
	my $singleton;

	sub new {
		return $singleton if defined $singleton;
		$singleton = ...
	    }
}
{% endhighlight %}

Some of the complaints about this form is that the Singleton class doesn't have a proper constructor or destructor. I think these are language details.

### Lifecycle

Another complaint is that the lifecycle of a Singleton is essentially from the point of its first use to the end of the application. That stored instance, in the way its presented, essentially sticks around forever. That's another implementation detail, though; when the programmer asks for the instance, you are allowed to do anything to like.

But, why does the programmer ever have to see the singleton or get to use it directly? At the application level, you use a class that more directly connects to the actions the application wants to do, and that class then translates the calls to the shared resource. For example, I print to a socket, but I don't manage the details of the socket in the application layer.

The `SharedThingy` class can

{% highlight perl %}
package Singleton {
	use experimental qw(signatures);

	my $singleton;

	sub new ( $class, @args ) {
		return $singleton if defined $singleton;
		$singleton = ...
	    }

	sub clear ( $self ) { $singleton = undef }
	}

sub SharedThingy {
	use experimental qw(signatures);
	my $active = 0;
	sub new ( $class ) {
		$active++;
		my $self = bless { singleton = Singleton->new }, $class;
		}

	sub DESTROY ( $self ) {
		$active--;
		$self->singleton->clear if $active == 0;
		}
	}
{% endhighlight %}

The `SharedThingy` has the lifecycle that people expect because its object contains the singleton but also know when it is created and when it goes out of scope.

This is, by the way, what some database modules do. They keep a single connection, ping it, and reconnect when necessary, all while hiding that from the application.

If you are directly exposing the shared resource to the application, you are probably doing it wrong anyway. Mixing high and low is a bad idea, guaranteeing tears and misfortune.

### Testing

Testability is another concern, and another reason not to mix the high and the low details. At some point, you have to remove or limit access to the shared resource during testing. If you can't do that easily, your design is wrong.

One interesting example I saw involved charging credit cards and accidentally charging people more than once. First, why do you test against the production merchant systems? Most of those will have a sandbox for testing. There's no requirement that the low-level implementation choose one system over the other, and a design that prevents that selection is a bad one. Consider, for example, what happens when you change merchant accounts. Does your code suddenly need widespread and invasive changes?

{% highlight perl %}
sub SharedThingy {
	use experimental qw(signatures);
	my $active = 0;
	my $singleton_class = ... ? 'ProdSingleton' : 'TestSingleton';
	sub new ( $class ) {
		$active++;
		bless { singleton = $singleton_class->new }, $class;
		}

	sub DESTROY ( $self ) {
		$active--;
		$self->singleton->clear if $active == 0;
		}
	}
{% endhighlight %}

Another complaint about testability is that multiple tests, running in parallel (or even the same test suite run simultaneously) would affect the state of the shared resource. Sure. But so is production.

There might be examples where you can't do this, but I haven't seen anyone present a concrete version.

### Multithreading

Some people note that if you don't have thread-safe code in your implementation of the Singleton, then the Singleton is not thread-safe. It's a weak complaint that's put to bed in [C++ and the Perils of Double-Checked Locking](https://www.aristeia.com/Papers/DDJ_Jul_Aug_2004_revised.pdf). You have to do this to control access to any shared thing:

{% highlight c++ %}
Singleton* Singleton::instance() {
	if (pInstance == 0) {  // 1st test
		Lock lock;
		if (pInstance == 0) { // 2nd test
			pInstance = new Singleton;
		}
	}
	return pInstance;
}
{% endhighlight %}

### Inappropriate use

A final criticism is that people use the Singleton pattern incorrectly or in places where it's not appropriate.  That's not the fault of the idea though.

## Hall of Shame

* [Singleton Design Pattern in Automated Testing](https://www.automatetheplanet.com/singleton-design-pattern/)
* [6 Reasons Why You Should Avoid Singletons | David Tanzer - Coach Consultant Trainer](https://www.davidtanzer.net/david%27s%20blog/2016/03/14/6-reasons-why-you-should-avoid-singletons.html)

## Further reading

* [Singletons The Safe Way. The Singleton pattern is a useful… | by Matt Carroll | Medium](https://mattcarroll.medium.com/singletons-the-safe-way-9d1e019220fc)
* [design patterns - So Singletons are bad, then what? - Software Engineering Stack Exchange](https://softwareengineering.stackexchange.com/questions/40373/so-singletons-are-bad-then-what)
* [Singleton Considerations | Johannes Rudolph's Blog](https://jorudolph.wordpress.com/2009/11/22/singleton-considerations/)


text:
---
layout: project-page
help: mars
title: Setting Up Development Environment
category: Help
reference: Procedures-setting
---
1. Before developing, you must have [npm](https://nodejs.org/en/download/) (Node Package Manager) and [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git). npm is used for managing dependencies for CirdlesWebUI. If you do not have Node.js and npm on your computer you will need to install Node and npm comes installed with it. Follow the instructions to download [Node.js](https://nodejs.org/en/download/)

2. You will also need to install [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) if you have not done so already and follow the step by step directions to install git.

3. Please read the [CirdlesWebUI](https://github.com/CIRDLES/CirdlesWebUI) repository for more information regarding development of CirdlesWebUI projects

<i>Note: MARS is currently in the development stage, so MARS uses SESAR’s test database and there may be developer tools visible to you.</i>

branch_name: refs/heads/master

extension: md

gha_language: HTML

license_type: permissive


text:
# poo.email

[![Build Status](https://github.com/mooyoul/poo.email/workflows/workflow/badge.svg)](https://github.com/mooyoul/poo.email/actions)
[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com/)
[![MIT license](http://img.shields.io/badge/license-MIT-blue.svg)](http://mooyoul.mit-license.org/)

[poo.email](https://poo.email) is a disposable email service, which is powered by 100% Serverless Architecture.

There are no resources to provision or manage. Pay as you go, and Scales automatically.

All inboxes are public, and you can use your username whatever you want.

All received emails will be deleted automatically after 24 hours.

## Live Demo

https://poo.email/

or Send a mail to [example@poo.email](mailto:example@poo.email), then Navigate to [Inbox of example@poo.email](https://poo.email/#/inbox/example)!

> NOTE: Inbox of<EMAIL_ADDRESS>is read-only.
>
> Received mail will be deleted after 24 hours like any other inboxes, but you won't be able to manually delete mail by clicking "Delete Mail" button.

## Key Features

- Receive email
- View Inbox
- View/Download Attachments
- Real-time updates via WebSockets
- Email tracking (Open / Link Click) prevention

## Project Structure

- [Client](client) - All things about Client Application, which is React App currently
- [Server](server) - All things about Server Application, which are Lambda handlers and contain business logic.
- [Infra](infra) - All things about IaC

## API Documentation

OpenAPI based Documentation is available:

http://petstore.swagger.io/?url=https%3A%2F%2Fapi.poo.email%2Fapi%2Fdocs

## Deployment Guide

See [infra/README.md](infra/README.md)

## Infrastructure Diagrams

#### Server

![Server Infrastructure Diagram](assets/infra-server.png)

#### Client

![Client Infrastructure Diagram](assets/infra-client.png)

## Dirty Sketches

![System Design](assets/system-design.png)

![Logic Diagram](assets/logic-diagram.png)

![UI Design](assets/ui-design.png)

## Related

- [aws-cdk-ses-domain-identity](https://github.com/mooyoul/aws-cdk-ses-domain-identity) - Constructs for provisioning and referencing domain identities which can be used in SES RuleSets and Actions Construct.

## License
[MIT](LICENSE)

See full license on [mooyoul.mit-license.org](http://mooyoul.mit-license.org/)

license: MIT


text:
# VI-Explorer-VI

this is a lowlevel LabView-File-Format reader/writer "written" in LabView.

Features:
* open .vi file [version 4 up to 2016] and read main file structure
* decompress blocks
* calculate/overwrite file password
* read version information [vers-block]
* read password information [BDPW-block]
* save .vi file

![project](images/project.png)
![screen](images/screen.png)

gha_license_id: MIT


text:
---
layout: post
title: "When your loop unroller works harder than your infinite loop detector"
date: 2021-02-26 00:01:00 +0000
tags:
  cpplang-slack
  memes
---

![](/blog/images/2021-02-26-optimizd.png){: .meme}

----

Hat tip to Lénárd Szolnoki for accidentally working this into an unrelated
Godbolt (by reusing the name `foo` for both the caller-of-the-interesting-bit
and the callee-of-the-interesting-bit). I was _thoroughly_ confused for a
minute there.

By the way, the "stonks" meme template is from
[/r/MemeTemplateOfficial](https://www.reddit.com/r/MemeTemplatesOfficial/comments/dw6oy1/stonk_meme_template_but_without_the_text/).
Because I just know I'm going to keep finding reasons to use it.

Previously on this blog:

* ["threds"](/blog/2020/12/03/threds/) (2020-12-03)

repository: Quuxplusone/blog

repo_name: Quuxplusone/blog


text:
# Resource Limits

```
fs.file-max = 2097152
```

Above setting is specified for system-wide configuration. For user, there's a configure item in `/etc/security/limits.conf` named `nofile`, which means max number of open file descriptors.

`prlimit` and `ulimit` can be used to inspect the limit:

```
ulimit -<H|S>n
```
or

```
prlimit -n
```

## Resource Limits Tweak
**`ulimit`** provides control over resources available to each user via a shell. You can type `ulimit -a` to get a list of all current settings. In parentheses you will see one or two items: the units in measurements (e.g. kbytes, blocks, seconds) as well as a letter option (e.g. -s, -t, -u). The letter option will let you view/edit one particular setting at a time.

```
[root@dns will]# ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 7823
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 7823
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
```

* `ulimit -S -a` view all soft limits
* `ulimit -H -a` view all hard limits
* `ulimit -S [option] [number]` set a specific soft limit for one variable
e.g. ulimit -S -s 8192 set a new soft stacksize limit, “-s” is for stack
* `ulimit -H [option] [number]` set a specific hard limit for one variable
e.g. ulimit -H -s 8192 set a new hardstacksize limit, “-s” is for stack
* `/etc/security/limits.conf` file where you can set soft and hard limits per user or for everyone
e.g. Add in the following to <code>/etc/security/limits.conf</code> will set a soft stacksize of 8192 adn a hard stacksize of unlimited for username “toor”:

	```
	toor soft stack 8192
	toor hard stack unlimited
	```

**limit type**
>**hard**
>
for enforcing hard resource limits. These limits are set by the superuser and enforced by the Kernel. The user cannot raise his requirement of system resources above such values.
>
>**soft**
>
for enforcing soft resource limits. These limits are ones that the user can move up or down within the permitted range by any pre-existing hard limits. The values specified with this token can be thought of as default values, for normal system usage.
>
>from `limits.conf(5)`

## SEE ALSO
`getrlimit(2)`, `setrlimit(2)`

repository: misc-proj/perf-tuning

repo_name: misc-proj/perf-tuning


text:
This bug in gnulib was recently found using AFL against the coreutils date program.

Check out the date manpage - it takes input from the command line, date syscall, environment variables, and optionally files.

Here we want to fuzz an environment variable - refer to the manpage to identify it.

The basic process for compiling date with afl is familiar. Be sure to checkout the specified version or earlier.

	$ git submodule init && git submodule update
	$ sudo apt install autopoint bison gperf autoconf # already installed in the container environment
	$ ./bootstrap
	$ <CC=...> ./configure
	$ <any AFL compile options> make -j

	$ ./src/date
	Mon Jul  3 08:11:23 PDT 2017

repository: fuzzamos/afl-training

gha_language: C

repo_name: fuzzamos/afl-training


text:
---
layout: default
parent: Utility functions
---

# using

Can be used on any `IDisposable` objects. Will call `IDisposable.dispose()` when the scope ends.

DO NOT USE ON PROMISES!!! use `usingAsync` instead.

### using<T extends IDisposable, TResult>(disposableObjectFactory: () => T, inner: (disposableObject: T) => TResult): TResult

> Creates a disposable object then cleans it up after inner has finished execution.

```js
using(() => new ConsoleLogger(), (logger) => logger.debug('Hello world!'));
```

repository: michaelcoxon/utilities

gha_language: TypeScript

repo_name: michaelcoxon/utilities


text:
# message-parser

Enables sorting and grouping of users and channel mentions in a message.

## Getting started

### Installing

- ``npm install @thoughtsunificator/message-parser``

### Usage

```javascript
const message = Parser.parse("Hello @dsadsadas come join us in #dsadsa")
```

repository: thoughtsunificator/message-parser

gha_language: JavaScript

repo_name: thoughtsunificator/message-parser


text:
# Budget-Tracker

[![License: MIT](https://img.shields.io/apm/l/atomic-design-ui.svg?)](https://github.com/tterb/atomic-design-ui/blob/master/LICENSEs)

This application tracks withdrawals and deposits from a set budget with or without a data/internet connection.

## Table of Contents

- [Installation](#Installation)
- [Usage](#Usage)
- [License](#License)
- [Contributing](#Contributing)
- [Tests](#Testing)
- [Questions](#Questions)
- [Links](#Links)

## Installation

Visit the application with [this](https://rocky-garden-31416.herokuapp.com/) deployed heroku link.

## Usage

With this application, you can track every and any expense that you'd like that displays beautifully on a graph. Add funds and subtract funds to your document with the corresponding buttons and watch the graph update. This application works even offline when you don't have a reliable internet connection. As soon as your application is online again, a bulk POST request is sent to a MongoDB server to update all of your offline transactions.

![Last Workout](/screenshots/budget-tracker-screenshot.PNG?raw=true "workout tracker last workout summary")

## License

This project is covered under the **MIT** license -- see more info [here](https://opensource.org/licenses/MIT).

## Contributing

Create a new branch and do a pull request, pending review.

## Questions

- GitHub: [jfrausto](https://github.com/jfrausto)
- If you have any further questions, you can reach me at<EMAIL_ADDRESS>
## Links

- [Deployed app](https://rocky-garden-31416.herokuapp.com/)

repository: jfrausto/Budget-Tracker

branch_name: refs/heads/main

repo_name: jfrausto/Budget-Tracker


text:
# Digital Covid Certificate Lib (DccLib)

DccLib is a TypeScript library that decodes and verifies the European Digital Covid Certificate (Eudcc) in modern web
browsers. For now, the library has only been tested in Firefox with the Swiss Covid Certificate. In theory, the library
should also be compatible with DCCs from other countries as long as they follow the [Eudcc specification] and the provided
singing keys are valid.

This work is primarily intended for educational purposes. In fact, the project was part of an internal hackathon at
the University of Basel.

- [TsDocs]
- [Demo]
  - The demo is not very user-friendly... Sorry for that, but have a look at the console to interact directly with your
    certificate.
- Example Projects
  - [jswebpack] is a sample project using JavaScript and Webpack.
  - [tsreact]  is a sample project using TypeScript and React.

## List of all features:

- decode the Eudcc
  - [Base45Decoder]
  - [ZlibDecoder]
  - [CborDecoder]
  - [CoseDecoder]
- dereference the EU eHealthNetwork Digitial Covid Certificate [value sets]
- load and verify the DCC Signing Keys from a JSON Web Token (JWT)
- verify a x509 Certificate Trust Chain
- verify a DCC

## Installation

```
npm i digital-covid-certificate-lib
```

## Examples

The following two examples show how to decode and verify the validity of a DCC.

### Example 1

- Stepwise decode a DCC
- Access some sample properties from a Eudcc instance
- Load the DCC keys from a JWT
- Verify the DCC key JWT signature and the certificate chain
- Verify the DCC

```typescript
import {
  Base45Decoder,
  CborDecoder, ChKeyStore,
  CoseDecoder,
  DccBase45,
  Jwt,
  Verifier,
  ZlibDecoder,
  CH_KEYS_UPDATE_LIST_JWT, CH_ROOT_CERTIFICATE
} from "digital-covid-certificate-lib";

const validVaccinationCert = "HC1:NCFK60DG0/3WUWGSLKH47GO0Y%5S.PK%96L79CK-500XK0JCV496F3PYJ-982F3:OR2B8Y50.FK6ZK7:EDOLOPCO8F6%E3.DA%EOPC1G72A6YM86G7/F6/G80X6H%6946746T%6C46/96SF60R6FN8UPC0JCZ69FVCPD0LVC6JD846Y96C463W5307+EDG8F3I80/D6$CBECSUER:C2$NS346$C2%E9VC- CSUE145GB8JA5B$D% D3IA4W5646646-96:96.JCP9EJY8L/5M/5546.96SF63KC.SC4KCD3DX47B46IL6646H*6Z/ER2DD46JH8946JPCT3E5JDLA7$Q69464W51S6..DX%DZJC2/DYOA$$E5$C JC3/D9Z95LEZED1ECW.C8WE2OA3ZAGY8MPCG/DU2DRB8MTA8+9$PC5$CUZC$$5Y$5FBB*10GBH A81QK UV-$SOGD1APAB4$5UV C-EWB4T*6H%QV/DAP9L7J3Y4O/WVI5IW3672HO-HV16IW3JHV-FI%WJCPBI8QTE008I+FPR01MYFA6EBN2SR3H+4KH1M9RCIM2 VV15REG 516N93SS70RBUCH-RJM2JMULZ6*/HBBW7W7:S2BU7T6PRTMF4ALUNEXH3P7 LE0YF0TGE461PBK9TD68HDIT4AIFD9NH14V%GBCONJOV$KN  C+3U-IT$SE-A2V+9UO9WYRJ4HN+M/Z5W$QEDT/8C:88OQ4DXOBBIQ453863NPW0EJXG8$GH1T 38C*UI6T /FCDC%6VLNOA6W6BEYJJUH2Z-SOJO1D7JMALD8 $1%5B.GH$7AQOHZ:K3BNO1"
const dccBase45 = new DccBase45(validVaccinationCert)
const dccZlib = Base45Decoder.decode(dccBase45)
const dccCbor = ZlibDecoder.decode(dccZlib);
const dccCose = CborDecoder.decode(dccCbor)
const eudcc = CoseDecoder.decode(dccCose)

console.log(eudcc.person.familyName)
console.log(eudcc.person.dateOfBirth)

if (eudcc instanceof VaccinationCertificate) {
  console.log(eudcc.infromation.vaccinationCountry)
} else if (eudcc instanceof TestCertificate) {
  console.log(eudcc.infromation.testResult)
} else if (eudcc instanceof RecoveryCertificate) {
  console.log(eudcc.infromation.firstPositiveTestDate)
}

const keystore = new ChKeyStore()
await keystore.loadKeys(
        {
          jwt: new Jwt(CH_KEYS_UPDATE_LIST_JWT),
          verifySignature: true,
          rootCertificate: CH_ROOT_CERTIFICATE
        }
)

const kId = dccCose.getSignedHeaderAsJson().kid
const publicKey = await keystore.getKey(kId)
const valid = await Verifier.verify(publicKey,
        {
          name: "RSA-PSS",
          saltLength: 32,
        },
        dccCose
)
```

### Example 2

- Create a chain decoder
- Load the DCC keys from JWT
- Verify the DCC

```typescript
// same imports as for example 1

const validVaccinationCert = "HC1:NCFK60DG0/3WUWGSLKH47GO0Y%5S.PK%96L79CK-500XK0JCV496F3PYJ-982F3:OR2B8Y50.FK6ZK7:EDOLOPCO8F6%E3.DA%EOPC1G72A6YM86G7/F6/G80X6H%6946746T%6C46/96SF60R6FN8UPC0JCZ69FVCPD0LVC6JD846Y96C463W5307+EDG8F3I80/D6$CBECSUER:C2$NS346$C2%E9VC- CSUE145GB8JA5B$D% D3IA4W5646646-96:96.JCP9EJY8L/5M/5546.96SF63KC.SC4KCD3DX47B46IL6646H*6Z/ER2DD46JH8946JPCT3E5JDLA7$Q69464W51S6..DX%DZJC2/DYOA$$E5$C JC3/D9Z95LEZED1ECW.C8WE2OA3ZAGY8MPCG/DU2DRB8MTA8+9$PC5$CUZC$$5Y$5FBB*10GBH A81QK UV-$SOGD1APAB4$5UV C-EWB4T*6H%QV/DAP9L7J3Y4O/WVI5IW3672HO-HV16IW3JHV-FI%WJCPBI8QTE008I+FPR01MYFA6EBN2SR3H+4KH1M9RCIM2 VV15REG 516N93SS70RBUCH-RJM2JMULZ6*/HBBW7W7:S2BU7T6PRTMF4ALUNEXH3P7 LE0YF0TGE461PBK9TD68HDIT4AIFD9NH14V%GBCONJOV$KN  C+3U-IT$SE-A2V+9UO9WYRJ4HN+M/Z5W$QEDT/8C:88OQ4DXOBBIQ453863NPW0EJXG8$GH1T 38C*UI6T /FCDC%6VLNOA6W6BEYJJUH2Z-SOJO1D7JMALD8 $1%5B.GH$7AQOHZ:K3BNO1"

const coseChainDecoder = (cert: string) => CborDecoder.decode(ZlibDecoder.decode(Base45Decoder.decode(new DccBase45(cert))))
const dccCose = coseChainDecoder(validVaccinationCert)

const keystore = new ChKeyStore()
await keystore.loadKeys(
        {
          jwt: new Jwt(CH_KEYS_UPDATE_LIST_JWT),
          verifySignature: false,
        }
)

const kId = dccCose.getSignedHeaderAsJson().kid
const publicKey = await keystore.getKey(kId)
const valid = await Verifier.verify(publicKey,
        {
          name: "RSA-PSS",
          saltLength: 32,
        },
        dccCose
)
```

[TsDocs]: https://fuubi.github.io/digital-covid-certificate-lib/

[Demo]: https://fuubi.github.io/digital-covid-certificate-lib/demo

[jswebpack]: https://github.com/FUUbi/digitalcovidcertificatelib/tree/main/examples/jswebpack

[tsreact]: https://github.com/FUUbi/digitalcovidcertificatelib/tree/main/examples/tsreact

[Base45Decoder]: https://github.com/FUUbi/digitalcovidcertificatelib/tree/main/src/decoder/Base45Decoder.ts

[ZlibDecoder]: https://github.com/FUUbi/digitalcovidcertificatelib/tree/main/src/decoder/ZlibDecoder.ts

[CborDecoder]: https://github.com/FUUbi/digitalcovidcertificatelib/tree/main/src/decoder/CborDecoder.ts

[CoseDecoder]: https://github.com/FUUbi/digitalcovidcertificatelib/tree/main/src/decoder/CoseDecoder.ts

[valuesets]: https://github.com/ehndccdevelopment/ehndccvaluesets

[Eudcc specification]: https://github.com/ehn-dcc-development/hcert-spec


text:
pouchdb-system-db
=================

Protects PouchDB system databases by wrapping their methods. Written to
be used for (and developed alongside) PouchDB plug-ins.

[Website of those plug-ins](http://python-pouchdb.marten-de-vries.nl/plugins.html)

repository: waharnum/dictionary-prototype-kettle

repo_name: waharnum/dictionary-prototype-kettle


text:
# Absolute Encoder Demo

Demonstrating the use of an Absolute Contacting Encoder over I2C with an Arduino

This Arduino sketch shows a method of decoding a Bournes EAW - Absolute Contacting Encoder (ACE) - EAW0J-B24-AE0128L, a rotary encoder switch that provides an 8-bit code with 128 absolute states to your microcontroller of choice.

In this case I have used an MCP23017 I2C 16 bit IO expander to send the code to an Ardunio compatible Teensy which then sends the received binary code back to the IO expander to light a row of LED's and also show information on an attached I2C SSD1306 OLED display. The code also determines which way the encoder has been turned.

Circuit diagram:
<img src="https://github.com/kazzle101/absolute_encoder_demo/blob/master/absolute_encoder_demo_s.png">


text:
---
layout: page
title: Contributing to Express
menu: resources
lang: en
redirect_from: "/resources/community.html"
---

# Contributing to Express

Express and the other projects in the [expressjs organization on GitHub](https://github.com/expressjs) are projects of the [Node.js Foundation](https://nodejs.org/foundation/).
These projects are governed under the general policies and guidelines of the Node.js Foundation along with the additional guidelines below.

- [Technical committee](#technical-committee)
- [Community contributing guide](#community-contributing-guide)
- [Collaborator's guide](#collaborators-guide)
- [Security policies and procedures](#security-policies-and-procedures)

## Technical committee

The Express technical committee consists of active project members, and guides development and maintenance of the Express project. For more information, see [Express Community - Technical committee](community.html#technical-committee).

## Community contributing guide

<!-- SRC: https://raw.githubusercontent.com/expressjs/express/master/Contributing.md -->

The goal of this document is to create a contribution process that:

- Encourages new contributions.
- Encourages contributors to remain involved.
- Avoids unnecessary processes and bureaucracy whenever possible.
- Creates a transparent decision making process that makes it clear how
  contributors can be involved in decision making.

### Vocabulary

- A **Contributor** is any individual creating or commenting on an issue or pull request.
- A **Committer** is a subset of contributors who have been given write access to the repository.
- A **TC (Technical Committee)** is a group of committers representing the required technical
  expertise to resolve rare disputes.
- A **Triager** is a subset of contributors who have been given triage access to the repository.

### Logging Issues

Log an issue for any question or problem you might have. When in doubt, log an issue, and
any additional policies about what to include will be provided in the responses. The only
exception is security disclosures which should be sent privately.

Committers may direct you to another repository, ask for additional clarifications, and
add appropriate metadata before the issue is addressed.

Please be courteous and respectful. Every participant is expected to follow the
project's Code of Conduct.

### Contributions

Any change to resources in this repository must be through pull requests. This applies to all changes
to documentation, code, binary files, etc. Even long term committers and TC members must use
pull requests.

No pull request can be merged without being reviewed.

For non-trivial contributions, pull requests should sit for at least 36 hours to ensure that
contributors in other timezones have time to review. Consideration should also be given to
weekends and other holiday periods to ensure active committers all have reasonable time to
become involved in the discussion and review process if they wish.

The default for each contribution is that it is accepted once no committer has an objection.
During a review, committers may also request that a specific contributor who is most versed in a
particular area gives a "LGTM" before the PR can be merged. There is no additional "sign off"
process for contributions to land. Once all issues brought by committers are addressed it can
be landed by any committer.

In the case of an objection being raised in a pull request by another committer, all involved
committers should seek to arrive at a consensus by way of addressing concerns being expressed
by discussion, compromise on the proposed change, or withdrawal of the proposed change.

If a contribution is controversial and committers cannot agree about how to get it to land
or if it should land then it should be escalated to the TC. TC members should regularly
discuss pending contributions in order to find a resolution. It is expected that only a
small minority of issues be brought to the TC for resolution and that discussion and
compromise among committers be the default resolution mechanism.

### Becoming a Triager

Anyone can become a triager! Read more about the process of being a triager in
[the triage process document](Triager-Guide.md).

[Open an issue in `expressjs/express` repo](https://github.com/expressjs/express/issues/new)
to request the triage role. State that you have read and agree to the
[Code of Conduct](Code-Of-Conduct.md) and details of the role.

Here is an example issue content you can copy and paste:

```
Title: Request triager role for <your GitHub username>

I have read and understood the project's Code of Conduct.
I also have read and understood the process and best practices around Express triaging.

I request for a triager role for the following GitHub organizations:

jshttp
pillarjs
express
```

Once you have opened your issue, a member of the TC will add you to the `triage` team in
the organizations requested. They will then close the issue.

Happy triaging!

### Becoming a Committer

All contributors who land a non-trivial contribution should be on-boarded in a timely manner,
and added as a committer, and be given write access to the repository.

Committers are expected to follow this policy and continue to send pull requests, go through
proper review, and have other committers merge their pull requests.

### TC Process

The TC uses a "consensus seeking" process for issues that are escalated to the TC.
The group tries to find a resolution that has no open objections among TC members.
If a consensus cannot be reached that has no objections then a majority wins vote
is called. It is also expected that the majority of decisions made by the TC are via
a consensus seeking process and that voting is only used as a last-resort.

Resolution may involve returning the issue to committers with suggestions on how to
move forward towards a consensus. It is not expected that a meeting of the TC
will resolve all issues on its agenda during that meeting and may prefer to continue
the discussion happening among the committers.

Members can be added to the TC at any time. Any committer can nominate another committer
to the TC and the TC uses its standard consensus seeking process to evaluate whether or
not to add this new member. Members who do not participate consistently at the level of
a majority of the other members are expected to resign.

## Collaborator's guide

<!-- SRC: https://raw.githubusercontent.com/expressjs/express/master/Collaborator-Guide.md -->

### Website Issues

Open issues for the expressjs.com website in https://github.com/expressjs/expressjs.com.

### PRs and Code contributions

- Tests must pass.
- Follow the [JavaScript Standard Style](http://standardjs.com/) and `npm run lint`.
- If you fix a bug, add a test.

### Branches

Use the `master` branch for bug fixes or minor work that is intended for the
current release stream.

Use the correspondingly named branch, e.g. `5.0`, for anything intended for
a future release of Express.

### Steps for contributing

1. [Create an issue](https://github.com/expressjs/express/issues/new) for the
   bug you want to fix or the feature that you want to add.
2.
3. Write your code in your local copy. It's good practice to create a branch for
   each new issue you work on, although not compulsory.
4. To run the test suite, first install the dependencies by running `npm install`,
   then run `npm test`.
5. Ensure your code is linted by running `npm run lint` -- fix any issue you
   see listed.
6. If the tests pass, you can commit your changes to your fork and then create
   a pull request from there. Make sure to reference your issue from the pull
   request comments by including the issue number e.g. `#123`.

### Issues which are questions

We will typically close any vague issues or questions that are specific to some
app you are writing. Please double check the docs and other references before
being trigger happy with posting a question issue.

Things that will help get your question issue looked at:

- Full and runnable JS code.
- Clear description of the problem or unexpected behavior.
- Clear description of the expected result.
- Steps you have taken to debug it yourself.

If you post a question and do not outline the above items or make it easy for
us to understand and reproduce your issue, it will be closed.

## Security Policies and Procedures

<!-- SRC: https://raw.githubusercontent.com/expressjs/express/master/Security.md -->

This document outlines security procedures and general policies for the Express
project.

- [Reporting a Bug](#reporting-a-bug)
- [Disclosure Policy](#disclosure-policy)
- [Comments on this Policy](#comments-on-this-policy)

### Reporting a Bug

The Express team and community take all security bugs in Express seriously.
Thank you for improving the security of Express. We appreciate your efforts and
responsible disclosure and will make every effort to acknowledge your
contributions.

Report security bugs by emailing the lead maintainer in the Readme.md file.

The lead maintainer will acknowledge your email within 48 hours, and will send a
more detailed response within 48 hours indicating the next steps in handling
your report. After the initial reply to your report, the security team will
endeavor to keep you informed of the progress towards a fix and full
announcement, and may ask for additional information or guidance.

Report security bugs in third-party modules to the person or team maintaining
the module. You can also report a vulnerability through the
[Node Security Project](https://nodesecurity.io/report).

### Disclosure Policy

When the security team receives a security bug report, they will assign it to a
primary handler. This person will coordinate the fix and release process,
involving the following steps:

- Confirm the problem and determine the affected versions.
- Audit code to find any potential similar problems.
- Prepare fixes for all releases still under maintenance. These fixes will be
  released as fast as possible to npm.

### Comments on this Policy

If you have suggestions on how this process could be improved please submit a
pull request.


text:
# X2-Switch

Modified SmartSense (PEQ) Open/Closed Sensor to behave like TWO x 3-WAY on/off toggle switches
   Requires this device type linked to X2-Switch: Modded 2-Switch App
   Copyright 2015 - Joel Goldwein
   Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
   in compliance with the License. You may obtain a copy of the License at:

    http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
   on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
   for the specific language governing permissions and limitations under the License.

  This Device Type uses a single modified (hacked) SmartSense door open/close sensor wired to both an SPDT (3-way)
  switch and a standard SPST wall switch, each of whicn can toggle on and off a set of GE Link Lights or similar
  lights or switches.

  The intent is to have a simple and inexpensive battery operated replacement for a standard wall switch to
  operate multiple, 3-way zigbee or zwave lights or switches as well as a one way light or switch using two
  separate standard switches in an existing gang-box.

  The SmartSense (PEQ) sensor has been on sale intermittently at Best Buy for under $20, and a 3-way SPDT plus a
  standard wall switch costs a few dollars at any hardware store, so you can put the whole thing together for
  about $25.00.

  The SmartSense door open/close sensor can be easily modded and wired to the 3-way wall switch and the standard
  wall switch as follows:

    1. Replace (desolder) the reed relay with 3 wires connected to a 3-way wall switch.
    2. Replace (desolder) the small push button switch with 2 wires connected to a standard on/off wall switch.
    3. Provision the "Thing" (make sure you put the standard switch into OFF mode since ON mode at battery installation
       causes it to reset), and replace the device type with:
       "X2-Switch: Modded SmartSense Open/Closed Sensor/Switch: TWO Switch Version"
    4. In selected gang box, have a certified electrician wire the GE link lights that will be used to remain ON
       by removing the existing switches and tying together the now hanging On-Off wires.
       Cap any "red" wires or otherwise exposed wires.
    5. Install the new switches and Thing into the gang box or a new gang box (use standard electrical safety measures).
    6. Use the "X2-Switch Control: 2-Switch Control for Modded SmartSense Open/Closed Sensor/Switch for Multiple Lights"
       App to control the lights


text:
---
title: ItemCheck
page_title: ItemCheck - RadListBox
description: Check our Web Forms article about ItemCheck.
slug: listbox/server-side-programming/server-events/itemcheck
tags: itemcheck
published: True
position: 9
---

# ItemCheck

##

The **ItemCheck** event fires after a user checks or unchecks an item's checkbox. To fire automatically the **AutoPostBack** property should be set to True.

The event handler receives two parameters:

1. The instance of the listbox firing the event

2. An event arguments parameter containing the following property:

* **Item** - the RadListBoxItem object that has just been checked/unchecked

````C#
protected void RadListBox1_ItemCheck(object sender, RadListBoxItemEventArgs e)
{
	Label.Text = e.Item.Text;
}
````
````VB.NET
Protected Sub RadListBox1_ItemCheck(sender As Object, e As RadListBoxItemEventArgs)
	Label.Text = e.Item.Text
End Sub
````

repository: telerik/ajax-docs

gha_language: C#

repo_name: telerik/ajax-docs


text:
---
layout: project
type: project
image: images/addressbook.jpg
title: AddressBook
permalink: projects/addressbook
date: 2016
labels:
  - C
  - C++
  - Java
summary: An addressbook that I created as ICS 212 course project in 2016
---

<img class="ui medium right floated rounded image" src="../images/result.jpg">

This is an address book program that I made in ICS 212. C and unix environment were used since the course was conducted to use C and SSH UH Unix. The program itself is simple, it prompts users to add, print, modify, print all, delete, and clean up the records. Makefile using SCCS was used to preserve and combine all the source codes to create executable file.

Address book program is probably sounded familiar for many ICS, CS, or CE student as assignments or projects. It might see as simple coding project but with a new environment, not eclipse but SSH Unix with a new language, it made the project really challenging for me. Coding with C in Unix environment was a whole new experience. While Java does all the compilation, compiling and linking and all the processes were had to be done manually. Also the concept of pointer, which can be very useful or could become the reason for hating C, came to me as big challenge too.

However, through this project, I was able to see the potentials of C and learned how to use new language and the concept of pointers, SCCS, compiling, and linking.


text:
# feathers-graph-populate

Add lightning fast, GraphQL-like populates to your FeathersJS API.

This project is built for [FeathersJS](http://feathersjs.com). An open source web framework for building modern real-time applications.

## Getting Started

### Define your relationships

```js
const populates = {
  orgMemberships: {
    service: 'org-users',
    nameAs: 'orgMemberships',
    keyHere: '_id',
    keyThere: 'userId',
    asArray: true,
    params: {}
  },
  groupMemberships: {
    service: 'group-users',
    nameAs: 'groupMemberships',
    keyHere: '_id',
    keyThere: 'userId',
    asArray: true,
    params: {}
  },
  posts: {
    service: 'posts',
    nameAs: 'posts',
    keyHere: '_id',
    keyThere: 'authorId',
    asArray: true,
    params: {}
  },
  comments: {
    service: 'comments',
    nameAs: 'comments',
    keyHere: '_id',
    keyThere: 'userId',
    asArray: true,
    params: {}
  },
  tasks: {
    service: 'tasks',
    nameAs: 'tasks',
    keyHere: '_id',
    keyThere: 'ownerIds',
    asArray: true,
    params: {}
  }
}
```

### Create named queries to use from connected clients.

```js
const namedQueries = {
  withPosts: {
    posts: {}
  },
  postsWithComments: {
    posts: {
      comments: {}
    }
  },
  postsWithCommentsWithUser: {
    posts: {
      comments: {
        user:{}
      }
    }
  }
}
```

### Register the hook

```js
const { populate } = require('feathers-graph-populate')

const hooks = {
  after: {
    all: [
      populate({ populates, namedQueries })
    ]
  }
}
```

### Perform Queries

Use a named query from a connected client:

```js
feathersClient.service('users').find({
  query: {},
  $populateParams: {
    name: 'postsWithCommentsWithUser'
  }
})
```

Use a query object for internal requests. (named queries also work, internally):

```js
app.service('users').find({
  query: {},
  $populateParams: {
    query: {
      posts: {
        comments: {
          user:{}
        }
      }
    }
  }
})
```

### Handling Custom Client-Side Params

Since FeathersJS only supports passing `params.query` from client to server, by default, we need to let it know about the new `$populateParams` object.  We can do this using the `paramsForServer` and `paramsFromCLient` hooks:

```js
const { paramsForServer } = require('feathers-graph-populate')

feathersClient.hooks({
  before: {
    all: [
      paramsForServer('$populateParams')
    ]
  }
})
```

Now to allow the API server to receive the custom param:

```js
const { paramsFromClient } = require('feathers-graph-populate')

feathersClient.hooks({
  before: {
    all: [
      paramsFromClient('$populateParams')
    ]
  }
})
```

## Testing

Simply run `npm test` and all your tests in the `test/` directory will be run.

## Help

For more information on all the things you can do, visit [the generator](https://generator.feathers-plus.com/), [FeathersJS](http://docs.feathersjs.com) and [extensions](https://feathers-plus.github.io/).

## License

Licensed under the [MIT license](LICENSE).

repository: Bomberus/feathers-graph-populate

repo_name: Bomberus/feathers-graph-populate


text:
# IMPORTANT
Before reading this file please setup the Web App following the README.md file.

## To do initial data entry

- Login to [Django admin](http://<IP_ADDRESS>:8000/admin/) as a superuser (you created it by running `python manage.py createsuperuser` (see README.md).

### Follow the following sequence to avoid inconsistency.

- Add some Admin Users (i.e. dept. chairman, office, provost etc.)
- Add some Courses.
- Add some Departments.
- Add some Semesters.
- Add some Halls.

For your convenience we have created some sample data. To use the sample data rename the `db.sqlite3.sample` (in `website` folder) to `db.sqlite3` (override if exists).

### Superuser:
username: `admin`, password: `1234`

### Admin Users

username: `cse-chairman`, password: `1234`

username: `cse-office`, password: `1234`

username: `abdurrab-provost`, password: `1234`

username: `pritilata-provost`, password: `1234`

username: `accounts`, password: `1234`

username: `bank`, password: `1234`

Moreover, we have added 57 students in 7th Semester of CSE Department.

# Workflow (sequence must be followed)

(User must be logged in as a valid Admin User using Administrative Login from the Homepage).

(Students need to login using Student Login from the Homepage).

- Department Office will add new students.
- Department chairman will create exam.
- Student will apply for the exam.
- Department office will fill the attendance for each form. (After expiring last date of form fillup. To simulate it immediately you have to edit the exam from Django Admin Panel as super user, by setting the `ldo_form_fillup` to a past date).
- Accounts will impose fees and set the last date of payment.
- Hall Provost will approve the forms.
- Bank will confirm the payment. (Clicking the Cross icon in `Paid` column.)
- Student will download the admit card.
- Chairman will see the list of Students completed the payment.


text:
---
title: How to remove the HP TouchSmart IQ780a case
layout: post
permalink: /misc/remove-the-hp-touchsmart-iq780a-case/
categories:
  - Misc
---
  1. Face the back of the computer towards you.
  2. **Removed** the **screw** above the power port
  3. **Removed** the **screw** right next to the IR Out
  4. **Hold** the side **casing** of the computer and **slide** it towards **you**
  5. You have now removed the casing and can access the Power Supply/DVD Drive etc.

gha_language: SCSS


text:
# Prototype Calculator

Building a simple Calculator to demonstrate Angular2 features and development process.

## Explanation of approach

The spec seemed to indicate a form like approach with two input's and a operation selection. This isn't how a normal calculator works so by including precedence in each of the operations
it should be possible to extend the application to parse a single text input and out put correct results. I am assuming this is outside the scope.

The spec explicitly said its not required to insert thousand separators this could be done using a pipe.

Component testing could have been more through but I couldn't get my numericInput control to hold/display the values inside the test runner. Which made it impossible to test the elements properly.

## Prerequisites
Node.js v4 and npm v3.

## Install npm packages

> See npm and nvm version notes above

Install the npm packages described in the `package.json` and verify that it works:

```shell
npm install
npm test
```

To run the application use:

```shell
npm start
```

repository: rodhoward/e-centricCalc-angular

repo_name: rodhoward/e-centricCalc-angular


text:
## murp - what is it?

![murp](http://ploe.co.uk/murp-logo.gif)

murp is a JSON lexer. It isn't a parser because I believe that you, the programmer, should be in charge of your heap. It presents a simple interface called Atomize, which you drop your parse function in to.

If you're wanting to keep state there's an interface called Probe which works like Atomize but lets you drop an object in too. Any object... This is C after all.

You'll notice that serialization has been distinctly left out. That's because you know the shape of your data and where it needs to be put and I don't. STDOUT, a file, a string somewhere? In the interest of keeping the API lean I've left you to roll your own...

It is loosely based on the pattern for a lexer put forward in the video "[Lexical Scanning in Go](http://blog.golang.org/two-go-talks-lexical-scanning-in-go-and)" by Rob Pike.

It is called murp because I don't like what makes the JS in JSON and wanted to distance myself from it. It also means that if I want to I can deviate from the RFC's. I'm aiming to be compliant though. murp is the sound you make when you try to think of a name for your JSON lexer, and fail...

## Static Libraries

   - [Linux - Debian 64bit (1.0)](http://ploe.co.uk/libmurp-debian64.zip)
   - [Mac OS X (1.0)](http://ploe.co.uk/libmurp-osx.zip)

## The API

murp is a lexer. This means that unlike JSON parsers it does not allocate memory for the JSON data it unmarshals. My reason for this is that in C you're likely to want to define the shape of your own data and allocate it, so you won't want me taking my time and filling up your RAM with my own kind of weird data. It's best I just leave that bit to you, don't you think?

To unmarshal a JSON structure in murp there are four functions you can use:

```c
mp_Atomizer mp_Atomize(char *src, mp_Atomizer (*callback)(mp_Atom, void *));
mp_Atomizer mp_AtomizeSlice(mp_Slice *src, mp_Atomizer (*callback)(mp_Atom, void *));

mp_Atomizer mp_Probe(char *src, mp_Atomizer (*callback)(mp_Atom, void *), void *);
mp_Atomizer mp_ProbeSlice(mp_Slice *src, mp_Atomizer (*callback)(mp_Atom, void *), void *probe);
```

**mp_Atomize** is the simplest of the four. It takes a JSON object or array as its *src* and a *callback* function which we call an **mp_Atomizer**

```c
mp_Atomize(json, print_atom);
```

murp will then ensue to deserialize the elements in your JSON Object or Array.  It does this by setting the attributes on a struct called **mp_Atom**

```c
typedef struct {
	mp_Datatype type, container;
	mp_Slice key, value;
} mp_Atom;
```

First it identifies the sort of JSON structure we're unmarshalling. This is what container gets set to. It can be one of these three values.

```c
	mp_OBJECT,
	mp_ARRAY,
```

Next it moves on to unmarshalling the elements. If the *container* is an **mp_OBJECT** it will first look for a *key* (as JSON Objects are structures containing key-value pairs e.g. '{"name":"murp"}') If a key is successfully identified we set *key* on the **mp_Atom** to it. *key* is a type called **mp_Slice**

```c
typedef struct {
	char *start;
	unsigned int len;
} mp_Slice;

```

An **mp_Slice** defines a subset of your *src* string. *start* is a pointer to where the substring starts and *len* is the amount of characters until it ends i.e. its length. So *key.start* gets set to the start of the key, just after the opening quotation mark (**"**) and *key.len* gets set to the length, which is after the last character before the closing quotation mark.

If the *container* is an **mp_ARRAY** the *key* slice doesn't get set (this is because JSON Arrays are an ordered list of values e.g. [1,2,3,"myke",true,"etc"])

If the structure is somehow malformed and we can't identify it murp sets the *type* of the **mp_Atom** to the error code **mp_EOSTRUCT** - we will cover error codes in a moment.

Now we identify the *value* of the element and its *type*.

*value* is another **mp_Slice** - this is the value of the element in the JSON structure.

*type* will be one of the usual JSON types which are the following values in murp.

```c
	mp_NOTSET,
	mp_NULL,
	mp_STRING,
	mp_NUMBER,
	mp_BOOLEAN,
	mp_OBJECT,
	mp_ARRAY
```

There are also a bunch of error codes that the type can be set to if murp gets some invalid data. If murp encounters an error code it will stop trying to parse the string.

```c
	mp_DONE,
	mp_EOSTRUCT,
	mp_EOKEY,
	mp_EOVALUE,
```

   - **mp_DONE** is set when we reached the end of parsing cleanly.
   - **mp_EOSTRUCT** is set when we couldn't identify the JSON structure we're parsing.
   - **mp_EOKEY** is set when we have trouble reading the *key* in an **mp_ARRAY**
   - **mp_EOVALUE** is set when we have trouble reading the *value*

There is also a macro for checking if a type is an error code.

```c
mp_IS_ERROR(atom.type);
```

So once we have set the **mp_Atom's** attributes we will pass it to your **mp_Atomizer** which should be defined with the following signature.

```c
mp_Atomizer foo(mp_Atom atom, void *p)

```

Your **mp_Atomizer** takes a copy of the **mp_Atom** we just built up, it also requires a void pointer which will be used when your **mp_Atomizers** with **mp_Probe** and **mp_ProbeSlice** - It will also have to return a status code.

```c
	mp_CONTINUE,
	mp_BREAK,
	mp_FAIL,
	mp_WHYBOTHER,
```

   - You should return **mp_CONTINUE** when you want murp to keep lexing the structure. If you get an error code then murp will not call the the **mp_Atomizer**
   - You should return **mp_BREAK** when you want murp to stop lexing the structure. Say if you've got all the elements you need.
   - You should return **mp_FAIL** if you want to differentiate your failures from your breaks.
   - **mp_WHYBOTHER** is returned by **mp_Atomize** when you pass it a NULL *callback* - you can use this if you want but why bother?

So here I have defined a simple **mp_Atomizer** that crawls over the **mp_Atoms** and prints their values.

```c
mp_Atomizer print_atom(mp_Atom atom, void *p) {
	printf("Atom {\n\tDatatype:\t%d\n\tContainer:\t%d\n", atom.type, atom.container);
	if(atom.key.start) printf("\tKey:\t%.*s\n", atom.key.len, atom.key.start);
	printf("\tValue:\t%.*s\n", atom.value.len, atom.value.start);
	puts("\n}\n");

	return mp_CONTINUE;
}
```

So it prints the attributes of each **mp_Atom** - like so:

```
Atom {
	Datatype:	2
	Container:	6
	Value:	element

}

Atom {
	Datatype:	3
	Container:	6
	Value:	1234

}

Atom {
	Datatype:	4
	Container:	6
	Value:	true

}

Atom {
	Datatype:	4
	Container:	6
	Value:	false

}

Atom {
	Datatype:	1
	Container:	6
	Value:	null

}

Atom {
	Datatype:	3
	Container:	6
	Value:	3.14

}

Atom {
	Datatype:	3
	Container:	6
	Value:	9.99e-2

}

Atom {
	Datatype:	5
	Container:	6
	Value:	{"test" : 12345, "urk" : [1, 2, 3, 4]}

}

Atom {
	Datatype:	6
	Container:	6
	Value:	[1, 2, 3, 4, 5]

}

Atom {
	Datatype:	9001
	Container:	6
	Value:

}
```

Using **mp_Atomizers** to examine each **mp_Atom** you pass in you can decide what you want done with the data. Do you want to allocate some space for it? Do you want to gloss over it? That's completely up to you!

If you're wanting to pass some class of C object to the **mp_Atomizer** there is a similar interface called **mp_Probe** (actually **mp_Atomize** is a macro for **mp_Probe** where the void * is set to NULL) - Here is an example!

```c
mp_Atomizer count_elems(mp_Atom atom, void *probe) {
	if(mp_IS_ERROR(atom.type)) return mp_BREAK;

	int *count = probe;
	*count += 1;

	return mp_CONTINUE;
}

/* ...later in main... */
	int counter = 0;
	mp_Probe(json, count_elems, &counter);
```

The output would be something like:

```
I counted 9 elements in this string.
```

So what do we do with nested structures? What if the value we return is an **mp_ARRAY** or an **mp_OBJECT** We can pass the **mp_Slices** to **mp_AtomizeSlice** and **mp_ProbeSlice** like in the **mp_Atomizer** below.

```c
mp_Atomizer ps_PrintAtom(mp_Atom atom, void *p) {
	printf("Atom {\n\tDatatype:\t%d\n\tContainer:\t%d\n", atom.type, atom.container);
	if(atom.key.start) printf("\tKey:\t%.*s\n", atom.key.len, atom.key.start);
	printf("\tValue:\t%.*s\n", atom.value.len, atom.value.start);
	if ((atom.type == mp_OBJECT) || (atom.type == mp_ARRAY)) {
		int i;
		mp_ProbeSlice(&atom.value, ps_CountElems, &i);
		printf("\tElements:\t%d\n", i);
	}
	puts("\n}\n");

	// calls itself recursively
	if ((atom.type == mp_OBJECT) || (atom.type == mp_ARRAY)) mp_AtomizeSlice(&atom.value, ps_PrintAtom);

	if(mp_IS_ERROR(atom.type)) return mp_BREAK;
	return mp_CONTINUE;
}

```

Pretty magical, ey? I'm sure there will be plenty more examples as I use the API myself in my own projects. If you do anything swish with it, let me know!

## License

```
Copyright (c) 2015, Myke Atkinson
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.

repository: ploe/murp

repo_name: ploe/murp


text:
# SimpleBus/JMSSerializerBridge

[![Build Status](https://travis-ci.org/SimpleBus/JMSSerializerBridge.svg?branch=master)](https://travis-ci.org/SimpleBus/JMSSerializerBridge) [![codecov](https://codecov.io/gh/SimpleBus/JMSSerializerBridge/branch/master/graph/badge.svg)](https://codecov.io/gh/SimpleBus/JMSSerializerBridge)

By [Matthias Noback](http://php-and-symfony.matthiasnoback.nl/)

This library contains an implementation of the
[ObjectSerializer](https://github.com/SimpleBus/Serialization/blob/master/src/ObjectSerializer.php) interface from
[SimpleBus/Serialization](https://github.com/SimpleBus/Serialization) which uses the
[JMSSerializer](https://github.com/schmittjoh/serializer).

repository: caciobanu/JMSSerializerBridge

repo_name: caciobanu/JMSSerializerBridge


text:
[![badge - built with](https://img.shields.io/badge/built_with-PyTorch-ee4c2c.svg)](https://shields.io/)
[![badge - code grade](https://img.shields.io/badge/pylint-10.0_of_10.0-a0ff00.svg)](https://shields.io/)

[Project presentation video](https://www.youtube.com/watch?v=m0CUExITjxE)

[Model state dict files about 3.5 GByte (content of ` models ` directory)](http://www.mediafire.com/file/sl6qqfkkmcjz51u/models.zip)

# Inspiration

Healthcare system is usually on the bottom section of any government’s budget. Hospitals struggle from underfunding. Doctors, especially radiologists are overwhelmed. The COVID-19 pandemic gives a lot of extra pressure on the healthcare system and on hospitals’ staff as well. We want to create a solution that helps to handle the available resources especially human resources and work time better. We know, everybody can train a deep learning model. That’s why we bring this hackathon an idea that is not a “yet another solution”

We are really devoted to cutting edge technologies and we are interested in healthcare.

We coded a **working demo** with a UI to show our vision. We made **EDA** to show we understand the data and what is usually wrong with the publicly available datasets.We wrote an **idea validation plan** to show what we can make with low end GPUs from poor data within a limited time. This validation plan has a lot of similarities with the necessary contents of *FDA 510(k) submission*. We planned **short and long time ranges** to bring out the most from the idea nut just in the long term, but in a short time period as well.

# What it does

ChainRad is a deep learning based radiology software to assist radiologists by returning the possibility of trained diseases from multiple neural network chains simultaneously. This sounds simple and not a real unique solution, but the real benefits are under the hood.

The neural network is built on very common pretrained models. We implemented 4 of them:
- VGG-16 batchnorm
- ResNet 152
- DenseNet 161
- GoogleNet

We used those models as a headless model which means we cutted the last classification layers from them and used only the conculutional parts.

These models are trained on regular images which are different then an image from the radiology department. That’s why we want to train our own pretrained network in long term. So it’s basically a residual network for healthcare images. However, this is the long term plan.  We used common models to validate our idea.

We use a neural-network chain where each neural network is trained to identify only one disease.In our example we trained 14 different neural networks based on the same structure. Any incoming image moves through the preprocessing phase and the headless pretrained models before it reaches our classification layers. Since the headless models are pretrained, and we didn’t retrained them, each of our models is different from the other by the last classification layers. We trained only them. We think, it is better to use one-disease models instead of a giant monster-network, since each of them can learn better with less noise.

A final software assists radiologists by giving the possibilities of trained diseases. However, this software does not contact the patients or with the patient's internal organs, nervous- or cardiovascular system, it’s a diagnostic tool for internal organs.

# Accomplishments that we're proud of
- working demo with UI
- EDA
- unit test for data preparation
- 14 trained models
- validation plan

# What's next for ChainRad

We are thinking this state of ChainRad is rather a proof of concept than a production ready software though it has significant performance at the moment as well. In case if ChainRad would have a chance to get developed further, we would re-train the famous computer vision architectures from zero to get more healthcare-compatible  networks.

repository: hyperrixel/ChainRad

repo_name: hyperrixel/ChainRad


text:
# Source to Raw DE1 (Full table) - Oracle to Azure Blob Storage

Selects all the columns from the source Oracle database to be extracted and dump the data on to Azure Blob storage

### Outputted Code

- An Azure Data Factory json pipeline

### Source atttributes required

Attribute Name | Description of Attribute
-------------- | ------------------------
genericdataset | A Data Factory dataset that points to the source Oracle database. It does not need to point to the table as a select statement will be passed through.

### Target attributes required

Attribute Name | Description of Attribute
-------------- | ------------------------
storage_container | Azure storage container name where the table will be droped at.
genericdataset | A Data Factory dataset that points to the target Azure Blob storage.

### Properties attributes required

No additional attributes for source are required.

### Json example

```json
{
   "language": "DATAFACTORY",
    "properties": {},
    "source": {
        "genericdataset": "myGenericDataSet_source"
    },
    "target": {
        "genericdataset": "myGeneraricDataSet_target",
        "storage_container": "myStorageContainer"
    }
}
```

repository: tsansome/data-templator

gha_language: Mustache

repo_name: tsansome/data-templator


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

### Description

The Adobe PDF specification 1.3, as implemented by Adobe Acrobat before 8.0.0, allows remote attackers to have an unknown impact, possibly including denial of service (infinite loop), arbitrary code execution, or memory corruption, via a PDF file with a (1) crafted catalog dictionary or (2) a crafted Pages attribute that references an invalid page tree node.

### POC

#### Reference
No PoCs from references.

#### Github
- https://github.com/0xCyberY/CVE-T4PDF
- https://github.com/ARPSyndicate/cvemon

repository: trickest/cve

repo_name: trickest/cve


text:
# docker_jenkins

Launches Jenkins in a Docker container inside an Engineyard v5 environment.
Jenkins will be installed in an Utility instance called `docker`.

## Usage

Add the following dependency to in `cookbooks/ey-custom/metadata.rb`:

```
depends 'docker_jenkins'
```

Add the following line to your `cookbooks/ey-custom/recipes/after-main.rb`:

```
include_recipe `docker_jenkins::default`
```

## Customization

This customization is useful when you have multiple Utility instances that are
built as Docker hosts.

If you want to setup Jenkins in a Utility instance with a different name like
`docker_jenkins`, update the following in
`cookbooks/docker_jenkins/attributes/default.rba`:

```
default['docker_jenkins'].tap do |jenkins|
  jenkins['utility_name'] = 'docker_jenkins'
  jenkins['domain'] = 'jenkins.example.com'
end
```

Make sure to setup Docker in the `docker_jenkins` instance. Update
`cookbooks/docker_custom/attributes/default.rb`:

```
default['docker_custom']['docker_instances'] = %w(docker docker_jenkins)
```

## LICENSE

Copyright 2016 Engine Yard, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

repository: engineyard/ey-docker-recipes

gha_language: Ruby

repo_name: engineyard/ey-docker-recipes


text:
# EasyLAMP
Easily install a LAMP stack

# Usage
Its pretty simple, `just chmod +x easylamp.sh`.. and then just run it with `./easylamp.sh`


text:
---
hrs_structure:
  division: '2'
  volume: '11'
  title: '26'
  chapter: 481E
  section: '481E-13'
type: hrs_section
tags:
  - Business
menu:
  hrs:
    identifier: HRS_0481E-0013
    parent: HRS0481E
    name: 481E-13 Prohibited conduct
weight: 27065
title: Prohibited conduct
full_title: 481E-13 Prohibited conduct
---
**[§481E-13] Prohibited conduct.** (a) An athlete agent, with the intent to induce a student-athlete to enter into an agency contract, may not:

(1) Give any materially false or misleading information or make a materially false promise or representation;

(2) Furnish anything of value to a student-athlete before the student-athlete enters into the agency contract; or

(3) Furnish anything of value to any individual other than the student-athlete or another registered athlete agent.

(b) An athlete agent may not intentionally:

(1) Initiate contact with a student-athlete unless registered under this chapter;

(2) Refuse or fail to retain or permit inspection of the records required to be retained by section 481E-12;

(3) Fail to register when required by section 481E-3;

(4) Provide materially false or misleading information in an application for registration or renewal of registration;

(5) Predate or postdate an agency contract; or

(6) Fail to notify a student-athlete before the student-athlete signs or otherwise authenticates an agency contract for a particular sport that the signing or authentication may make the student-athlete ineligible to participate as a student-athlete in that sport. [L 2007, c 248, pt of §2]

repository: SamMade/BlueAndKrabby

repo_name: SamMade/BlueAndKrabby


text:
# Scala Rules for Bazel

## Overview

This rule is used for building [Scala][scala] projects with Bazel. There are
currently two rules, `scala_library` and `scala_binary`. More features will be
added in the future, e.g. `scala_test`.

[scala]: http://www.scala-lang.org/

### `scala_library`

`scala_library` generates a `.jar` file from `.scala` source files.
In order to make a java rule use this jar file, use the `java_import` rule.

The current implementation assumes that the files `/usr/bin/scalac` and
`/usr/share/java/scala-library.jar` exist.

### `scala_binary`

`scala_binary` generates a Scala executable. It may depend on `scala_library`
and `java_library` rules.

A `scala_binary` requires a `main_class` attribute.

repository: baroquebobcat/bazel

repo_name: baroquebobcat/bazel


text:
## QRServe - HTTP microservice for QR Code generation

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

An implementation of a simple HTTP microservice that generates
QR Code upon request. All the QR heavy lifting is done by the
[qrcode](https://github.com/skip2/go-qrcode/) Go package.

## Installation

Install the latest stable version from GitHub:

    go get github.com/dobarkod/qrserve

## Running the service

To run the service, specify the IP address and TCP port to listen on:

    qrserve address:port

The address is optional and can be omitted, in which case QRServe will listen
on all interfaces. To listen only on a specific IP address, specify it like
this (example for localhost and port 8000):

    qrserve <IP_ADDRESS>:8000

## Using the service

To generate a QR code, make a GET request to the `http://address:port/` URL
with the following query string parameters:

* `data` - data (text) to be encoded, eg. an URL
* `size` - size (in pixels), of the generated QR code (if less than required, will be automatically increased)
* `q` - error correction level (optional); possible values are `L` or `l` (low), `M` or `m` (medium, default), `Q` or `q` (high) and `H` or `h` (highest)

The service will respond with a status code of 200 and the generated QR
code in PNG image format. In case of error, the service will return an
error code (400 in case of bad request data, 500 if image could not be generated
for other reasons).

To avoid impacting the service stability, the maximum allowed size is 4096
(that is, the generated image will be at most 4096x4096 px in size).

For example:

    curl -o qr.png http://<IP_ADDRESS>:8000/?data=Hello+world&size=100

## License (MIT)

Copyright (c) 2016 Good Code and contributors

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

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

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

repository: dobarkod/qrserve

gha_language: Go

repo_name: dobarkod/qrserve


text:
# This is my cloud server

## How to start one?
- Ensure, you have the .env file filled accordingly
- use `make up` to start the services.

## Post Installation
- Netdata
  - Once installed, you can use netdata cloud to monitor your node by using their docker claim node command

- Portainer
  - you can login using admin password provided in the .env file

- Bitwarden
  - Create an account
  - Verify the account
  - Then login and disable registrations
  - use the admin key provided in the .env to log in to `/admin` page

- Jackett
  - Use basic auth to login
  - Add the indexers you like
  - Connect to flaresolverr and any other changes

- Transmission
  - Nothing needs to be changed unless you kno what you are doing

- Sonarr and Radarr
  - Add root folder
  - Connect jackett with the indexers
  - Connect transmission download client

- Jellyfin
  - Create a new admin user
  - Add libraries

TODO:
- Separate openvpn/wireguard to a different container so that multiple containers can route traffic through VPN
- Secure Docker socket proxy. It worked but needs to be specific for portainer.

repository: tankofzion/my-cloud

repo_name: tankofzion/my-cloud


text:
---
layout: post
title: Links on ChatGPT on Public Education and Leadership
desc:
proj-url:
proj-num: 01
new: true
draft: false
---

# Education

### Chronological Order

## Feb 17th, 2023
- **‘Tremendous potential’: Why some disability advocates laud ChatGPT** ([csmonitor.com](https://www.csmonitor.com/Technology/2023/0217/Tremendous-potential-Why-some-disability-advocates-laud-ChatGPT))

## Feb 14th, 2023
- **Some educators embrace ChatGPT as a new teaching tool** ([pbs.org](https://www.pbs.org/newshour/education/some-educators-embrace-chatgpt-as-a-new-teaching-tool))

## Feb 10th, 2023
- **How ChatGPT Can Improve Education, Not Threaten it** ([scientificamerican.com](https://www.scientificamerican.com/article/how-chatgpt-can-improve-education-not-threaten-it/))

## Jan 26th, 2023
- **ChatGPT Is Coming for Classrooms. Don't Panic** ([wired.com](https://www.wired.com/story/chatgpt-is-coming-for-classrooms-dont-panic/))

- **ChatGPT is changing education, AI experts say — but how?** ([dw.com](https://www.dw.com/en/chatgpt-is-changing-education-ai-experts-say-but-how/a-64454752))

## Jan 12th, 2023
- **Don’t Ban ChatGPT in Schools. Teach With It.** ([nytimes.com](https://www.nytimes.com/2023/01/12/technology/chatgpt-schools-teachers.html))

- **Every sixth high school student uses a chatbot to cheat**
([gymnasieskolen.dk](https://gymnasieskolen.dk/articles/hver-sjette-gymnasieelev-benytter-chatbot-til-snyd/)) 🇩🇰

## Jan 8th, 2023
- **New York City school officials block access to controversial artificial intelligence ChatGPT to stop students generating essays** ([abc.net.au](https://www.abc.net.au/news/2023-01-08/artificial-intelligence-chatgpt-chatbot-explained/101835670))

## Jan 7th, 2023

- **Estilo repetido, falta de citações, 'enrolation'.... professores descobrem falhas em textos do robô ChatGPT, mas elogiam novidade** ([globo.com](https://g1.globo.com/tecnologia/noticia/2023/01/07/estilo-repetido-falta-de-citacoes-enrolation-professores-descobrem-falhas-em-textos-do-robo-chatgpt-mas-elogiam-novidade.ghtml)) 🇧🇷

- **Robô 'ChatGPT' escreve redação do Enem em 50 segundos; saiba quanto ele tiraria na prova** ([globo.com](https://g1.globo.com/educacao/noticia/2023/01/07/robo-chatgpt-escreve-redacao-do-enem-em-50-segundos-saiba-quanto-ele-tiraria-na-prova.ghtml)) 🇧🇷

- **Cristóbal Cobo on Linkedin: Schools in NY are banning the use of #chatGPT (this is just the beginning) 🤖😳** ([linkedin.com](https://www.linkedin.com/feed/update/urn:li:activity:7017503021156712448))

## Jan 5th, 2023
- **ChatGPT & Education** ([Google Slides](https://docs.google.com/presentation/d/1Vo9w4ftPx-rizdWyaYoB-pQ3DzK1n325OgDgXsnt0X0/edit#slide=id.g1cc76543f64_0_246) by [Torrey Trust, Ph.D.](https://www.torreytrust.com/))

**On NYC Department of Education prohibiting ChatGPT access**
- **New York City schools ban access to ChatGPT over fears of cheating and misinformation** ([theverge.com](https://www.theverge.com/2023/1/5/23540263/chatgpt-education-fears-banned-new-york-city-safety-accuracy))

- **As NYC public schools block ChatGPT, OpenAI says it’s working on ‘mitigations’ to help spot ChatGPT-generated text** ([techcrunch.com](https://techcrunch.com/2023/01/05/as-nyc-public-schools-block-chatgpt-openai-says-its-working-on-mitigations-to-help-spot-chatgpt-generated-text/))

- **NYC schools block access to ChatGPT over cheating concerns** ([nypost.com](https://nypost-com.cdn.ampproject.org/c/s/nypost.com/2023/01/05/nyc-schools-block-access-to-chatgpt-over-cheating-concerns/amp/))

It’s a new world. Goodbye homework!
— Elon Musk (@elonmusk) January 5, 2023

## Jan 4th, 2023
- **A College Kid Built an App That Sniffs Out Text Penned by AI** ([thedailybeast.com](https://www.thedailybeast.com/princeton-student-edward-tian-built-gptzero-to-detect-ai-written-essays))

- **What are We Doing About AI Essays?** ([facultyfocus.com](https://www.facultyfocus.com/articles/teaching-with-technology-articles/what-are-we-doing-about-ai-essays/))

## Jan 3rd, 2023
- **What Will ChatGPT Mean for Teaching?** ([edsurge.com](https://www.edsurge.com/news/2023-01-03-what-will-chatgpt-mean-for-teaching))

## Dec 31th, 2022
- **AI-assisted plagiarism?  But it can still be amazingly useful** ([aisnakeoil.substack.com](https://aisnakeoil.substack.com/p/chatgpt-is-a-bullshit-generator-but))

## Dec 9th, 2022
- **Is ChatGPT and Authorship Verification the new King Kong vs GodZilla battle in academic cheating?** ([eduoliveira.com](https://www.eduoliveira.com/projects/chatgpt))

## Dec 5th, 2022
- **AI Homework** ([stratechery.com](https://stratechery.com/2022/ai-homework/))

# What is ChatGPT?
- **ChatGPT: Optimizing Language Models for Dialogue** • ([openai.com](https://openai.com/blog/chatgpt/)) [30-nov-2022]
- **Sam Altman annoucing OpenAI** ([twitter.com](https://twitter.com/sama/status/1598038815599661056)) [30-nov-2022]

today we launched ChatGPT. try talking with it here: https://t.co/uWra8LKFMN
— Sam Altman (@sama) November 30, 2022

[ Extra ]

### Before ChatGPT announce (and hype) but connected to GPT-3

## May 17th, 2022
- **New AI tools that can write student essays require educators to rethink teaching and assessment** ([blogs.lse.ac.uk](https://blogs.lse.ac.uk/impactofsocialsciences/2022/05/17/new-ai-tools-that-can-write-student-essays-require-educators-to-rethink-teaching-and-assessment/))


text:
ENERBOT-RUBY
========
- Website: https://www.energon.cloud
- ![This software is Blessed](https://img.shields.io/badge/blessed-100%25-770493.svg)

It's based on the bototo3000, but using the Slack Ruby Client and Ruby instead of Python. Is design for small talks and remote commands over SSH.

He also likes cubes.

## Install
You need to install [Bundler](https://bundler.io) to get all dependencies or you could stay in the dependency hell without it. Then under the enerbot directory execute:
```
bundler install
```

You need to configure and export the Slack token as an environment variable:
```
export SLACK_API_TOKEN=YOUR-TOKEN-03-03-456
```
And run it!
```
ruby client.rb
```

This bot will output everything for default. If you don't want this, remove the `puts data` from the `client.rb`

## SSH
We currently are not supporting the SSH feature. Stay tune for more news.

## Amazing bots

* [Huemul](https://github.com/devschile/huemul)

## License

See the [LICENSE](LICENSE.md) file for license rights and limitations (MIT).

repository: laltamir/enerbot

repo_name: laltamir/enerbot


text:
## Tags and respective `Dockerfile` links

- [`2.3.2`](https://github.com/jdeathe/centos-ssh-mysql/tree/2.3.2), `centos-7-mysql57-community`  [(centos-7-mysql57-community/Dockerfile)](https://github.com/jdeathe/centos-ssh-mysql/blob/centos-7-mysql57-community/Dockerfile)
- [`1.11.2`](https://github.com/jdeathe/centos-ssh-mysql/tree/1.11.2), `centos-6` [(centos-6/Dockerfile)](https://github.com/jdeathe/centos-ssh-mysql/blob/centos-6/Dockerfile)

## Overview

This build uses the base image [jdeathe/centos-ssh](https://github.com/jdeathe/centos-ssh) so inherits it's features but with `sshd` disabled by default. [Supervisor](http://supervisord.org/) is used to start the [`mysqld`](https://www.mysql.com/products/community/) daemon when a docker container based on this image is run.

Includes automated password generation and an option for custom initialisation SQL.

### Image variants

- [MySQL 5.7 Community Server - CentOS-7](https://github.com/jdeathe/centos-ssh-mysql/blob/centos-7-mysql57-community)
- [MySQL 5.1 - CentOS-6](https://github.com/jdeathe/centos-ssh-mysql/blob/centos-6)

## Quick start

> For production use, it is recommended to select a specific release tag as shown in the examples.

Run up a container named `mysql.1` from the docker image `jdeathe/centos-ssh-mysql` on port 3306 of your docker host.

```
$ docker run -d \
  --name mysql.1 \
  -p 3306:3306 \
  -v /var/lib/mysql \
  jdeathe/centos-ssh-mysql:2.3.2
```

Verify the named container's process status and health.

```
$ docker ps -a \
  -f "name=mysql.1"
```

Verify successful initialisation of the named container.

```
$ docker logs mysql.1
```

On first run, MySQL Details are returned. This includes the configured database, if applicable, and any associated user credentials.

![Docker Logs - MySQL Bootstrap](https://raw.github.com/jdeathe/centos-ssh-mysql/centos-7-mysql57-community/images/docker-logs-mysqld-bootstrap-v2.3.0.png)

The MySQL table data is persistent across container restarts by setting the MySQL data directory `/var/lib/mysql` as a data volume. To locate the path where data is stored on the Docker host use `docker inspect`.

```
$ docker inspect \
  --format '{{ json (index .Mounts 0).Source }}' \
  mysql.1
```

To access the interactive MySQL SQL shell.

```
$ docker exec -it \
  mysql.1 \
  mysql
```
### Sakila example

Import the Sakila example database from the [MySQL Documentation](https://dev.mysql.com/doc/index-other.html) and view the first 2 records from the film table.

#### Import schema

```
$ docker exec -i mysql.1 mysql \
  <<< $(curl -sSL http://downloads.mysql.com/docs/sakila-db.tar.gz \
    | tar -xzO - "sakila-db/sakila-schema.sql" \
    | sed -e '/^CREATE TABLE film_text/,/ENGINE=InnoDB / s/InnoDB/MyISAM/'
  )
```

#### Import data

```
$ docker exec -i mysql.1 mysql \
  <<< $(curl -sSL http://downloads.mysql.com/docs/sakila-db.tar.gz \
    | tar -xzO - "sakila-db/sakila-data.sql"
  )
```

#### Select records

```
$ docker exec mysql.1 mysql \
  -e "SELECT * FROM sakila.film LIMIT 2 \G"
```

## Instructions

### Running

To run the a docker container from this image you can use the standard docker commands as shown in the example below. Alternatively, there's a [docker-compose](https://github.com/jdeathe/centos-ssh-mysql/blob/centos-7-mysql57-community/docker-compose.yml) example.

For production use, it is recommended to select a specific release tag as shown in the examples.

#### Using environment variables

The following example sets up a custom MySQL database, user and user password on first run. This will only work when MySQL runs the initialisation process and values must be specified for `MYSQL_USER` and `MYSQL_USER_DATABASE`. If `MYSQL_USER_PASSWORD` is not specified or left empty a random password will be generated.

```
$ docker stop mysql.1 && \
  docker rm mysql.1; \
  docker run \
  --detach \
  --name mysql.1 \
  --publish 3306:3306 \
  --env "MYSQL_SUBNET=<IP_ADDRESS>/<IP_ADDRESS>" \
  --env "MYSQL_USER=app-user" \
  --env "MYSQL_USER_PASSWORD=" \
  --env "MYSQL_USER_DATABASE=app-db" \
  --volume mysql.1.data-mysql:/var/lib/mysql \
  jdeathe/centos-ssh-mysql:2.3.2
```

The environmental variable `MYSQL_SUBNET` is optional but can be used to generate users with access to databases outside the `localhost`, (the default for the root user). In the example, the subnet definition `<IP_ADDRESS>/<IP_ADDRESS>` allows connections from any network which is equivalent to the wildcard symbol, `%`, in MySQL GRANT definitions.

Verify it's initialised and running successfully by inspecting the container's logs:

```
$ docker logs mysql.1
```

#### Environment variables

There are several environmental variables defined at runtime these allow the operator to customise the running container.

> *Note:* Most of these settings are only evaluated during the first run of a named container; if the data volume already exists and contains database table data then changing these values will have no effect.

##### ENABLE_MYSQLD_BOOTSTRAP & ENABLE_MYSQLD_WRAPPER

It may be desirable to prevent the startup of the mysqld-bootstrap and/or mysqld-wrapper scripts. For example, when using an image built from this Dockerfile as the source for another Dockerfile you could disable both mysqld-wrapper and mysqld from startup by setting `ENABLE_MYSQLD_BOOTSTRAP` and `ENABLE_MYSQLD_WRAPPER` to `false`. The benefit of this is to reduce the number of running processes in the final container. Another use for this would be to make use of the packages installed in the image such as `mysql` and `mysqladmin`; effectively making the container a MySQL client.

```
...
  --env "ENABLE_MYSQLD_BOOTSTRAP=false" \
  --env "ENABLE_MYSQLD_WRAPPER=false" \
...
```

##### MYSQL_INIT_LIMIT

The default timeout for MySQL initialisation is 10 seconds. Use `MYSQL_INIT_LIMIT` to change this value when necessary.

```
...
  --env "MYSQL_INIT_LIMIT=30" \
...
```

##### MYSQL_INIT_SQL

To add custom SQL to the MySQL intitialisation use `MYSQL_INIT_SQL` where the following placeholders are will get replaced with the appropriate values:

- `{{MYSQL_ROOT_PASSWORD}}`
- `{{MYSQL_USER}}`
- `{{MYSQL_USER_DATABASE}}`
- `{{MYSQL_USER_HOST}}`
- `{{MYSQL_USER_PASSWORD}}`

> *Note:* The backtick "\`" character will need escaping as show in the example.

```
...
  --env "MYSQL_INIT=CREATE DATABASE \`{{MYSQL_USER_DATABASE}}-1\`; GRANT ALL PRIVILEGES ON \`{{MYSQL_USER_DATABASE}}-%\`.* TO '{{MYSQL_USER}}'@'{{MYSQL_USER_HOST}}';" \
...
```

##### MYSQL_ROOT_PASSWORD

On first run the root user is created with an auto-generated password. If you require a specific password,  `MYSQL_ROOT_PASSWORD` can be used when running the container.

```
...
  --env "MYSQL_ROOT_PASSWORD=Passw0rd!" \
...
```

If set to a valid container file path the value will be read from the file - this allows for setting the value securely when combined with an orchestration feature such as Docker Swarm secrets.

```
...
  --env "MYSQL_ROOT_PASSWORD=/run/secrets/mysql_root_password" \
...
```

##### MYSQL_ROOT_PASSWORD_HASHED

To indicate `MYSQL_ROOT_PASSWORD` is a pre-hashed value instead of the default plain-text type set `MYSQL_ROOT_PASSWORD_HASHED` to `true`. When using this option the MySQL root user password will not be stored in the running container so you will need to either add it as a manual step or you will need to supply the password when running `mysql` or `mysqladmin`.

```
...
  --env "MYSQL_ROOT_PASSWORD=*03F7361A0E18DA99361B7A82EA575944F53E206B" \
  --env "MYSQL_ROOT_PASSWORD_HASHED=true" \
...
```

To generate a pre-hashed password use the following MySQL query, substituting `{{password}}` with the required password.

```
$ docker exec mysql.1 \
  mysql -NB \
    -e "SELECT PASSWORD('{{password}}');"
```

##### MYSQL_USER

On first run, a database user and database can be created. Set `MYSQL_USER` to a non-empty string. A corresponding `MYSQL_USER_DATABASE` value must also be set for the user to be given access too.

```
...
  --env "MYSQL_USER=app-user" \
...
```

##### MYSQL_USER_PASSWORD

On first run, if the database user `MYSQL_USER` is specified then it is created with an auto-generated password. If you require a specific password,  `MYSQL_USER_PASSWORD` can be used when running the container.

```
...
  --env "MYSQL_USER_PASSWORD=appPassw0rd!" \
...
```

If set to a valid container file path the value will be read from the file - this allows for setting the value securely when combined with an orchestration feature such as Docker Swarm secrets.

```
...
  --env "MYSQL_USER_PASSWORD=/run/secrets/mysql_user_password" \
...
```

##### MYSQL_USER_PASSWORD_HASHED

To indicate `MYSQL_USER_PASSWORD` is a pre-hashed value instead of the default plain-text type set `MYSQL_USER_PASSWORD_HASHED` to `true`.

```
...
  --env "MYSQL_USER_PASSWORD=*4215553ECE7A18BC09C16DB9EBF03FACFF49166B" \
  --env "MYSQL_USER_PASSWORD_HASHED=true" \
...
```

##### MYSQL_USER_DATABASE

On first run, if the database user `MYSQL_USER` is specified then you must also define a corresponding database name.  `MYSQL_USER_DATABASE` can be used when running the container.

```
...
  --env "MYSQL_USER_DATABASE=app-db" \
...
```

repository: jdeathe/centos-ssh-mysql

gha_language: Shell

gha_license_id: NOASSERTION

repo_name: jdeathe/centos-ssh-mysql