text:
# Swish

## Introduction
Swish is a dynamically typed language designed for shell scripting and command line integration.

The grammar is compact and designed in a way that should feel familiar with developers.

## Notation
The syntax in this document is specified using [Extended Backus-Naur Form(EBNF)](https://en.wikipedia.org/wiki/Extended_Backus-Naur_Form).

A few additions have been made to the standard form:

- A range of alternatives can be expressed with the form `"a" ... "b"`, which represents a set of
characters from `a` to `b` as alternatives.
- Repeating a value a number of times can be expressed with the form `value*n` where the value is
repeated `n` times.

Production rules starting with a capital letter are considered major language rules, while ones
starting with lower case letters are used to construct other rules.

## Source code representation
Source code is Unicode text encoded as UTF-8. Text is not canonicalized, so a single accented
code point is distinct from the same character constructed from combining an accent and a letter;
those are treated as two code points. This document refers to a Unicode code point as a _character_
in the source text.

Each character is distinct; for instance, upper and lower case letters are different characters.

### Characters
The following productions are used to denote specific Unicode character classes:
```
newline = (* Unicode code point U+000A *) ;
unicodeChar = (* Any Unicode code point except U+000A *) ;
unicodeLetter = (* Any Unicode code point in the categories Lu, Ll, Lt, Lm, and Lo *) ;
unicodeDigit = (* Any Unicode code point in the category Nd *) ;
```

The [Unicode Standard 6.2](http://www.unicode.org/versions/Unicode6.2.0/), Section 4.5
"General Category" defines the code point categories mentioned above.

### Letters and digits
```
letter = unicodeLetter | "_" ;
decimalDigit = "0" ... "9" ;
octalDigit = "0" ... "7" ;
hexDigit = "0" ... "9" | "A" ... "F" | "a" .... "f" ;
```

In Swish, the underscore character(U+005F) is considered a letter.

## Lexical elements
### Comments
There are two forms of comments:

1. _Line comments_ start with the character sequence `#` and stop at the end of the line.
2. _General comments_ start with the character sequence `##` and continue until the next `##`
character sequence.

### Tokens
There are four classes of tokens: _identifiers_, _keywords_, _operators and delimiters_, and
_literals_. _White space_, formed from spaces(U+0020), horizontal tabs(U+0009),
carriage returns(U+000D), and newlines(U+000A), are mostly ignored only being significant to
separate tokens that would otherwise combine into a single token. Spaces are an exception being
an optional way to seperate lists of items in place of commas(U+002C). Also, newlines or end of
file may trigger the insertion of a semicolon. While breaking input into tokens, the next token is
the longest sequence of characters that form a valid token.

### Semicolons
The formal grammar uses semicolons(U+003B) as terminators in a number of productions. Swish
programs may omit most semicolons using the following rules:

- When input is split into tokens, a semicolon is automatically inserted into the token stream at
the end of a non-blank line if the lines final token is
  - an identifier.
  - an number, string, array, or object literal.
  - one of the keywords `break`, `continue`, `fallthrough`, or `return`.
  - one of the operators and delimiters `++`, `--`, `...`, `)`, `]`, or `}`.
- To allow complex statements to occupy a single line, a semicolon may be omitted before a
closing `)` or `}`.

To reflect idiomatic use, code examples in this document elide semicolons using these rules.

### Identifiers
Identifiers name program entities such as variables and functions. An identifier is a sequence of
one or more letters and digits.
```
Identifier = ( letter | unicodeDigit ) , { letter | unicodeDigit } ;
```

_Examples:_
```
ä
argv
_x9
PATH
```

Some identifiers are predeclared and are described below.

### Keywords
The following keywords are reserved and may not be used as identifiers.
```
if      else   for       in
until   break  continue  fallthrough
switch  case   default   return
```

### Operators and Delimiters
The following character sequences represent operators, delimiters, and other special tokens:
```
!    ++  --   &&  ||  ==
!=   <   <=   >   >=  =
+=   -=  *=   /=  %=  ||=
&&=  (   )    [   ]   {
}    ,   ;    +   -   *
/    %   ...  :
```

### Number literals
A number literal is a sequence of characters describing integers and floating-point numbers.

For integers an optional prefix sets a non-decimal base: 0 for octal, and 0x or 0X for
hexadecimal. In hexadecimal literals, letters a-f and A-F represent values 10 through 15.

For floating-points there are different parts, including an integer part, decimal part, a
fractional part, and an exponent part. The integer and fractional parts comprise decimal digits;
the exponent part is an e or E followed by an optionally signed decimal exponent. One of the
integer part or the fractional part may be elided and one of the decimal point or the exponent may
be elided.
```
NumberLit = decimalLit | octalLit | hexLit | floatLit ;
decimalLit = ( "1" ... "9" ) , { decimalDigit } ;
octalLit = "0" , { octalDigit } ;
hexLit = "0" , ( "x" | "X" ) , hexDigit , { hexDigit } ;
floatLit = ( decimals , "." , [ decimals ] , [ exponent ] ) |
            ( decimals , exponent ) |
            ( "." , decimals , [ exponent ] ) ;
decimals = decimalDigit , { decimalDigit } ;
exponent = ( "e" | "E" ) , [ "+" | "-" ] , decimals ;
```

_Examples:_
```
42
0600
0xDEADBEEF
0.
65.40
4.e+0
20E6
.15e-5
```

### String literals
A string literal is a sequence of characters, there are three forms: raw string literals, and
double and single quoted interpreted string literals.

Raw string literals are character sequences between back quotes(U+0060). Within the quotes, any
character is valid except the back quote. The value of a raw string literal is the string of
uninterpreted UTF-8 encoded characters. The main differences from the interpreted string formats
are newlines are accepted and backslashes have no special meaning.

Interpreted string literals are character sequences between either double(U+0022) or single(U+0027)
quotes. The text in the quotes, which may not contain newlines, forms the value of the literal
after backslash escapes have been interpreted. Backslash escapes are detailed below.

Double quoted interpreted string literals also go through another interpretation step, which
interprets a given expression(which must be single valued) inside the brackets of the sequence
`${}` and replaces the sequence with the returned value represented as a string.

The following backslash values are escaped to the appropriate value:
```
\xHH - Where H is a hexadecimal digit
\uHHHH - Where H is a hexadecimal digit
\UHHHHHHHH - Where H is a hexadecimal digit
\OOO - Where O is an octal digit

\a U+0007 - Alert or bell
\b U+0008 - Backspace
\f U+000C - Form feed
\n U+000A - Line feed or newline
\r U+000D - Carriage return
\t U+0009 - Horizontal tab
\v U+000b - Vertical tab
\\ U+005c - Backslash
\' U+0027 - Single quote
\" U+0022 - Double quote
```

```
StringLit = rawStringLit | singleInterpretedStringLit | doubleInterpretedStringLit ;
rawStringLit = "`" , { unicodeChar | newline } , "`" ;
singleInterpretedStringLit = "'" , { unicodeValue | byteValue } , "'" ;
doubleInterpretedStringLit = '"' , { unicodeValue | byteValue | ( "${" , Expression , "}" ) } , '"' ;
unicodeValue = unicodeChar | littleUValue | bigUValue | escapedChar ;
byteValue = octalByteValue | hexByteValue ;
octalByteValue = "\" , octalDigit*3 ;
hexByteValue = "\x" , hexDigit*2 ;
littleUValue = "\u" , hexDigit*4 ;
bigUValue = "\U" , hexDigit*8 ;
escapedChar = "\" , ( "a" | "b" | "f" | "n" | "r" | "t" | "v" | "\" | "'" | '"' ) ;
```

_Examples:_
```
`abc`
`
  ` # Same as "\n "
"日本語"
"${value}" # Is "swish" if the identifier `value` is equal to "swish"
'\U000065e5\U0000672c\U00008a9e' # Explicit Unicode code points
'\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e' # Explicit UTF-8 bytes
```

### Array literals
Array literals create a new array type value with a list of values.
```
ArrayLit = "[" , [ expressionList | rangeLit ] , "]" ;
expressionList = Expression , [ "..." ] , { ( itemSeparator ) , Expression , [ "..." ] } , [ "," ] ;
rangeLit = [ Expression ] , ":" , Expression ;
itemSeparator = "," | " " ;
```

When creating a range array, the given expressions(which must be single valued) must yield a
positive number typed value. The left expression may be omitted, which uses `0`. The right
expression must be greater than or equal to the left expression(or `0`). An array of numbers are
created from the left expression(or `0`) to the right expression minus one.

_Examples:_
```
[]
["string"]
[5 "string", ["array"]]
[5,]
[10:100]
[:5]
```

### Object literals
Object literals create a new object type value. All values must have a key, and keys may only be of
string and number type.
```
ObjectLit = "{" , [ objectList ] , "}" ;
objectList = objectItem , { ( itemSeparator ) , objectItem } , [ "," ] ;
objectItem = Expression , ( keyValueSeparator ) , Expression ;
keyValueSeparator = ":" | "=" ;
```

_Examples:_
```
{}
{"key" = "value"}
{"key": "string" 5: {"key" = "value"},}
```

## Types
### Nil type
The nil type represents a non existing value, the only value using the nil type is the predeclared
`nil` identifier.

Values of `nil` type are falsey.

The predeclared nil type is `nil`.

### Number type
The number type represents integer and floating point values.

Number type values have arbitrary precision and do not overflow. A number value of `0` is falsey,
all other numbers are considered truthy.

The predeclared number type is `number`.

### String type
The string type represents a set of string values, a string value is a (possibly empty) sequence
of bytes, and are immutable; once created, it's impossible to change the strings contents.

The length of a string(it's size in bytes) can be discovered using the built-in `len()`. Individual
bytes can be accessed using index expressions.

The predeclared string type is `string`.

### Array type
The array type is a numbered sequence of elements of any type. Array values may be
multi-dimensional.

The length of an array can be discovered using the built-in `len()`. Individual elements may be
accessed using index expressions. Adding or assigning keys may done using assignments or with the
built-in `append()`.

The predeclared array type is `array`.

### Object type
The object type is an unordered group of elements of any type. Elements are indexed with a key of
either string or number type.

The length of an object may be discovered with the built-in `len()`. Accessing items can be done
with the index expressions, adding or assigning values can be done with assignments or the
built-in `append()`. Keys may be removed with the `delete()` built-in.

The predeclared array type is `object`.

### Function type
The function type is a type given to all function declarations. Function declarations are detailed
below.

The predeclared function type is `function`.

### Type identity
Two types are either identical or different.

Comparing values of different types are always different.
Values with the `nil` type are always identical.

Two values of the same type are identical following the given rules:

- Two numbers are identical if they're the same after conversions.
- Two strings are identical if the length is the same, and the characters match.
- Two arrays are identical if the values point to the same reference
- Two objects are identical if the values point to the same reference
- Two functions are identical if the values point to the same reference

### Evaluation strategy
When values are evaluated in expressions they are passed in different ways. The following rules
define how different types should be evaluated.

- String and number types are [pass by value](https://en.wikipedia.com/wiki/Evaluation_strategy#Call_by_value).
- Nil, array, object, and function types are implemented as [pass by sharing](https://en.wikipedia.com/wiki/Evaluation_strategy#Call_by_sharing).

## Blocks
A block is a possibly empty sequence of declarations and statements within brace brackets.
```
Block = "{" , statementList , "}" ;
statementList = { Statement , ";" } ;
```

In addition to the explicit blocks in source code, some implicit blocks exist:

- Global block, encompassing all source text
- Each `if`, `else`, `for`, and `switch` statement has their own block
- Each `case` and `default` clause in a `switch` statement have their own block

Blocks nest and influence scoping.

## Declarations and scope
A declaration binds a non-blank identifier to a variable or function. Every identifier in a
program must be declared. Identifiers may be overwritten.

```
Declaration = FunctionDecl ;
```

The scope of a declared identifier is the extent of source text in which the identifier denotes the
specified variable or function.

Swish is lexically scoped using blocks:

1. The scope of predeclared identifiers, and identifiers declared at top(that is, not in another
block) is the global block.
2. The scope of an identifier denoting a function parameter is the function body.
3. The scope of an identifier inside a function body ends at the end of the innermost containing
block.

An identifier declared in a block may be redeclared in an inner block. While the identifier of the
inner declaration is in scope, it denotes the value declared by the inner declaration.

### Blank identifier
The blank identifier, represented by the underscore character(U+005F), may be used in a
declaration like other identifiers but the declaration doesn't introduce a new binding.

### Arguments identifier
All Swish programs have a predeclared identifier called `argv`, it's an array of string arguments
given to the swish program.

### Predeclared identifiers
The following identifiers are implicitly declared in the global block:
```
Types:
  nil number string array object function
Values:
  nil
Functions:
  append copy delete len typeof
```

### Variable declarations
Variable declarations are part of assignments discussed below in the statements section.

### Function declarations
A function declaration binds an identifier to a function.
```
FunctionDecl = Identifier , functionSignature , Block ;
functionSignature = "(" , [ functionParamList ] , ")" ;
functionParamList = functionParam , { ( itemSeparator ) , functionParam } , [ "," ] ;
functionParam = [ "..." ] , Identifier ;
```

Within a list of parameters, some identifiers may not be given an argument; if that's the case
the value is `nil`.

At most one parameter may be prefixed with `...`, a function with such a parameter is called
variadic and may be invoked with zero or more arguments for the parameter. Variadic parameters are
never nil, and if no arguments are given for it, the length will be 0. Variadic parameters won't
assign more than one item to the list unless the parameters after it have been given a value.

The function body may omit any `return` statements, in which case `nil` would be returned.

All functions have a variable declared called `arguments` which is an object including all the
functions parameter names as the keys, with the values as the arguments given for the parameters.

_Examples:_
```
add() {}

add(num, num2,) { return num + num2 }

add(...nums final) {
  ans = 0

  for _, v in arguments {
    if typeof(v) === "array" {
      for _, n in v {
        ans += n
      }
    } else {
      ans += v
    }
  }

  return ans
}
```

## Expressions
An expression specifies the computation of a value by applying operators and functions to operands.

### Operands
Operands denote the elementary values in an expression. An operand may be a literal, a identifier
denoting a variable or function, or a parenthesized expression.
```
Operand = Literal | Identifier | "(" , Expression , ")" ;
Literal = NumberLit | StringLit | ArrayLit | ObjectLit ;
```

### Primary expressions
Primary expressions are the operands for unary and binary expressions.
```
PrimaryExpression = Operand | PrimaryExpression , ( Index | Range | Call ) ;
Index = "[" , Expression , "]" ;
Range = "[" , [ Expression ] , ":" , [ Expression ] , "]" ;
Call = [ "(" ] , [ expressionList ] , [ ")" ] ;
```

_Examples:_
```
x
2
"string"
(x + ".txt")
add(1 3, 6)
add 1 3, 6
a[1]
a[1:2]
a[:100]
o["key"]
{"key": 5}["key"]
```

### Index expressions
A primary expression of the form
```
a[x]
```
denotes the element of the array, string, or object indexed by `x`. The value `x` is called the
index or object key, respectively. The following rules apply when indexing:

- If `a` is an array or string type:
  - The index `x` must be an number.
  - The index `x` is in range if `0 <= x < len(a)`, otherwise it's out of range.
- If `a` is an array type:
  - `a[x]` is the array element at the index `x`.
- If `a` is a string type:
  - `a[x]` is the byte at index `x`.
  - `a[x]` may not be assigned to, because strings are immutable.
- If `a` is an object type:
  - The key `x` may be a string or number.
  - `a[x]` is the value in the object with a key equal to `x`.

Types not mentioned above may not be indexed.

An index expression returns two values the first being the value of the at the index or object key,
while the second being a number notifying if the index or object key exists.
```
value, exists = [""][0]
value, exists = ["" ][1]
```
The second value is `1` if the index or object key exists in the array or object, and `0` if out of
bounds or the key doesn't exist in the object.

### Ranges
A primary expressions of the form
```
a[low:high]
```
Retrieves a range of elements of the array or string starting from `low`(or `0` if not given) up to
`high-1`(or `len(a)-1` if not given).

The range is possible if `0 <= low <= high <= len(a)`, otherwise it's out of range and only gets
the items that are in the range, and if none are in range an empty array is returned.

The resulting array has the same reference as the array being ranged, and assignments to indexes
in the range will reflect in the original array.

```
arr = [1, 2, 3, 4, 5]
arr[:len(arr)] # [1, 2, 3, 4, 5]
arr[:] # [1, 2, 3, 4, 5]
arr[2:] # [3, 4, 5]
arr[4:5000] # [5]
```

### Calls
Given the expression
```
add(1, x, 5)
```

calls `add` with the arguments `1`, `x`, and `5`. Arguments may be multi-valued expressions and are
evaluated before the function is called. If a function call has multiple return values and is
called as an argument to another function call, the return values are used as arguments for the
outer call.

The only restriction to the types of expressions allowed in function calls, is no other function
call is allowed as an argument.

If the number of arguments given to the function aren't the same as the number when declared the
parameters that don't have a value are set to `nil`.

If a parameter is variadic, more than one value may be given to it, as long as any parameters after
it have been given a value as well.

### Passing arguments to variadic parameters
If a function has a variadic parameter, it's an array type. The length of the variadic parameter is
the number of arguments from the first for the parameter up to the item before the next parameter.

Given the function declaration and call
```
add(start, ...nums, final) { ## ... ## }
add(10, 1, 3, 6)
```

Within `add`, the `nums` variable will have the value `[1, 3]`. If there was no `final` parameter
the `nums` variables value would be `[1, 3, 6]`, but before items can be added to variadic
parameters, the parameters after it must have a value.

When calling a function you may add "..." to string and array arguments, this will destruct the
value into multiple values. Here's an example which yields the same results and parameter values
as the example above.
```
arr = [1, 3, 6]
add(10, arr...)
```
Note: the last value in the `arr` array was used for the final parameter to the `add` call.

### Destructuring values with ...
Expressions may be destructured into multiple values by appending "..." after it. Only expressions
yielding an array or string type may do this.

In some places destructuring isn't allowed, such as assignments left operands, and the for
statements expression assignments.

### Operators
Operators combine operands into expressions.
```
Expression = UnaryExpression | Expression , binaryOp , UnaryExpression ;
UnaryExpression = PrimaryExpression | unaryOp , UnaryExpression ;
binaryOp = "||" | "&&" | relOp | addOp | mulOp ;
relOp = "==" | "!=" | "<" | "<=" | ">" | ">=" ;
addOp = "+" | "-" ;
mulOp = "*" | "/" | "%" ;
unaryOp = "+" | "-" | "!" ;
```

The `++` and `--` operator form statements instead of expressions, so they fall outside the
operator hierarchy.

_Examples:_
```
5 == 5
10 != 5
"string" && 5
!1
-1
5e2 * (10 * 100)
10 + 5 >= 15
6 % 2 == 0
```

### Operator precedence
Unary operators have the highest precedence.

There are 5 precedence levels for binary operators. Multiplication operators bind the strongest,
followed by addition operators, comparison, etc.:
```
Precedence  Operator
5           *   /   %
4           +   -
3           ==  !=  <  <=  >  >=
2           &&
1           ||
```

Binary operators of the same precedence associate from left to right.

### Arithmetic operators
The `+` operator may be used on strings as well as number, all other arithmetic operators
(`-`, `*`, `/`, `%`) are restricted to numbers only.

Strings can be concatenated using the `+` operator or the `+=` assignment operator:
```
s = "string" + "s"
s += " are cool"
```
String addition creates a new string from the expression.

For two number values `x` and `y`, the number quotient `q = x / y` and remainder `r = x % y`
satisfy the following relationships:
```
x = q * y + r and |r| < |y|
```

with `x / y` [truncated towards zero](http://en.wikipedia.org/wiki/Modulo_operation).
```
 x    y   x/y  x%y
 5    3    1    2
-5    3   -1   -2
 5   -3   -1    2
-5   -3    1   -2
```

### Comparison operators
Comparison operators compare two operands and yield a number value of 1 or 0.

The equality operators `==` and `!=` apply to operands that are comparable. The ordering operators
`<`, `<=`, `>`, `>=` apply to operands that are ordered. If a comparison is not comparable or
if not ordered the resulting value will be 0. Comparing values of different types will always
yield 0. These terms and the result of the comparisons are defined as follows.

- Number values are comparable and ordered, in the usual way if integers, if floating point numbers
comparing is defined by the IEEE-754 standard.
- String values are comparable and ordered, lexically byte-wise.
- Array values are comparable and ordered, checking ordering by the length of the array, and
comparing by the arrays reference, that is two arrays are equal if they have the same reference.
- Object values are comparable, comparing by the objects references.
- Function values are comparable, comparing by the functions references.

### Logical operators
Logical AND `&&` returns the left expression if falsey, otherwise returns the right expression.

Logical OR `||` returns the left expression if truthy, otherwise returns the right expression.

Logical NOT `!` returns `0` if the expression is truthy, `1` otherwise.

### Conversions
Conversions are expressions that converts a value of one type to another.
```
Conversion = ( "string" | "number" | "int" | "float" ) , "(" , Expression , ")" ;
```

Only numbers and strings have conversions, and if a conversion fails(such as a type that can't be
converted, or the value can't be converted to the type) `nil` is returned.

The conversions `number()` and `int()` function the same and the `float()` conversion exists to
convert a value to a number with floating point precision.

The `string()` conversion can convert any type, the string produced is the literal value.
Converting a function to a string will produce a string of the function declaration.

### Order of evaluation
When evaluating the operands of an expression, assignment, or return statement, all function calls
are evaluated in lexical left-to-right order.

## Statements
Statements control execution.
```
Statement = Declaration | Assignment | Block | ReturnStatement |
            BreakStatement | FallthroughStatement ContinueStatement |
            IfStatement | SwitchStatement | ForStatement | UntilStatement |
            EmptyStatement | ExpressionStatement | IncDecStatement ;
```

### Terminating statements
A terminating statement is one of the following:

1. A `return` statement.
2. A block in which the statement list ends with a terminating statement.
3. An `if` statement in which:
  - the `else` branch is present, and
  - both branches are terminating statements.
4. An `for` statement in which:
  - there are no `break` statements referring to the `for` statement, and
  - the loop condition is absent.
5. An `until` statement in which:
  - there are no `break` statements referring to the `until` statement.
6. A `switch` statement in which:
  - there are no `break` statements referring to the `switch` statement,
  - there is a `default` case, and
  - the statement list in each case, including the `default`, end in a terminating statement, or
  a `fallthrough` statement.

All other statements are not terminating.

A statement list ends in a terminating statement if the list is not empty and the final statement
is terminating.

### Empty statements
The empty statement does nothing.
```
EmptyStatement = ;
```

### Expression statements
Function calls may appear in a statement context. Such statements may be parenthesized.
```
ExpressionStatement = Expression ;
```

### IncDec statements
The `++` and `--` statements increment or decrement their operands by the number `1`. Only operands
that are addressable described in assignments, and have the number type may use these statements.
```
IncDecStatement = Expression , ( "++" | "--" ) ;
```

### Assignments
```
Assignment = expressionList , assignOp , expressionList ;
assignOp = [ addOp | mulOp | "||" | "&&" ] , "=" ;
```

Each left operand must be addressable, that is; a variable, blank identifier, or index expression.
Operands may be parenthesized. Left operands may not have the "..." delimiter after the operand to
destructure its value.

If the number of left and right operands don't match, the left over operands on either side are
left alone.

If a left operand is an identifier and it hasn't been declared, a variable with the corresponding
value is declared. This variable may only be declared if it's a simple assignment with no optional
binary operators.

If assigning to an array index, you are able to assign a value to an index that's out-of-bounds.
The value at the new index is set, and any index before it that are not set are given `nil` as a
value.

An assignment operation `x op= y` where op is a binary operator is equivalent to `x = x op y` but
only evaluates `x` once. The `op=` construct is a single token.

_Examples:_
```
x = 1
a[1000] = 2
o["key"] = "value"
x, y *= 4, 2
n ||= "value"
```

### If statements
If statements specify the conditional execution of two branches according to the value of a
expression. If the expression(which must be single valued) evaluates to a truthy value(i.e. not
`nil` or `0`), the `if` branch is executed, otherwise if an `else` branch is given it's executed.
```
IfStatement = "if" , Expression , Block , [ "else" , ( IfStatement | Block ) ] ;
```

_Examples:_
```
if x < 20 {
  x = 20
}

if x <= 20 {
  x *= 2
} else if x > 20 {
  x = 20
} else {
  x += 2
}
```

### Switch statements
Switch statements provide multi-way execution. An expression(which must be single valued) is
compared to the cases inside the switch statements to determine which branch to execute. The first
case that equals the switch expression triggers the execution of it's statements.
```
SwitchStatement = "switch" , [ Expression ] , "{" , switchClause , "}" ;
switchClause = switchCase , ":" , statementList ;
switchCase = "case" , expressionList | "default" ;
```

In a case or default clause, the last non-empty statement may be a `fallthrough` statement to
indicate that the execution should continue on through the next clause. The fallthrough statement
may not appear in the last clause in a switch statement.

If no expression is given then the switch statement compares it's clauses with `1`.

_Examples:_
```
switch typeof(x) {
  case "string":
    fallthrough
  case "array":
    iterate()
  case "number":
    count()
  default:
    notValid()
}

switch {
  case 0 < 10:
    doSomething()
}
```

### For statements
A for statement specifies a repeated execution of a block for a collection of items or an infinite
loop.
```
ForStatement = "for" , [ forIterator ] , Block ;
forIterator = expressionList , "in" , Expression ;
```

If an empty for statement is given, it loops continuously until a break statement occurs.

A for statement with the `in` keyword given, iterates through a single-value expression. For each
item in the evaluated expression(of type `array`, `string`, or `object`) an iteration is done
which assigns the iteration values to the iteration variables on the left and executes the for
block. Expressions yielding an unsupported type will not execute the for block, and the expressions
on the left must be addressable as described in assignments. Left expressions may not have the
"..." delimiter after the operand to destructure it.

Function calls on the left used to make an assignment are evaluated once per iteration. For each
iteration two values are produced the first being an index/key and the second which may be ignored
is the value at the index/key. Either variable on the left may be a blank identifier to discard
the value. The values produced are as follows:
```
Iterator type  1st value  2nd value(if present)
array          index      value at index
string         index      see below
object         key        value at key
```

- For arrays, the iterations are done in increasing order starting from the element index 0.
- For strings, iterations are done for Unicode code points encoded as UTF-8, starting from index 0
and up. On successive iterations, the index value will be the index of the first byte of successive
UTF-8 encoded code points in the string, and the second value will be the corresponding code point.
If the iteration encounters an invalid UTF-8 sequence the value will be `0xFFFD`, the Unicode
replacement character, the next iteration will advance a single byte.
- For objects, the iteration order is not specified and is not guaranteed to the be the same over
multiple for loops of the same object.

_Examples:_
```
x = 0
for {
  x++
  if x > 5 {
    break
  }
}

a = [0, 1, 2, 3]
for i, v in a {
  if i != v {
    break
  }
}

s = "string, ä"
for _, c in a {
  if c == "ä" {
    break
  }
}

o = {"user": "name"}
for k, v in o {
  if k != "user" {
    break
  }

  saveUser(v)
}
```

### Until statements
A until statement specifies a repeated execution of a block until a condition is satisfied.
```
UntilStatement = "until" , Expression , Block ;
```

Until statements execute the block first then evaluate the condition expression(which must be
single valued) afterwards, if the resulting value is truthy then the block doesn't execute another
time.

### Return statements
A return statement in a function terminates the execution of the function, a return statement in
outside of a function will terminate the program.
```
ReturnStatement = "return" , [ expressionList ] ;
```

Within a function any number of values may be given for the result. If no values are given `nil` is
returned.

Outside of functions, only one number value may be given, this will be used as the return code for
the program. If no value is given, `0` will be the return code.

### Break statements
A break statement terminates execution of the innermost `for`, `until`, and `switch` statement.
```
BreakStatement = "break" ;
```

### Continue statements
A continue statement skips to the next iteration of a `for` or `until` statement.
```
ContinueStatement = "continue" ;
```

### Fallthrough statements
A fallthrough statement transfers the control of a `switch` statement to the next clause. It may
only be used as the final non-empty statement in a clause, and not the final clause.
```
FallthroughStatement = "fallthrough" ;
```

## Built-in functions
The built-in functions are predeclared identifiers. They are called like any other function.

### Append
The `append` function appends an item to an array, and assigns a key/value to a object.

When appending to an array, the first argument is the array, the second being a variadic argument
containing any number of items to add to the array.

When appending to a object, the first argument is the object, the second being the key, and finally
a value for the key. If the value for the key is not given, will be set to `nil`.

The return value of `append` is `nil`.

### Copy
The `copy` function creates a shallow copy of an array or object.

The first argument is the array or object to copy and the return value is a shallow copy of the
argument with the same type.

### Delete
The `delete` function removes a key/value from an object.

The first argument is the object, and the second is the key to remove. If the key doesn't exist
or the object is `nil` delete is a no-op.

The return value is `nil`.

### Len
The `len` function retrieves the length of types including `string`, `array`, and `object`.

The only argument is the value to get the length of. The length of different types is as follows:

- String length is the number of bytes.
- Array length is the number of elements.
- Object length is the number of keys.

The return value is a number.

### Typeof
The `typeof` function retrieves the type of a given expression.

The only argument is the value to get the type of. The return value is a string.

repository: larzconwell/swish

repo_name: larzconwell/swish


text:
# Releasing
1. Update version number in [gradle.properties](gradle.properties), [CHANGELOG.md](CHANGELOG.md), and [README.md](README.md) and merge the PR
2. Run publish task in [bacon](https://bacon-go.aue1e.saasure.net/tasks/RUN_GRADLE_PUBLISH_TASK)
1. Selecting artifact `okta-oidc-android`
2. Setting ROBO_ACTUAL_COMMAND to `gradleOpenPublish`
3. `git checkout master && git pull`
4. `git tag -s -a 1.0.0 -m "Release 1.0.0"` - Update the version number to the one you're trying to publish
5. `git push --tags`
6. Update [github release page](https://github.com/okta/okta-oidc-android/releases) with the latest release notes

## Local Publishing
If the bacon task above isn't available, you can publish locally via:
1. `./gradlew publish --rerun-tasks -PsignWithGpgCommand`
2. `./gradlew closeAndReleaseRepository`

## Generating GPG Keys
- TLDR: `gpg --gen-key`
- [Maven Central GPG Docs](https://central.sonatype.org/publish/requirements/gpg/)

## Other means of signing
- See [Publishing Docs](https://github.com/vanniktech/gradle-maven-publish-plugin#signing)
- If using an in memory GPG Key:
    - Export the secret key with something along the lines of `gpg --output ~/Desktop/OktaPrivate.pgp --armor --export-secret-key<EMAIL_ADDRESS>    - Then you can format it correctly using something along the lines of `cat ~/Desktop/OktaPrivate.pgp | grep -v '\-\-' | grep -v '^=.' | tr -d '\n'`

repository: okta/okta-oidc-android

branch_name: refs/heads/master

extension: md

gha_language: Java

gha_license_id: NOASSERTION

license_type: permissive

repo_name: okta/okta-oidc-android


text:
# Usage
First you need to build.
## Build
From the project root.
``` shell
mkdir build && cd build && cmake .. && make
```
## Run
In the build folder you will find the executable. Run it with flag '--help' for info.

license: MIT


text:
---
hrs_structure:
  division: '1'
  volume: '6'
  title: '19'
  chapter: '329'
  section: 329-70
type: hrs_section
tags:
  - Government
menu:
  hrs:
    identifier: HRS_0329-0070
    parent: HRS0329
    name: 329-70 Forfeiture
weight: 43285
title: Forfeiture
full_title: 329-70 Forfeiture
---
**§329-70** **Forfeiture.** (a) Precursor chemicals that are possessed, transferred, sold, or offered for sale in violation of this part shall be subject to seizure and forfeiture as provided in chapter 712A.

(b) All conveyances, including aircraft, vehicles, or vessels that are used, or intended for use, to transport or in any manner facilitate the transportation of precursor chemicals for a purpose that would constitute a violation of section 329-65(c) or (d), shall be subject to seizure and forfeiture as provided in chapter 712A.

(c) All moneys, negotiable instruments, securities, or other things of value furnished or intended to be furnished by any person in exchange for any of the substances listed in section 329-61 that facilitate any violation of section 329-65(c) or (d), and all proceeds traceable to such an exchange, and all moneys, negotiable instruments, and securities used or intended to be used to facilitate any violation of section 329-65(c) or (d), shall be subject to seizure and forfeiture as provided in chapter 712A. [L 1990, c 200, pt of §1; am L 2008, c 185, §1]

repository: SamMade/BlueAndKrabby

repo_name: SamMade/BlueAndKrabby


text:
# Earsonics Velvet Pot Centered
See [usage instructions](https://github.com/jaakkopasanen/AutoEq#usage) for more options and info.

### Parametric EQs
In case of using parametric equalizer, apply preamp of **-6.1dB** and build filters manually
with these parameters. The first 5 filters can be used independently.
When using independent subset of filters, apply preamp of **-6.0dB**.

| Type    | Fc       |    Q | Gain    |
|:--------|:---------|:-----|:--------|
| Peaking | 37 Hz    | 0.74 | -5.9 dB |
| Peaking | 89 Hz    | 1.75 | -4.2 dB |
| Peaking | 1546 Hz  | 0.97 | -6.2 dB |
| Peaking | 3016 Hz  | 1.39 | 5.1 dB  |
| Peaking | 4106 Hz  | 1.52 | 3.2 dB  |
| Peaking | 249 Hz   | 2.67 | 3.6 dB  |
| Peaking | 4728 Hz  | 5.51 | -2.1 dB |
| Peaking | 5893 Hz  | 2.41 | 2.9 dB  |
| Peaking | 7072 Hz  | 4.75 | -3.9 dB |
| Peaking | 14681 Hz | 3.88 | -1.8 dB |

### Fixed Band EQs
In case of using fixed band (also called graphic) equalizer, apply preamp of **-6.8dB**
(if available) and set gains manually with these parameters.

| Type    | Fc       |    Q | Gain    |
|:--------|:---------|:-----|:--------|
| Peaking | 31 Hz    | 1.41 | -5.2 dB |
| Peaking | 62 Hz    | 1.41 | -5.1 dB |
| Peaking | 125 Hz   | 1.41 | -3.5 dB |
| Peaking | 250 Hz   | 1.41 | 3.9 dB  |
| Peaking | 500 Hz   | 1.41 | -1.1 dB |
| Peaking | 1000 Hz  | 1.41 | -3.7 dB |
| Peaking | 2000 Hz  | 1.41 | -3.0 dB |
| Peaking | 4000 Hz  | 1.41 | 7.1 dB  |
| Peaking | 8000 Hz  | 1.41 | -1.3 dB |
| Peaking | 16000 Hz | 1.41 | -0.7 dB |

### Graphs
![](./Earsonics%20Velvet%20Pot%20Centered.png)

repository: inflextion/AutoEq

path: /results/innerfidelity/sbaf-serious/Earsonics Velvet Pot Centered/README.md

repo_name: inflextion/AutoEq


text:
# Ivana and Kevin's Wedding Site
To help you gain insight into the puzzle, wrapped in an enigma, that is Kevana.

## Install

Clone this repo
```sh
git clone https://github.com/khxu/kevana
```

Install the GatsbyJS CLI:
```sh
npm install --global gatsby-cli
```

cd into this repo and install the dependencies
```sh
cd kevana
npm install
```

Then you can run it by:
```sh
gatsby develop
```

## Deploy

Build the static pages using the Gatsby CLI
```sh
gatsby build
```

Deploy the new version using Firebase Hosting
```sh
firebase deploy
```


text:
# comic server

## need few API

### GET /updates

Get latest updated comics. Returns a list of [comic object].

#### Optional Parameters

* offset
    * Start point of the list. Default is 0.
* length
    * The list length. Default is 30.

### GET /comics/{comic_id}

Get a [comic object] by the given ID.

### GET /comics/{comic_id}/episodes

Get a [episode list] by the given ID.

### GET /comics/{comic_id}/episodes/{episode_id}/pages

Get a [page list] by the given ID.

## need few tasks

```python
def from_latest_update():
    for updated_comics in fetch_latest_updates():
        with WriteLock(global_comic_queue):
            for comic_id in updated_comics:
                global_comic_queue.push(comic_id)

def process_comic_queue():
    with WriteLock(global_comic_queue):
        comic_id = global_comic_queue.pop()
    comic_data = fetch_and_parse_comic_page(comic_id)
    with WriteLock(global_data_base):
        global_data_base.add(comic_data)
```

## fields needed in each comic

* ID
* title
* cover image URL
* the latest update time-stamp
* the latest episode ID
* full episode list
* author
* publisher

## fields needed in each episode

* ID
* comic ID
* page image URL list

## tables

* refresh_queue
    * id
    * comic_id
    * url
    * dirty

repository: legnaleurc/atecomic

repo_name: legnaleurc/atecomic


text:
# 521. Remove Duplicate Numbers in Array

- **Description**
    - Given an array of integers, remove the duplicate numbers in it.

        - Move the unique numbers to the front of the array.
        - Return the total number of the unique numbers.
        - You don't need to keep the original order of the integers.
- **Example**
    - Given `nums = [1,3,1,4,4,2]`, you should:
    - Move duplicate integers to the tail of nums => nums = `[1,3,4,2,?,?]`.
    - Return the number of unique integers in nums => `4`.
    - Actually we don't care about what you place in `?`, we only care about the part which has no duplicate integers.
- **Challenge**
    - Do it in `O(n)` time complexity.
    - Do it in `O(nlogn)` time without extra space.

## Solution

```java
public class Solution {
    /*
     * @param nums: an array of integers
     * @return: the number of unique integers
     */
    public int deduplication(int[] nums) {
        // write your code here
        if (nums == null || nums.length == 0) {
            return 0;
        }

        Set<Integer> set = new HashSet<>();

        int left = 0, right = nums.length - 1;

        while (left < right) {
            if (!set.contains(nums[left])) {
                set.add(nums[left]);
                left++;
            } else {
                while (left < right && set.contains(nums[left])) {
                    swap(nums, left, right);
                    right--;
                }
            }
        }

        if (!set.contains(nums[left])) {
            return set.size() + 1;
        }
        return set.size();

    }

    private void swap(int[] nums, int left, int right) {
        int temp = nums[left];
        nums[left] = nums[right];
        nums[right] = temp;
    }

}
```

url: https://raw.githubusercontent.com/jxhangithub/lintcode/afd79d790d0a7495d75e6650f80adaa99bd0ff07/Easy/521. Remove Duplicate Numbers in Array/README.md

repository: jxhangithub/lintcode

repo_name: jxhangithub/lintcode


text:
---
layout: post
title: About
categories: [general]
tags: [noneYet]
description: ""
permalink: /about
---

## Waldron Lab Members and Links

* ### Levi Waldron, PhD [](https://github.com/lwaldron){:target="_blank"}[](https://twitter.com/LeviWaldron1){:target="_blank"}
* ### Marcel Ramos, MPH [](https://github.com/LiNk-NY){:target="_blank"}[](https://twitter.com/M2RUseR){:target="_blank"}
* ### Ludwig Geistlinger, PhD [](https://github.com/lgeistlinger){:target="_blank"}
* ### Lucas Schiffer, MPH [](https://github.com/schifferl){:target="_blank"}[](https://twitter.com/_schifferl){:target="_blank"}

---

## Additional Personnel

A complete list of Waldron Lab members in available at [http://waldronlab.org/people/](http://waldronlab.org/people/){:target="_blank"}.

---

### Modifying the index page

1. The index content is mostly generated automatically
2. The content appearing above the links can be modified using valid Markdown syntax
3. To change the content modify the content of the capture block, as shown below

{% raw %}
~~~~~~

{% capture index %}

Write valid Markdown syntax here to modify the contents of the index

{% endcapture %}

~~~~~~
{% endraw %}

---

### Adding pages to this website

1. First fork the [waldronlab][]{:target="_blank"} repository via git.
2. Add a new Markdown file in the _posts directory, following filename conventions of the other files.
3. Posts will be ordered by date and must include the apropriate "front matter" (see below).
4. Push changes to your repository and create a pull request on github.com.

*Note:* Please include "front matter" in each new markdown page as:

~~~~~~
layout: post
title: PageTitle
categories: [array, of, categories, here]
tags: [array, of, tags, here]
description: ""
permalink: /pagetitle
~~~~~~

*Note:* Please add target="_blank" to links via this syntax for kramdown:

~~~~~~
[Leanpub](https://leanpub.com){:target="_blank"}
~~~~~~

For more information on how to setup your own [Jekyll][]{:target="_blank"} powered GitHub.io site, please see this [website](http://www.stephaniehicks.com/githubPages_tutorial/pages/githubpages-jekyll.html){:target="_blank"}.

---

To file an issue with the website, go to the [github issue page][]{:target="_blank"}.

[waldronlab]: https://github.com/waldronlab/waldronlab.github.io/
[github issue page]: https://github.com/waldronlab/waldronlab.github.io/issues
[Jekyll]: http://jekyllrb.com/


text:
---
layout: default
---

# 1995-10-10 - Re: NSA Realists v. Nuts

## Header Data

From: "Perry E. Metzger"<EMAIL_ADDRESS>To: Duncan Frissell<EMAIL_ADDRESS>Message Hash: af527ded8dee1caa432231c0935906b0afa5d2ac0ea9e2cf248eb3e078e95e41

Message ID<EMAIL_ADDRESS>Reply To<EMAIL_ADDRESS>UTC Datetime: 1995-10-10 00:23:42 UTC

Raw Date: Mon, 9 Oct 95 17:23:42 PDT

## Raw message

```
{% raw  %}From: "Perry E. Metzger"<EMAIL_ADDRESS>Date: Mon, 9 Oct 95 17:23:42 PDT
To: Duncan Frissell<EMAIL_ADDRESS>Subject: Re: NSA Realists v. Nuts
In-Reply-To<EMAIL_ADDRESS>Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

As much as I agree with Duncan on this topic, it really isn't
cypherpunks material. We are getting very far afield of
cryptography. Could we please take this to private mail or
talk.politics.libertarian or some such?

Duncan Frissell writes:
> 2400 Americans are imprisoned every year for federal income tax
> violations.  Approximately one person is killed every year in arrests
> involving federal income tax violations.  Millions of man-years are spent
> annually in involuntary servitude to comply with tax laws.  Public
> employees should be aware of the fact that their contribution to society
> is of such low value that it will not be paid for without a gun to the
> customer's head.

{% endraw %}
```

## Thread

+ Return to [October 1995](/archive/1995/10)

+ Return to "[cjl <cjl@welchlink.welch.jhu.edu>](/authors/cjl_cjl_at_welchlink_welch_jhu_edu_)"
+ Return to "[Duncan Frissell <frissell@panix.com>](/authors/duncan_frissell_frissell_at_panix_com_)"
+ Return to "["Perry E. Metzger" <perry@piermont.com>](/authors/perry_e_metzger_perry_at_piermont_com_)"
+ Return to "[Rick Busdiecker <rfb@lehman.com>](/authors/rick_busdiecker_rfb_at_lehman_com_)"
+ Return to<EMAIL_ADDRESS>(Lucky Green)](/authors/shamrock_at_netcom_com_lucky_green_)"
+ Return to "["W. Kinney" <kinney@bogart.Colorado.EDU>](/authors/w_kinney_kinney_at_bogart_colorado_edu_)"

+ 1995-10-08 (Sun, 8 Oct 95 13:22:12 PDT) - [Re: NSA Realists v. Nuts](/archive/1995/10/6a02afea920bb4eb6ac17529cc647a0ab7a5a5c2e106f65833e7cb119d7154a2) -<EMAIL_ADDRESS>(Lucky Green)_
  + 1995-10-09 (Mon, 9 Oct 95 13:01:48 PDT) - [Re: NSA Realists v. Nuts](/archive/1995/10/d246378fe40afd038b86592c0246433b01752b91c2839b8e59e80e5d418d4ab6) - _Duncan Frissell<EMAIL_ADDRESS>    + 1995-10-09 (Mon, 9 Oct 95 13:32:30 PDT) - [Re: NSA Realists v. Nuts](/archive/1995/10/b0bca962f5e983cd66dfb3a20a71a95ee085ea44909f6c1c259fb6eef71f9fda) - _cjl<EMAIL_ADDRESS>      + 1995-10-09 (Mon, 9 Oct 95 15:07:10 PDT) - [Re: NSA Realists v. Nuts](/archive/1995/10/12a31aab241b54ded36c38052d6dcc076e5ff4ce80c6cdbb8e6c73442a412860) - _"W. Kinney"<EMAIL_ADDRESS>        + 1995-10-09 (Mon, 9 Oct 95 16:24:19 PDT) - [Re: NSA Realists v. Nuts](/archive/1995/10/58d81456b3d7889697eedeca2f9dc57ff7bff4684c9ff7c07a035de554ca95d6) - _Duncan Frissell<EMAIL_ADDRESS>          + 1995-10-10 (Mon, 9 Oct 95 17:23:42 PDT) - Re: NSA Realists v. Nuts - _"Perry E. Metzger"<EMAIL_ADDRESS>          + 1995-10-11 (Tue, 10 Oct 95 17:57:49 PDT) - [Re: NSA Realists v. Nuts](/archive/1995/10/d025218b4cd2304586837f0d3191f5d7d7bac37ba9417db82f7ee72863509ab3) - _Rick Busdiecker<EMAIL_ADDRESS>

gha_license_id: MIT


text:
---
layout: post
published: true
title: RPi4 - Initial configuration
subtitle: Part 1
tags: [raspberrypi, msmtp, ssh]
---

I truly like the Raspberry Pi and bought almost every model so far. One is driving my [3d printer]({% post_url 2018-03-02-octoprint-psucontrol %}), another one is playing non stop on [RecalBox](https://www.recalbox.com/), the first one is [dead](https://i.ytimg.com/vi/lYf9HK-rI1s/maxresdefault.jpg#fancy) (this one is from Google images :wink:) and the last one in the family is the brand new Raspberry Pi 4.
This model is not available in Singapore or is sold twice the price so I ended up buying a nice [Canakit](https://www.amazon.com/gp/product/B07VYC6S56/ref=ppx_od_dt_b_asin_title_s00?ie=UTF8&psc=1) on Amazon US.

Now what? It's time to set up the new ultimate home server! The tasks I would like to assign to my new beloved Pi are:

- [handle my home network (IPv4 and IPv6)]({% post_url 2019-10-07-pi4-part2 %})
- [docker everywhere]({% post_url 2019-10-08-pi4-part3 %})
- [pi-hole to filter the Internet]({% post_url 2019-10-13-pi4-part4 %})
- [VPN, torrent client and web proxy]({% post_url 2019-10-20-pi4-part5 %})
- [nginx as a web frontend for the containers + let's encrypt]({% post_url 2019-11-10-pi4-part6 %})
- home assistant / red node / mosquitto... for all my home automation stuff
- dozen of .Net core images because why not

## Warm-up

Let's start with the initial setup. Download the new [Raspbian Buster lite](https://www.raspberrypi.org/downloads/raspbian/) image and use [Etcher](https://www.balena.io/etcher/) to flash a micro SD card. I used a 64GB Sandisk Extreme MicroSD card but I already know it will be the bottleneck.
I will probably try to boot from an SSD drive later but it's currently [unsupported](https://www.raspberrypi.org/forums/viewtopic.php?t=243995) on the Raspberry Pi 4.

To launch the SSH service on startup, you need to create an empty `ssh` file in the root directory of the boot partition. Then you can connect the Raspberry Pi to your router and search for the assigned IP in the router DHCP leases table.

Once you got the IP, you can connect to the Raspberry Pi using the default credentials (`pi / raspberry`).

![Hello little Pi]({{site.baseurl}}/img/201910/rpi-first-login_thumb.jpg)

## Initial configuration

You can now finish the Raspberry Pi configuration. Start by executing `sudo apt update && sudo apt upgrade` and once the system is up to date, launch `sudo raspi-config` and execute the following changes (depending on your location and inspiration for the hostname):

- Set the hostname to `pisin`
- Change the locale to `en_SG.UTF-8 UTF-8`
- Change the timezone to `Asia/Singapore`
- Expand the filesystem to use the whole SD Card (in advanced options)
- And finally, reboot

### Create a new user

Let's create a new standard user account

```console
$ export NEWUSER=myuser

-- Create a new user
$ sudo adduser --gecos "" ${NEWUSER}

-- Add the user to some groups (to allow sudo and reading logs)
$ sudo adduser ${NEWUSER} sudo
$ sudo adduser ${NEWUSER} adm

-- Allow sudo without asking the user password
$ echo "${NEWUSER} ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/010_${NEWUSER}-nopasswd
```

### Remove pi account and improve system security

You can now login to your Raspberry Pi using your new user. Once logged, you can remove the old `pi` account, deactivate root login and restrict SSH authentication to public keys only.

```console
-- Add the SSH public key
$ mkdir .ssh
$ tee .ssh/authorized_keys << "EOF"
ssh-rsa AAAABC [PUBLIC KEY] XYZ
EOF

-- Remove the old pi account
$ sudo deluser pi
$ sudo rm -fR /home/pi /etc/sudoers.d/010_pi-nopasswd

-- Deactivate root login
$ sudo passwd -dl root

-- Deactivate SSH password authentication
$ sudo sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config
$ sudo systemctl restart ssh
```

Before closing the existing SSH session, Try to login by creating a new SSH session and check you can call `sudo` and get the root privileges.

## Extra configuration

### Install simple MTA

Even in 2019, it's still useful to receive emails. You can configure a simple MTA just in case.

```console
$ export MTA_DOMAIN=ssl0.ovh.net
$ export<EMAIL_ADDRESS>$ export MTA_PASSWORD=password
$ export<EMAIL_ADDRESS>
$ sudo apt install msmtp-mta bsd-mailx
$ sudo tee /etc/msmtprc << EOF
account default
auth on
host ${MTA_DOMAIN}
port 587
user ${MTA_USERNAME}
from ${MTA_USERNAME}
password ${MTA_PASSWORD}
tls on
tls_starttls on
tls_certcheck on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
aliases /etc/aliases
EOF

$ echo "default: ${RECIPIENT}" | sudo tee -a /etc/aliases
$ sudo newaliases
```

You can test the configuration with the command `echo "Message body" | mail -s "Test"<EMAIL_ADDRESS>and wait for the mail  (most probably in your spams folder).

### Automatically install security updates

You can install the package `unattended-upgrades` to keep the Raspberry Pi up to date with the latest security updates.

```console
$ sudo apt install unattended-upgrades

-- Add Raspberry specific origins
$ sudo sed -i 's/Debian-Security";$/Debian-Security"; \
> \t"origin=Raspbian,codename=${distro_codename},label=Raspbian"; \
> \t"origin=Raspberry Pi Foundation,codename=${distro_codename},label=Raspberry Pi Foundation"; \
> /g' /etc/apt/apt.conf.d/50unattended-upgrades

-- Enable mails reports
$ sudo sed -i 's/\/\/Unattended-Upgrade::Mail "";/Unattended-Upgrade::Mail "root";/g' /etc/apt/apt.conf.d/50unattended-upgrades
```

### Remove unused packages

Finally, you can remove some unused packages

```console
$ sudo apt-get remove avahi-daemon
$ sudo apt autoremove
```


text:
# mondo
A tool to build web-based presentations in the Socratic style

# HOW?

#### 1. Clone this repo into a throwaway directory in your project

    $ git clone https://github.com/pzel/mondo.git _mondo

#### 2. Write a markdown file in the following format:

    $ cat ./preso.qa
    Q:
    This is a question. All markdown is legal within the question, up to the next line with just
    "A:"
    on it.

    A:
    This is an answer. All markdown is legal within the answer, up to the next line with just
    "Q:"
    on it.

#### 3. Make a footer file:

    $ cat ./footer.html
    © 2017 Alyssa P. Hacker
    $

#### 4. Build your presentation:

    $ _mondo/build ./preso.qa ./footer.html 'This is the title' > preso.html

#### 5. Fork it, hack it, and teach people!

repository: pzel/mondo

repo_name: pzel/mondo


text:
# The Trials of Agrhial

This is a basic text adventure game where you can either gain or lose Morality Points (mp) depending on what you do. You can win the game by either achieving -100 mp or 100 mp. It is your choice how you would like to play. Game is still in the early stages of development.

## Contributing

If you see something wrong feel free to make an issue with what you see and how it could be fixed.
Pull Requests are always welcome as well.

gha_language: Python


text:
#React-Socket (Mixin)
A socket.io mixin for react.js components. Provides handlers that can be used for the react component lifecycle, and custom
connection/disconnection without losing client id.

This mixin presumes you have browserified both [lodash](https://github.com/lodash/lodash) and [socket.io-client](https://github.com/Automattic/socket.io-client).

###Todo:
- Document Methods in the Readme, as socket.io connections/reconnections aren't very sugary.
- Provide an example of use, both on the client side and server side.

repository: matthewoden/React-Socket

repo_name: matthewoden/React-Socket


text:
# Expresso-Telecomunnication-Prediction-model-on-whether-a-user-will-churn-from-using-the-Network
In this Zindi Challenge we were tasked with analysing factors that affect a user thus ceasing from been an Expresso Telecommunication Customer. We will analyse the factor(s) that most influnced a cusomer to leave the serivce provider. However, we will give suggestions of which factors are most essential to ensure that customers are satisfied reducing the possibility that a customer will churn from Expresso Telecommunications. Moreover, I will build a Machine Learning model that Predicts wheteher a customer is likely to churn or not based on the above analyzed factors
# Research Questions
To build a Machine Learning model that will help classify whether a user is likely to churn from been an Expresso Telocmmunication customer with a score of 85% and above.

# Regression Algorithms

# Experimental Design
Exploratory Data Analysis(EDA)

Modeling

# Setup and Installations
Google Collabs/ Jupyter Notebooks

# Python Libraries:
Pandas

Sklearn

Matplotlib

NLTK

# Known Bugs
None

# Technology Used
Python

# Contact
For questions,clarification or corrections Contact me at<EMAIL_ADDRESS>
# Licences
MIT Lincence


text:
Ansible Role: CVE-2016-3714
=========

[![Build Status](https://travis-ci.org/chusiang/CVE-2016-3714.ansible.role.svg?branch=master)](https://travis-ci.org/chusiang/CVE-2016-3714.ansible.role) [![Ansible Galaxy](https://img.shields.io/badge/role-CVE--2016--3714-blue.svg)](https://galaxy.ansible.com/chusiang/CVE-2016-3714/)

Fix **ImageMagick Command Injection (CVE-2016-3714)** security issue with Ansible.

Requirements
------------

Any installed imagemagick and before v<IP_ADDRESS> machine.

Role Variables
--------------

A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml.

    policy_path: "/etc/ImageMagick/policy.xml"
    injection_src: "/etc/passwd"
    injection_dest: "/tmp/hack.txt"

Dependencies
------------

none.

Example Playbook
----------------

Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:

    - hosts: servers
      roles:
         - { role: chusiang.CVE-2016-3714 }

License
-------

Copyright (c) chusiang from 2016 under the MIT license.


text:
# Additional Use Cases

The following use cases play a role in shaping the API design, but will be
implemented in future iterations.

* **Professional image editing tools with floating palettes**
  * Always keep the palettes on top of the main editor.
    ```js
    window.open("/palette", "palette", "alwaysOnTop");
    ```
  * Synchronously move the palettes when the main editor moves.
    ```js
    const palette1 = window.open("/palette/1", "palette1", "alwaysOnTop");
    const palette2 = window.open("/palette/2", "palette2", "alwaysOnTop");
    window.addEventListener("move", event => {
      palette1.moveBy(event.deltaX, event.deltaY);
      palette2.moveBy(event.deltaX, event.deltaY);
    });
    ```
  * Open dependent/child windows that the OS moves with a parent window.
    ```js
    const palette1 = window.open("/palette/1", "palette1", "dependent=true");
    ```
* **Finance applications with multiple dashboards**
  * Starting the app opens all the dashboards across multiple screens.
    ```js
    // Service worker script
    self.addEventListener("launch", event => {
      event.waitUntil(async () => {
        const screens = self.screens;
        const maxDashboardCount = 5;
        const usedScreenCount = Math.min(screens.length, maxDashboardCount);
        for (let screen = 1; screen < usedScreenCount; ++screen) {
          await clients.openWindow(`/dashboard/${screen}`, screens[screen]);
        }
      });
    });
    ```
  * Starting the app restores all the dashboards' positions from the previous
    session.
    ```js
    // Service worker script

    self.addEventListener("launch", event => {
      event.waitUntil(async () => {
        // Initialize IndexedDB database.
        const db = idb.open("db", 1, upgradeDb => {
          if (!upgradeDb.objectStoreNames.contains("windowConfigs")) {
            upgradeDb.createObjectStore("windowConfigs", { keyPath: "name" });
          }
        });

        // Retrieve preferred dashboard configurations.
        const configs = db.transaction(["windowConfigs"])
                          .objectStore("windowConfigs")
                          .getAll();
        for (let config : configs) {
          // Open each dashboard, assuming the user's screen setup hasn't changed.
          const dashboard = await clients.openWindow(config.url, config.screen);
          dashboard.postMessage(config.options);
        }
      });
    });

    // Record the latest configuration relayed by a dashboard that was just closed.
    self.addEventListener("message", event => {
      idb.open("db", 1)
         .transaction(["windowConfigs"], "readwrite")
         .objectStore("windowConfigs")
         .put(event.data);
    });
    ```
    ```js
    // Dashboard script

    window.name = window.location;

    // Configure dashboard according to preferences relayed by the Service Worker.
    window.addEventListener("message", event => {
      window.moveTo(event.data.left, event.data.top);
      window.resizeTo(event.data.width, event.data.height);
    });

    // Send dashboard's configuration to the Service Worker just before closing.
    window.addEventListener("beforeunload", event => {
      const windowConfig = {
        name: window.name,
        url: window.location,
        options: {
          left: window.screenLeft,
          top: window.screenTop,
          width: window.outerWidth,
          height: window.outerHeight,
        },
        screen: window.screen,
      };
      navigator.serviceWorker.controller.postMessage(windowConfig);
    });
    ```
  * Align dashboards relative to each other, or to the screen.
    ```js
    // Horizontally center dashboards 1 and 2, relative to each other.
    //   ______________           ______________
    //  | ____         |         |              |
    //  ||   x|   ____ |         |         ____ |
    //  ||    |  |   x||         | ____   |   x||
    //  || 1  |  |    ||         ||   x|  |    ||
    //  ||____|  |    ||   --->  ||    |  |    ||
    //  |        |  2 ||         || 1  |  |  2 ||
    //  |        |    ||         ||____|  |    ||
    //  |        |____||         |        |____||
    //  |______________|         |______________|
    //
    // NOTE: No new APIs used.
    function horizontallyCenter(dashboards) {
      let maxHeight = 0;
      let newCenter;
      for (dashboard in dashboards) {
        if (dashboard.outerHeight > maxHeight) {
          maxHeight = dashboard.outerHeight;
          newCenter = dashboard.screenY + dashboard.outerHeight / 2;
        }
      }
      for (dashboard in dashboards) {
        const oldCenter = dashboard.screenY + dashboard.outerHeight / 2;
        dashboard.moveBy(0, oldCenter - newCenter);
      }
    }
    ```
  * Snap dashboards into place when moved, according to a pre-defined
    configuration of window positions.
    ```js
    // Reposition/resize window into the nearest left/right half of the screen when
    // programatically moved or manually dragged then dropped.
    window.addEventListener("windowDrop", event => {
      const windowCenter = window.screenLeft + window.outerWidth / 2;
      const screenCenter = window.screen.availLeft + window.screen.availWidth / 2;
      const newLeft = (windowCenter < screenCenter) ? 0 : screenCenter;
      window.moveTo(newLeft, 0);
      window.resizeTo(window.screen.width, window.screen.height);
    });
    ```
* **Small form-factor applications, e.g. calculator, mini music player**
  * Launch the app with specific (or bounded) dimensions.
    ```js
    // Service worker script
    self.addEventListener("launch", event => {
      event.waitUntil(async () => {
        // At most 800px wide.
        const width = Math.min(window.screen.availWidth * 0.5, 800);
        // At least 200px tall.
        const height = Math.max(window.screen.availHeight * 0.3, 200);

        window.resizeTo(width, height);
      });
    });
    ```

repository: christianliebel/window-placement

repo_name: christianliebel/window-placement


text:
# Stemphylium botryoideum (Cooke) Sacc., 1886 SPECIES

#### Status
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Syll. fung. (Abellini) 4: 521 (1886)

#### Original name
Epochnium botryoideum Cooke, 1883

### Remarks
null

repository: mdoering/backbone

path: /life/Fungi/Ascomycota/Helicorhoidion/Helicorhoidion botryoideum/ Syn. Stemphylium botryoideum/README.md

repo_name: mdoering/backbone


text:
---
layout: single
excerpt: "A question on the YALMIP forum essentially boiled down to *how can I generate sum-of-squares solutions which really are feasible, i.e. true certificates?*"
title: Strictly feasible sum-of-squares solutions
tags: [Sum-of-squares programming]
header:
  teaser: sospositive.png
date: '2011-02-09'
---

A question on the [YALMIP forum](http://sedumi.ie.lehigh.edu/index.php?option=com_kunena&Itemid=78&func=showcat&catid=19) on the SeDuMi homepage essentially boiled down to *how can I generate sum-of-squares solutions which really are feasible, i.e. true certificates?*

This is partially answered and discussed in one of the [sum-of-squares examples](/example/moresos) and the referenced paper [Löfberg 2009](/reference/lofberg2009). The problem boils down to the fact that semidefinite solvers typically work with infeasible methods. Hence, the optimal solution you obtain in the end is very often slightly infeasible.

## The semidefinite programs

When YALMIP sets up a sum-of-squares problem, there are two alternative approaches. The first approach, which is used by default, is the kernel representation, sometimes called primal form in YALMIP. You can explicitly tell YALMIP to use this form by setting sos.model to 1 in [sdpsettings](/command/sdpsettings) when calling [solvesos](/command/solvesos).

![Primal form]({{ site.url }}/images/primalform.gif){: .center-image }

An alternative approach, which typically is the approach seen when using pen and paper, is the image representation, also called dual form. This form is typically less efficient computationally, but is easier to understand, and is the only applicable method when parametric variables have advanced constraints, such as integer constraints or additional nonconvex constraints. YALMIP use this form by setting the option sos.model to 2. Of course, the data (**C**,**A**,**b**,**F**,**f**) is different in the two models, otherwise it would make no difference since most solvers solve the primal and the dual problem simultaneously.

![Dual form]({{ site.url }}/images/dualform.gif){: .center-image }

The default value of the sos.model option is 0, which means that YALMIP makes the decision (almost always primal form).

As mentioned earlier, most [SDP solvers](/tags/#semidefinite-programming-solver) work with infeasible methods. In practice, this means the equality constraints in the primal form typically are violated in the final solution, and the semidefinite constraint in the dual form is not satisfied. If the optimization problem originates from a sum-of-squares problem, this means the SDP solution has failed to create a true certificate of positivity, all it has done is shown that it is very close to being a sum-of-squares.

In the dual form, the sum-of-squares certificate is theoretically useless when the semidefinite constraint is violated. In primal form, it can be shown that it is possible to prove sum-of-squareness holds despite violation of constraints, by relating the smallest eigenvalue of \\(X\\) to the largest violation of the equality constraints, see [Löfberg 2009].

Hence, we would like to force the SDP solver to return a feasible solution, or even better, a significantly strictly feasible solution (assuming you have created a model for which such a solution really exists).

### An example

As an example, consider the problem of finding a lower bound on \\(p(x,y) = (1+xy)^2-xy+(1-y)^2\\) over the box \\(-5\leq (x,y)\leq 5 \\) and \\(-5 \leq y\leq 5 \\)

![polynomial]({{ site.url }}/images/sospositive.png){: .center-image }

Define the polynomial \\(p(x,y)\\) and the constraints \\(g(x,y)\geq 0\\) defining the box

````matlab
sdpvar x y
p = (1+x*y)^2-x*y+(1-y)^2;
g = [5-x;5+x;5-y;5+y]
````

To solve the problem, we will apply the postivstellensatz using quadratic multipliers. Hence, we define 4 parameterized multiplier polynomials

````matlab
[s1,c1] = polynomial([x y],2);
[s2,c2] = polynomial([x y],2);
[s3,c3] = polynomial([x y],2);
[s4,c4] = polynomial([x y],2);
````

We apply stand sum-of-squares arguments and solve the following problem, for simplicity using the image representation.

````matlab
sdpvar lower
Constraints = [sos(p-lower-[s1 s2 s3 s4]*g), sos(s1), sos(s2), sos(s3),
sos(s4)];
Params = [c1;c2;c3;c4;lower];
ops = sdpsettings('sos.model',2);
[sol,v,Q] = solvesos(Constraints,-lower,ops,Params);
````

For this to really be a certificate, all Gramians, returned in the output '''Q''', should be positive semidefinite. This is however not the case for most solvers.

````matlab
>> min(eig(Q{1}))

ans =

   -9.634448808807465e-009
````

Close to 0 and the optimal value of the lower bound is probably correct (within reasonable tolerances), but we really do not have a true certificate.

To overcome this, one trick is to use the fact that semidefinite solvers typically return solutions in the analytic center of the feasible region, when a feasibility problem is solved, i.e., if a strict interior exists, we will obtain a strictly feasible solution. A feasibility problem will however not return an optimal solution, of course. To circumvent this, we add a new constraint forcing the solver to return a feasible solution which is very close to optimal value. Hence, we resolve the problem with the requirement that we should be within 1/10000 from the previously computed optimal objective value.

````matlab
FeasibilityConstraints = [Constraints, lower >= 0.99999*value(lower)];
[sol,v,Q] = solvesos(FeasibilityConstraints,[],ops,Params);
````

Indeed, a strictly feasible (very close to optimal) solution is returned

````matlab
>> min([eig(Q{1});eig(Q{2});eig(Q{3});eig(Q{4});eig(Q{5})])
ans =
   1.2738e-007
````

For the default case when the kernel model is used, the fourth argument from [solvesos](/command/solvesos), the residuals from the equality constraints, have to be involved in the analysis, see [Löfberg 2009].

Note that this whole discussion here only is relevant if you absolutely have to have a true numerical certificate. In most cases, if the solver finishes without any complaints and the solution is slightly infeasible, it is up to your discretion to judge if it can be used anyway.

### Suitable reading

[Parrilo 2003](/reference/parrilo2003)

[Löfberg 2009](/reference/lofberg2009)

[Introduction to sum-of-squares in YALMIP](/tutorial/sumofsquaresprogramming)

[Advanced sum-of-squares in YALMIP](/example/moresos)

gha_language: HTML


text:
# ben-loves-vectors
A node package for vectors and matrices of arbitrary size and dimension.

Create vectors by calling `new Vector(array)`, for example:

```javascript
let v = new Vector([1,2,3]);
```
`v` is a 1-dimensional vector of length 3, with components 1, 2 and 3.

Higher dimensional vectors are created with nested arrays, and are represented by the module as vectors of vectors.

```javascript
let v2D = new Vector([[1,2,3],[4,5,6]]);
```
`v2D` represents the 2D matrix:
```
1 2 3
4 5 6
```

## High Level Functions

* size
* magnitude
* normalise
* transpose
* negate
* add
* addScalar
* sub
* subScalar
* multiplyScalar
* multiplyElementWise
* matrixMultiply
* divideScalar
* equals
* isAVector
* floor

## Low Level Functions

These functions act on the arrays wrapped in vector objects.

* vector.map
* vector.reduce
* zip
* cascadeMap
* cascadeReduce

## Vector Creation Functions

* create
* create2
* create2x2
* createRandom
* createWithDimensions

repository: benmosheron/coffee

gha_language: JavaScript

repo_name: benmosheron/coffee


text:
# About
Android Starter Kit was created as a way to save time when
starting a new Android project. It is a simple native
single-module app based on [MVVM](https://developer.android.com/jetpack/guide)
architecture with required and optional libraries
(marked with //TODO Optional).

## Libraries

- Android
    - [AndroidX Core][1]
    - [AndroidX Appcompat][2]
- Architecture
    - [AndroidX Lifecycle][3]
- Dependency Injection
    - [Koin][4]
- Network
    - [Retrofit][5]
    - [GSON][6]
    - [OkHttp][7]
- UI
    - [Material Components][8]
    - [Constraint Layout][9]
- Optional
    - [Room][10]
    - [Paging][11]

[1]: https://developer.android.com/jetpack/androidx/releases/core
[2]: https://developer.android.com/jetpack/androidx/releases/appcompat
[3]: https://developer.android.com/jetpack/androidx/releases/lifecycle
[4]: https://insert-koin.io/docs/quickstart/android
[5]: https://square.github.io/retrofit/
[6]: https://github.com/google/gson
[7]: https://square.github.io/okhttp/
[8]: https://material.io/develop/android/docs/getting-started
[9]: https://developer.android.com/jetpack/androidx/releases/constraintlayout
[10]: https://developer.android.com/jetpack/androidx/releases/room
[11]: https://developer.android.com/topic/libraries/architecture/paging

## Getting started
1) Clone this project.
2) Open in Android Studio.
3) Sync Gradle.
4) Change the git remote repository to a new project remote repository.

## Additional functionality

### Paging

To avoid a lot of boilerplate code when create DataSource
was created **PositionalNetworkStateDataSource**.
It is used in a pair with **RetryListing** and **NetworkStateAdapter**.
More information about using in [paging package](https://github.com/roonyx-tech/android-starter/tree/master/app/src/main/java/tech/roonyx/android_starter/ui/paging).

Example of using in **Repository**:
```kotlin
fun getMessageListing(
    viewModelScope: CoroutineScope,
    pageSize: Int
): RetryListing<String> = PositionalNetworkStateFactory(viewModelScope) { startAt, limit ->
    api.getMessages(startAt, limit)
}.createRetryListing(pageSize)
```

## License

[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/roonyx-tech/android-starter/blob/master/LICENSE)

repository: roonyx-tech/android-starter

repo_name: roonyx-tech/android-starter


text:
# #113 TTLBufferDriver

Using an OpAmp as a final buffer stage for TTL or similar circuits

## Notes

TTL devices and other logic circuits often need to chain to other circuits.
A buffer is generally needed to ensure there is a good impedence match to the following circuit,
and also to ensure a consistent signal is passed on.

OpAmp buffers can be used to provide unity gain and isolate the input and output sides.

This circuit uses an LM324 configured as a comparator in order to "clean up" the output of an
imperfect [Resistor-Transistor Logic AND Gate](../ResistorTransistorLogic/AND).

With a 5V power supply, the basic AND gate drives a 3.8V output when both transistors are on, and 0V when both are off.
But when the lower transistor is on, there's gate-emitter leakage resulting in a semi-on state of about 1.9V.

The voltage divider Rd1/Rd2 set the 0/1 threshold for the OpAmp comparator at half-way (2.5V), so the resulting output is
a clean ON or OFF - nothing in between.

Here's a sample trace. The lower two traces are the inputs to the AND gate.
The top trace is the output of the OpAmp, and the lower-top trace is the output of the AND gate.

![processing trace](./assets/processing_trace.png?raw=true)

The Arduino is not really a core part of the circuit. It only does the following:
* provides +5V power supply (for convenience)
* automates the toggling of the driving inputs
* measures the input and output voltages for plotting

## Construction

![Breadboard](./assets/TTLBufferDriver_bb.jpg?raw=true)

![The Schematic](./assets/TTLBufferDriver_schematic.jpg?raw=true)

![The Build](./assets/TTLBufferDriver_build.jpg?raw=true)

## Credits and References

* [LM324 Datasheet](https://www.futurlec.com/Linear/LM324N.shtml)
* [2N3904 datasheet](https://www.futurlec.com/Transistors/2N3904.shtml) - the NPN used in this circuit
* [Resistor-Transistor Logic AND Gate](../ResistorTransistorLogic/AND) - the basic AND gate project without buffer

repository: tardate/LittleArduinoProjects

repo_name: tardate/LittleArduinoProjects


text:
# Hex literals without proc macros.

This crate implements minimalistic hex literal macros without use of proc macros.
The advantages are much faster compile times, ability to work with non-literal const values and
easier auditing.
However, because of the use of `const fn` the crate has some limitations depending on the Rust
version.

Either way, the resulting type is a byte array (`[u8; N]`) that doesn't force you to write down
its length. This is already very useful since the compiler can prove the length and you avoid
runtime allocations.

The crate is `no_std` and does **not** require an allocator.

## Usage

Just pass a `&str` *constant* (usually a literal) into the hex macro.

Example

```rust
use hex_lit::hex;

let array = hex!("2a15ff");
assert_eq!(&array, &[42, 21, 255]);

```

The input MUST NOT contain any spaces or other separators and it MUST have even length.
Note that you can still separate long strings into chunks using the concat macro:

```rust
use hex_lit::hex;

let array = hex!(concat!(
    "0000002a000000",
    "ffffffffffffff",
));
assert_eq!(&array, &[0, 0, 0, 42, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255]);

```

## Features depending on Rust version

* 1.41.1+ - the MSRV, use in const contexts is impossible, only the hex! macro is available.
* 1.46.0+ - usage in const contexts is available and (regardless of cargo features) correctness
            of input is checked at compile time.
* 1.57+ - nicer error messages for bad inputs (regardless of cargo features)

## Cargo features

* `rust_v_1_46` - acknowledges bumping MSRV to 1.46+ and enables usage in const context.

Bumping MSRV is intentionally explicit.

Because of improved input checking it is recommended to use Rust 1.46+, prefereably 1.57+ in CI
even if your targeted MSRV is lower.

## License

MITNFA

gha_language: C


text:
# Wordlists:
Wordlists have a simple structure: One word per line.
Words should be sorted after frequency of occurrence.
A list should not contain curses, company names (or any trademarks) or political parties.
Note that the wordlists' filename should match the table name when using
'php artisan load:words --name=<filename> --name=<filename2> …' (so create a migration and migrate first).

# Development
While setting up the project, use 'php artisan load:words' to upload all
wordlists. To clear wordlists from the database, use
'php artisan unload:words --name=<table_name> --name=<table_name2> ...' or
'php artisan unload:words' (to clear all wordlist tables).

# Sources
words_en: https://github.com/first20hours/google-10000-english

repository: moritzschramm/typos

repo_name: moritzschramm/typos


text:
# @blockly/create-package [![Built on Blockly](https://tinyurl.com/built-on-blockly)](https://github.com/google/blockly)

A tool for creating a Blockly package based on a pre-existing template.

## Available templates
- plugin
- field
- block

## Usage

```
npx @blockly/create-package <plugin|field|block> <package-directory>
```

## Example Usage

```
npx @blockly/create-package plugin my-plugin
cd my-plugin
npm start
```

## License

Apache 2.0

repository: seldomU/blockly-samples

repo_name: seldomU/blockly-samples


text:
# Class 03 reading - Data Modeling & NoSQL Databases

## JS data modeling

- to manipulate something, you first need to know (define) what it is
- JS has only the 5 main datatypes (obj, arr, str, num, bool)
- best practices are common but not mandatory
  - bool for only 2 states
  - num when arithmetic operators might happen
  - str for language
  - arr for bundled data
  - obj for many layers of bundled data

## CRUD
- Create
- Read
- Update
- Delete

## Interfaces and Services - the 'Repository' design pattern

- services connect the operation to the data source (whatever it may be)

## Implementation

- implementation is the means of interating with the persistence layer (file, mongo, postgres)

## Normalization and Validation

- sanity check data before operating it to ensure proper format

## NoSQL database

- 'norma/tradtional' DBs like postgres, sql server, oracle are 'relational' (store in rows and columns) and link records via keys
- use a special language to access data
- noSql -> document storage based. Rather than data spread across records, it's all in 1 record (like a doc page)
- typically they are pure json, no real structure.
- good for 'read-heavy' usage and frequent aggregations

-noSql data modeling
  - start with what you need, rather than available data
  - you can have multiple docs if needed,the write time is expensive but the read is worth it

- ORM(mongoose) Object Relation Mapping - used for the service layer
- need a schema for the data types (type, required, case, enum, etc.)

-Cloud Databases
--There are a few alternatives to running Mongo locally for your web servers

- [MLab](https://www.mlab.com/) - remotely hosted mongoDB systems. Easily setup a free database (or pay for more horsepower). Works great with Heroku
- [Atlas](https://www.mongodb.com/cloud/atlas) - Cloud based, highly scalable Mongo DB
- [DynamoDB](https://aws.amazon.com/dynamodb/) - AWS NoSQL Database. Very highly scalable. Also provides a ‘mongoose’-like ORM called ‘dynamoose’
- [CosmosDB](https://cosmos.azure.com/) - The Microsoft Azure equivalent for Atlas and Dynamo

### Videos
- [sql vs nosql](https://www.youtube.com/watch?v=ZS_kXvOeQ5Y)
### Bookmark / Skim
- [nosql vs sql](https://www.thegeekstuff.com/2014/01/sql-vs-nosql-db/?utm_source=tuicool)
- [nosql modeling techniques](https://highlyscalable.wordpress.com/2012/03/01/nosql-data-modeling-techniques/)
- [mongoose api](https://mongoosejs.com/docs/api.html#Model)


text:
This repository is based on the RPi_Cam_Web_Interface.

Modifications are made to use the 12MP HQ Cam on a 0.5X CMount lens.
The webinterface is/will be optimized for use of this camera in this way.

**Running the software**

1) Start the webserver on the PI. Login with vnc or ssh, go to ~/RPi_Cam_Microscope on the raspberry, and execute ./start.sh

2) Open webbrowser on client machine / PC and go to the raspberry IP or URL in /html

3) For debugging:
    - Activate the debug helper in firefox if it is not.
    - Click the little grey bug in the url bar of firefox.
    - Select "Debug"
    - Bug will turn green.
    - Go to the URL to debug and start debugging

**Installation with PHP Storm**

It is based on development on a Linux system, and the PI with the cam connected.

1) Make the PI fixed on an IP (dhcp in router). Give it a symbolic name in the hosts file
2) Clone this repo on development PC: git clone<EMAIL_ADDRESS>RPi_Cam_Microscope
3) Make ssh available on PI
4) Add a host add tools -> deployment -> configuration. Use SFTP and add an ssh configuration. Make the rootpath on PI to RPi_Cam2. Mappings from development directory to . on Pi. Create the destination directory on the Pi.
5) Upload everything from development system to PI
6) chmod +x the shell scripts
7) On **RASPBERRY**, run ./install.sh. I Prefer autostart on no
8) It must be visible on http://\<ip raspberry>/html
9) Create second remote host Cam_Raspberry_html to /var/www/html. Map this to www on the development system
10) In /var/www on raspberry do: "sudo chmod g+w -R html"
11) Make this second remote host the default
12) Make sure the user you use in SSH is member of the group www-data (sudo usermod -a -G www-data pi, followed by sudo shutdown -r now)
13) tip: you can go to the pi with tools->Start ssh session...
14) To correct problem: https://intellij-support.jetbrains.com/hc/en-us/community/posts/207036445-Auto-upload-Failed-to-change-timestamp-of-the-file
chown the owner of the files from www-data to pi. In /var : sudo chown -R pi www
15) Install xdebug on PI with: https://xdebug.org/wizard
16) enable in the correct php.ini:
    [xdebug]

    remote_port=9000

    remote_host=\<ip of development machine\>

    remote_enable=on

17) Enable ports in ufw on raspberry (including 9000)
18) For remote debugging, install xdebug helper on firefox. Follow the steps outlined in PHP Storm including the validator
(this is not necessary when the remote system runs in docker on the same machine as PHPStorm)
19) In PHPStorm Setting->Language&Frameworks->PHP->Debug uncheck "ignore externale connections through unregistered server configurations" (or register the server configuration :))
20) The contents for /var/www are in wwwroot. This way we keep maximum compatibility with the original RPi_Cam software

**Do not forget to go to ~/RPi_Cam_Microscope on the raspberry, and execute ./start.sh after booting**

========================

**Additional Docs**

Most recent raspimjpeg source:

https://github.com/roberttidey/userland/tree/master/host_applications/linux/apps/raspicam

========================

**Some observations and other**

Network speed: measured with iperf, using pi as server. Do not forget opening port 5001 on pi (sudo ufw allow 5001). Ip address PI will be different for wlan then for eth (!)

Test with pi 3B+: eth up/download 94 Mbit/s; wlan up/download 39 Mbit/s. Seems in line with observation: eth is around 2x faster for transfer of large images then wlan.

---
www/poc can be run in testenvironment without pi, by using the included docker-compose. Just open terminal in www/poc, and run ./start.sh. Open localhost/microscopevue.php in browser. Don't forget to enable the mock api's in the source ;)

========================

**CAVEATS**

There seem to be a buggie thing in raspimjpeg and / or the software. When changing the buffer from anything else then the default raspimjpeg will crash. If this is changed, you have to remove the offending line in uconfig.

Fetching the image with axios is around 10x slower on firefox. Need to look into!

Using the manual whitebalance is somewhat quirky. value 100 = 1. Can be as high as 800 they say.
https://github.com/raspberrypi/firmware/issues/1215

========================

**EXPERIMENTAL WHITEBALANCE SETTINGS**

Note: in RPi_ the numbers must be multiplied by 100

ledring toplight: 4.05 (red) 1.23(blue)

========================

**The original Readme:**

Web based interface for controlling the Raspberry Pi Camera, includes motion detection, time lapse, and image and video recording.
Current version 6.6.11
All information on this project can be found here: http://www.raspberrypi.org/forums/viewtopic.php?f=43&t=63276

The wiki page can be found here:

http://elinux.org/RPi-Cam-Web-Interface

This includes the installation instructions at the top and full technical details.
For latest change details see:

https://github.com/silvanmelchior/RPi_Cam_Web_Interface/commits/master

This version has updates for php7.3 / Buster. May need further changes for nginx


text:
# Spherical-Harmonic-Transform-JS
Javascript routines for real spherical harmonic transform and interpolation of spherical data.

---
>
> Archontis Politis, 2016
>
><EMAIL_ADDRESS>>
---

## Description

This small library contains the basic routines for computation of the spherical harmonic transform of spherical functions or data. Real spherical harmonics ```R_{nm}``` of order ```n``` and degree ```m``` are used, of the form

```
R_{nm}(\theta,\phi) =
\sqrt{(2n+1)\frac{(n-|m|)!}{(n+|m|)!}} P_l^{|m|}(cos\theta) N_m(\phi)
```

where

```
N_m(\phi) = \sqrt{2} cos(m\phi},    m>0
N_m(\phi) = 1,                      m=0
N_m(\phi) = \sqrt{2} sin(|m|\phi},  m<0
```

and with ```P_l^{|m|}``` being the unnormalized associated Legendre functions. The functions in this convention are orthogonal, with an integrated product of ```4\pi```.

The library contains routines for the forward transform, based on either a weighted summation formula, suitable for certain sampling grids, or by a least-squares solution, suitable for more general and unstructured smapling points. The inverse transform can be used for reconstruction and spherical interpolation of the underlying distribution of the sampled data, at any direction.

Additional to the transform, rotation of spherical functions directly in the spherical harmonic domain is implemented, using the fast recursive algorithm of [Ivanic & Ruedenberg](http://pubs.acs.org/doi/pdf/10.1021/jp953350u). The library uses some matrix algebra routines from the [numeric.js](http://www.numericjs.com/) library.

Some uses of the library may be spectral analysis of spherical functions, analysis of directional data, interpolation of data on a sphere, and whatever involves spherical harmonics.

## Installation

If you use Node.js and NPM, you can install the library by

```
npm install spherical-harmonic-transform
```

in your ```node_modules``` directory, and then load it in your code by

```javascript
var sht = require('spherical-harmonic-transform');
```

If you intend to use it in the browser, you can directly include the generated bundle file inside the ```bundle``` directory in a ```<script/>``` tag

```html
<script src="spherical-harmonic-transform.js"></script>
```

The library is exposed globally as the variable ```sht```.

## Usage

The forward transform accepts data defined either as Cartesian vectors
```javascript
data = [ [x_1,y_1,y_1], ..., [x_K, y_K, z_K] ]
```
or in spherical coordinates as
```javascript
data = [ [azi_1,elev_1,r_1], ..., [azi_K, elev_K, r_K] ]
```
with the syntax
```javascript
var sphSpectrum = sht.forwardSHT(maxOrder, data, CART_OR_SPH, DIRECT_OR_PINV)
```

The ```maxOrder``` should be a positive integer or zero, and defines the maximum order up to which all spectral coefficients are going to be computed. For a ```maxOrder``` of ```N```, ```(N+1)^2``` coeffs are returned. The choice of ```maxOrder``` should depend on the variability of the data and the number and arrangement of the sampling points. The flag ```CART_OR_SPH``` should be ```0``` for Cartesian vectors or ```1``` for spherical vectors. The flag ```DIRECT_OR_PINV``` should be ```0``` for an SHT by weighted summation, or ```1``` for a least-squares SHT. Spherical directions are azimuth and elevation, defined in rads.

The inverse transform is applied as
```javascript
var data = sht.inverseSHT(sphSpectrum, aziElev)
```
and reconstructs the function from its spherical spectrum, at directions defined in ```aziElev = [ [azi1,elev1], ..., [azi_M, elev_M] ]```. The ```data``` vector of length ```M``` returns the reconstructed or interpolated values.

Spherical harmonics can be computed for multiple directions ```aziElev = [ [azi1,elev1], ..., [azi_M, elev_M] ]``` by
```javascript
var sphHarm_mtx = sht.computeRealSH(maxOrder, aziElev)
```
with all harmonics up to order ```N``` returned as
```javascript
sphHarm_mtx = [ [R_00(azi1,elev1), ..., R_00(azi_M,elev_M)],
                ...,
                [R_nm(azi1,elev1), ..., R_nm(azi_M,elev_M)],
                ...,
                [[R_NN(azi1,elev1), ..., R_NN(azi_M,elev_M)] ]
```

A spherical distribution can be rotated directly by applying a rotation matrix on its spherical spectrum. Such a matrix can be computed by
```javascript
var sphRot_mtx = sht.getSHrotMtx(Rxyz, maxOrder)
```
where ```maxOrder``` defines the maximum order of coefficients that are to be rotated, and ```Rxyz``` is a standard rotation matrix that describes the intended rotation of the coordinate system. If ```maxOrder = N```, the resulting matrix is of size ```(N+1)^2 x (N+1)^2```.

Associated legendre functions are computed internally by ```sht.computeRealSH```. If you need to compute them directly, a fast recursive function is included that computes all ```n+1``` polynomials for a certain degree ```n```, based on the polynomials of the two preceding degrees
```javascript
var P_n = sht.recurseLegendrePoly(n, x, Pn_minus1, Pn_minus2)
```
For ```n<4``` you don't need to implement the recursion, and the values are returned directly.

---

Apart from the above there are a few utility functions included.

The two routines
```javascript
var aziElevR = sht.convertCart2Sph(xyz, OMIT_MAG)
var xyz = sht.convertSph2Cart(aziElevR)
```
convert Cartesian vectors to spherical vectors, and inversely. If ```OMIT_MAG=1``` then only azimuth and elevation is returned (e.g. in case of unit vectors). Similarly if ```aziElevR``` does not include radius, unit vectors are returned.

A recursive factorial function is included as
```javascript
var fact = sht.factorial(N)
```

Two pseudo-inverse routines are included, borrowed from examples found in ```numeric.js```:
```javascript
var pinvA = sht.pinv_direct(A)
var pinvB = sht.pinv_svd(B)
```
where the first implements the left pseudo-inverse directly, while the second is based on the singular value decomposition.

A routine for generation of a standard rotation matrix is included, based on a Z-Y'-X'' convention
```javascript
var Rzyx = yawPitchRoll2Rzyx(angleZ, angleY, angleX)
```

## License

The library is released under the [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause).


text:
# 3D MNIST: PyTorch Lighting

[![GitHub Super-Linter](https://github.com/michaeltinsley/3D-MNIST-PyTorch-Lightning/workflows/Lint%20Code%20Base/badge.svg)](https://github.com/marketplace/actions/super-linter)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

A 3D MNIST model, built mainly just to play with
[PyTorch Lightning](https://github.com/PyTorchLightning/pytorch-lightning).

## Dataset

The 3D MNIST dataset is available from [Kaggle](https://www.kaggle.com/daavoo/3d-mnist).
The PyTorch Lightning data module downloads the dataset with the [Kaggle API](https://github.com/Kaggle/kaggle-api).
Kaggle credentials must [be provided](https://github.com/Kaggle/kaggle-api#api-credentials).

## Model

A simple 3D CNN model.

![model](./media/model.onnx.png)

branch_name: refs/heads/main


text:
# songbook-api

This is the backend/API for my songbook -- see [the frontend's README](https://github.com/AnotherKamila/songbook-web) for more info.

[![Heroku status](https://heroku-badge.herokuapp.com/?app=spevnik47-api)](https://spevnik47-api.herokuapp.com/)
[![Requirements Status](https://requires.io/github/AnotherKamila/songbook-api/requirements.svg?branch=master)](https://requires.io/github/AnotherKamila/songbook-api/requirements/?branch=master)
[![Floobits Status](https://floobits.com/kamila/songbook.svg)](https://floobits.com/kamila/songbook/redirect)

Development Quick Start
-----------------------

Note: This is the API server. The web frontend is [AnotherKamila/songbook-web](https://github.com/AnotherKamila/songbook-web).

- requires Python 3.4
- first-time setup:
  1. create virtualenv: `pyvenv ./venv` (or `pyvenv-3.4 ./venv`)
  2. activate virtualenv:
     - bash, zsh: `source venv/bin/activate`
     - fish: `. venv/bin/activate.fish`
     - csh, tcsh: `source venv/bin/activate.csh`
  3. Install dependencies: `pip install -r requirements.txt`
- always do stuff inside the venv (don't forget to activate it)
- start server with `python ./server.py` (or `heroku local`)
  - automatically reloads when sources change
- requires the `REDISCLOUD_URL` environment variable to be set to your Redis URL
- read `database.md` for the data model and how stuff is stored

repository: AnotherKamila/songbook-api

repo_name: AnotherKamila/songbook-api