text:
---
layout: post
tag : Learning Python and SAS
category: "Python for SAS"
title: "Mastering directories"
description: Mastering paths allows us to make our code portable and less error prone.
author: Sarah Chen
image: images/posts/photos/IMG-0682.jpg

---
![](images/posts/photos/IMG-0682.jpg)
Say we are doing some data analysis.  And our project directory has two folders that contains code and inputs: code and data.

We want to read data from the data folder, run code from the code folder, and output our analysis results with plots in .png and analysis in .txt files.

|  Name   | In/Out   |
|:------- |:-------- |
| code    | the file |
| data    | input    |
| images  | output   |
| analysis| output   |

Mastering paths allows us to make our code portable and less error prone.

What portable means that whoever receives our code and files can run it on their computer without running into errors.  They do not have to update folder path names in the code.

# 1. Create directory
When we run a lot of analysis, we can automate creating the directories.
os.path.exists returns True/False given whether the folder in question exists or not.  os.path.exists goes ahead with making the folder if it is not there.

codecreate directory.py

```python
In [1]: import os
   ...: os.mkdir('demo')
   ...: folder_list=['code','data','images','analysis']
   ...: def makedir(folder):
   ...:     if not os.path.exists(folder):
   ...:         os.mkdir(folder)
   ...: for folder in folder_list:
   ...:     makedir('demo/'+folder)
   ...: os.listdir('demo/')
   ...:
Out[1]: ['analysis', 'code', 'data', 'images']

```
If we happen to have an old folder with the same name, we need to remove it first. Otherwise the above will run into errors.

coderemove directory.py

```python
import shutil
shutil.rmtree('demo', ignore_errors=True)
```

# 2. Access directory, content and change directory
When we need to know where we are, use os.getcwd().   To change that, use os.chdir() with full path as the parameter or use "./" with relative path.

os.path.getsize gives the size of a file (not folder).

codelearn_path.py

```python

In [2]: os.getcwd()
Out[2]: 'C:\\Users\\sache'

In [3]: os.chdir('demo')

In [4]: os.getcwd()
Out[4]: 'C:\\Users\\sache\\demo'

In [5]: os.listdir()
Out[5]: ['analysis', 'code', 'data', 'images']

```

# 3. Move files to where we want
Now we have set up the folder structure, we need to get the input files, some of which may come from another folder.   os.getcwd().   To change that, use os.chdir() with full path as the parameter or use "./" with relative path.

os.path.getsize gives the size of foler.  Because we just created the folder, it has size 0.

codemove_files.py

```python

In [9]: import os, shutil, pathlib, fnmatch^M
   ...: ^M
   ...: def move_dir(src: str, dst: str, pattern: str = '*'):^M
   ...:     if not os.path.isdir(dst):^M
   ...:         pathlib.Path(dst).mkdir(parents=True, exist_ok=True)^M
   ...:     for f in fnmatch.filter(os.listdir(src), pattern):^M
   ...:         shutil.move(os.path.join(src, f), os.path.join(dst, f))^M
   ...: source =r"C:\Users\sache\OneDrive\Documents\python_SAS\BasicStats\data\for demo"^M
   ...: destination = 'C:\\Users\\sache\\demo\\data'^M
   ...: move_dir(source, destination, Pattern='.csv')^M

In [16]: os.listdir('./data')
Out[16]: ['df4.csv', 'df5.csv', 'Iris.csv']

In [19]: os.path.getsize('./data/Iris.csv')
Out[19]: 3867
```

The following snippet of summing file sizes in folder is from [stackoverflow](https://stackoverflow.com/questions/1392413/calculating-a-directorys-size-using-python)

codefile_folder_sizes.py

```python
In [20]: def get_size(start_path = '.'):
    ...:     total_size = 0
    ...:     for dirpath, dirnames, filenames in os.walk(start_path):
    ...:         for f in filenames:
    ...:             fp = os.path.join(dirpath, f)
    ...:             # skip if it is symbolic link
    ...:             if not os.path.islink(fp):
    ...:                 total_size += os.path.getsize(fp)
    ...:
    ...:     return total_size
    ...:
    ...: print(get_size(), 'bytes')
    ...:
5655 bytes
```
#  4. Write some data analysis program to run
We write two simple scripts for demo.
1. basic_stats.py: it defines a DataDescription class that has two methods: summary statistics for all the columns, and Pearson correlation for the numeric columns.

2. iris_analysis.py: it imports the data from the data folder, and performs the analysis using basic_stats.  This is the program we call on the command line.

> Notice that in these two programs, we *have not coded any full path name*. That's because the full path name was given in \__file__.

codebasic_stats.py

```python

import os
import pandas as pd
import warnings
warnings.filterwarnings('ignore')
class DataDescription(object):
    def __init__(self, data,cate):
        self.data = data
        self.cate = cate
    def summary(self):
        summary = self.data.groupby(self.cate).describe().unstack().unstack().round(2)
        print(summary)
        return summary
    def cal_corr(self):
        pearson_corr = self.data.groupby(self.cate).corr(method='pearson').round(2)
        # spearman_corr = self.data.groupby(self.cate).corr(method='spearman').round(2)
        print("\n PEARSON",pearson_corr)
        # print("\n SPEARMAN",spearman_corr)
        return pearson_corr
```

codeiris_analysis.py

```python
import os
import pandas as pd
import warnings
from basic_stats import DataDescription
warnings.filterwarnings('ignore')
base_path = os.path.abspath(os.path.join(__file__, "../.."))
input_path = os.path.join(base_path,'data')
output_path = os.path.join(base_path,'analysis')
print("\n input_path",input_path)
df = pd.read_csv(os.path.join(input_path,"Iris.csv"))
print(df.shape)
print(df.info())
summary = DataDescription(df,'species').summary()
corr = DataDescription(df,'species').cal_corr()
corr.to_excel(os.path.join(output_path,'iris_corr.xlsx'))
summary.to_excel(os.path.join(output_path,'iris_summary.xlsx'))

```
Some of the result of running the program is in the screenshot below.

# "\\"  or "/"

On Windows, paths are written using backslashes (\\, the key with "\|") as the separator between folder names.

OS X and Linux, however, use the forward slash (/, the key with "?") as their path separator.

path=os.path.join(dir,subdir,filename) is easier than path=dir + '/' + subdir + '/'+filename`, although they equivalent.  path=os.path.join(dir,subdir,filename) is better than string concatenation because it prevents cross-platform issues.

#### Solution 1. Double \\\
Two wrongs make it right.  Just double it up.

#### Solution 2. Add 'r'
Ask Python to do the job and read it.

#### Solution 3. os.path.join()
Use it with (full path name *minus* relative directory).

With some extra typing, the os.path.join() function helps solving this problem. os.path.join() glues the  path pieces together using the correct path separators.

slashes.py

```python
>>> df = pd.read_csv("C:\Users\sache\OneDrive\Documents\python_SAS\df4.csv")
  File "<ipython-input-8-24f5fb082f1d>", line 2
    df = pd.read_csv("C:\Users\sache\OneDrive\Documents\python_SAS\df4.csv")
                    ^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

# Solution 1. Double \\
>>> df = pd.read_csv(r"C:\Users\sache\OneDrive\Documents\python_SAS\data\df4.csv")
# Solution 2. Add 'r'
>>> df = pd.read_csv("C:\\Users\\sache\\OneDrive\\Documents\\python_SAS\\data\\df4.csv")
# Solution 3. os.path.join
>>> df = pd.read_csv(os.path.join('.','OneDrive\Documents\python_SAS\data\df4.csv'))
```

# Absolute path

|  function, notation | usage        |
|:--------------------|:-------------|
| os.path.abspath | Asolute path is the full path from the address bar |
| os.path.relpath | Relative path gives the difference between two input paths |
| os.path.abspath('.') | equivalent to os.getcwd() |
|.| denotes current working directory |
|..| denotes backward a step, i.e.subtract a step in path |

codelearn_path.py

```python
In [1]: import os
        os.path.abspath('.')
Out[1]: 'C:\\Users\\sache'

In [2]: os.path.abspath('.\\onedrive')
Out[2]: 'C:\\Users\\sache\\onedrive'

In [3]: os.path.isabs(os.path.abspath('.'))
Out[3]: True

In [4]: os.path.relpath('C:\\Windows', 'C:\\')
Out[4]: 'Windows'

In [5]: os.path.relpath('C:\\Windows', 'C:\\windows')
Out[5]: '.'

In [6]: os.path.relpath('C:\Windows', 'C:\windows')
Out[6]: '.'

In [7]: os.path.relpath('C:/Windows', 'C:/windows')
Out[7]: '.'
```

coderun_result_of_learn_path.py

```python
In [1]: import os
        os.path.abspath('.')
Out[1]: 'C:\\Users\\sache'

In [2]: os.path.abspath('.\\onedrive')
Out[2]: 'C:\\Users\\sache\\onedrive'

In [3]: os.path.isabs(os.path.abspath('.'))
Out[3]: True

In [4]: os.path.relpath('C:\\Windows', 'C:\\')
Out[4]: 'Windows'

In [5]: os.path.relpath('C:\\Windows', 'C:\\windows')
Out[5]: '.'

In [6]: os.path.relpath('C:\Windows', 'C:\windows')
Out[6]: '.'

In [7]: os.path.relpath('C:/Windows', 'C:/windows')
Out[7]: '.'
```

# Partitioning a path

### folder name and file name
We can partition a full path name into parent and child:
os.path.==dirname==(path), the parent directory:  *before* the last slash in the path argument.

os.path.==basename==(path)</sapn>, the child: *after* the last slash in the path argument.

When a script is executed through the commandline, \__file__' refers to the script file that is being run. os.path.abspath(\__file__) gives the complete path, which means the folder path + the file name.
In this case, the parent is the folder path, while the child is the file name.

codelearn_path1.py

```python
import os
ABS_PATH = os.path.abspath(__file__)
print("\n ABS_PATH ", ABS_PATH)
PARENT_PATH = os.path.dirname(ABS_PATH)
print("\n PARENT_PATH ",PARENT_PATH)
CHILD_PATH = os.path.basename(ABS_PATH)
print("\n CHILD_PATH ",CHILD_PATH)

# The result of running the above code is as followed:

#(base) C:\Users\sache\OneDrive\Documents\python_SAS\Code_only>python learn_path2.py

# ABS_PATH  C:\Users\sache\OneDrive\Documents\python_SAS\Code_only\learn_path2.py

# PARENT_PATH  C:\Users\sache\OneDrive\Documents\python_SAS\Code_only

# CHILD_PATH  learn_path2.py
```

# split folder path
```python

{In [28]: path
Out[28]: 'C:\\Users\\sache\\OneDrive'

In [29]: os.path.split(path)
Out[29]: ('C:\\Users\\sache', 'OneDrive')}
```

# Grandparent and great grandparents

Using the same logic of getting the parent, we can access the grandparent directory using os.path.dirname repeatedly.

A better way to do this is os.path.abspath(os.path.join(path,"../../..")).

Note that os.path.join(path, "../../..") just glues the steps together.  It does not know "../../.." is to go back 2 steps. os.path.abspath applies the step calculations.

codeparent.py

```python
In [19]: os.getcwd()
Out[19]: 'C:\\Users\\sache\\OneDrive'
In [21]: os.path.dirname(path)
Out[21]: 'C:\\Users\\sache'
In [23]: os.path.dirname(os.path.dirname(path))
Out[23]: 'C:\\Users'

# alternatively
In [33]: os.path.abspath(os.path.join(path,"../../.."))
Out[33]: 'C:\\'
```

# Relative path and absolute path

codelearn_path.py

```python
import os
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
print("PROJECT_ROOT is ",PROJECT_ROOT)
BASE_DIR = os.path.dirname(PROJECT_ROOT)
print("BASE_DIR is",BASE_DIR)
# PROJECT_ROOT is  C:\python_SAS\Code_only
# BASE_DIR is C:\python_SAS
```

The os.path.dirname() function removes the last segment of a path.
__file__ is the pathname of the file from which the module was loaded, if it was loaded from a file.

codelearn_path.py

```python
import os
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
print("PROJECT_ROOT is ",PROJECT_ROOT)
BASE_DIR = os.path.dirname(PROJECT_ROOT)
print("BASE_DIR is",BASE_DIR)
# PROJECT_ROOT is  C:\python_SAS\Code_only
# BASE_DIR is C:\python_SAS
```

Now, open the command prompt, or Anaconda Prompt, type "python learn_path.py", as shown below, we will get the output as expected. Both the first and the second function ran.  The second function ran because the name of the module according to the Python interpreter, is \__name__ == '\__main__'.

On the other hand, if a module is not the main program but is imported by another one, then \__name__ attribute will be the name of the scirpt, in this case it is "learn_main", not \__main__.  Since the \__name__ is not \__main__, then whatever \__main__ does will be ignored.

This neat trick helps us reuse code more flexibly.

# SAS

In aside from the command line, elsewhere we need to tell SAS what directory we want as the base path.

codelearn_path.sas

```sas
%let rundir = C:/Users/sache/onedrive/;

%include "&rundir/../codeonly/path.sas";
```
Relative file paths in SAS are relative to the '**current directory**'.
If you want a path that is relative to the path of the current program, you have to build it yourself.
To get the path of the current program, use SYSGET("SAS_EXECFILEPATH") in a data step or %qsysfunc(sysget(SAS_EXECFILEPATH)) in macro code.

gha_language: SCSS


text:
---
title: Whatsapp via Twilio
sidebar_label: Whatsapp - Twilio
---

The Twilio WhatsApp source provides a channel for sending and receiving WhatsApp
messages using the [Twilio API](https://www.twilio.com/).

:::note

This document assumes that you have a Twilio account connected to
[WhatsApp](https://www.twilio.com/whatsapp).

:::

## Configuration

import TwilioSource from './twilio-source.mdx'

<TwilioSource />

## Connect a channel

After you created a Twilio phone number, you must [point its
webhook integration](https://www.twilio.com/docs/sms/tutorials/how-to-receive-and-reply-java#configure-your-webhook-url)
to your Airy Core Platform running instance.

Next call the Airy Core Platform API for connecting channels:

```
POST /channels.connect
```

- `source` _must_ be `twilio.whatsapp`
- `source_channel_id` The phone number as listed in your [Twilio
  dashboard](https://www.twilio.com/console/phone-numbers/).
  It must _not_ have spaces, must include the country
  code, and be prefixed by `whatsapp:`

**Sample Request**

```json5
{
  "source": "twilio.whatsapp",
  "source_channel_id": "whatsapp:+491234567",
  "name": "WhatsApp Marketing",
  "image_url": "https://example.com/custom-image.jpg" // optional
}
```

**Sample Response**

```json5
{
  "id": "channel-uuid-1",
  "name": "WhatsApp Marketing",
  "image_url": "https://example.com/custom-image.jpg",
  "source": "twilio.whatsapp",
  "source_channel_id": "whatsapp:+491234567"
}
```

repository: ssidentity/airy

branch_name: refs/heads/main

extension: md

license_type: permissive

repo_name: ssidentity/airy


text:
# Infinispan JDBC Driver

This project is a implementation of JDBC Driver for Infinispan distributed in-memory key/value store based on Teiid (https://teiid.io) technology.

If you are thinking, a JDBC driver for key/value store? yes, that is correct, using this driver, you can access Infinispan cluster as you would access Oracle, Postgres, MySQL etc. You could readily use this driver with any BI tools to analyze the data inside Infinispan cluster. You could use this driver to query/insert/update/delete rows to/from Infinispan Cache. Please note, that when you modify data using this driver (insert, update, delete) it will be using the same internal object format as your custom application that is written using Protobuf mechanism.

Since this driver is simple wrapper around the Teiid technology, you have all SQL query support that Teiid provides, even if some of the support is not natively supported by Infinispan. You can use huge library of Teiid functions. However note that since pushdown support is not fully available, some of these functions are being executed locally to put the results together, that means execution times may be higher. Hopefully in future releases, we will write enough distributed execution functions to process them remotely on Infinispan Cluster.

### Limitations
This implementation does come with few limitations.
 * Only works with Remote Inifinispan over HotRod client. No, library mode.
 * Only works when you defined a "protobuf" file to work with your Cache contents. If are using freestyle objects, this will not work. If you want to add new schema see section on Schema.
 * Insert/Update/Delete only works when the Protobuf message has additional annotation to mark a column as Identity (@Id) column. See more details in "Enhancing Protobuf Metadata" section.
 * There can be only single top level message in your Protobuf file for single cache in Infinispan. See "Enhancing Protobuf Metadata" to define a way tie protobuf's message to cache such that more than single top level message can be defined in a single protobuf file.
 * Due to inherent nature of nested documents in the Infinispan cache, if a message has child(ren) messages, when parent is deleted all the children are cascade deleted also.

# JAVA Example

If you are working with maven add the below dependency to your project
```
Maven co-ordinates to come after first version is published
```
Then you can use the code fragment like below to make connection to the Infinispan Cache.

```
Class.forName("io.infinispan.jdbc.Driver");
Connection conn = DriverManager.getConnection("jdbc:infinispan://localhost:11222/addressbook_indexed;protobuf=/quickstart/addressbook.proto");
Statement statement = conn.createStatement();
ResultSet resultSet = statement.executeQuery("select id, name, email from Person");
writeResultSet(resultSet);
```

# Schema
If you are starting with empty schema (no protobuf) has defined, this driver gives couple different ways to define the schema of your cache. You can define a property called "schema" on your URL connection string, which can either be path to a .proto file or a .ddl file.
### .proto file
This can be any protobuf file that you want to register with Infinispan cache and access through this driver. You can use annotations defined in Enhancing the Protobuf Metadata in here too.

### .ddl file
Here the schema of the cache is defined in the form of DDL. Specifically using Teiid DDL. You can reference DDL documentation here http://teiid.github.io/teiid-documents/master/content/reference/DDL_Metadata.html and also look for extensions you would need to define on DDL for Infinispan cache for customization [here] (http://teiid.github.io/teiid-documents/master/content/reference/Infinispan_Translator.html#_details_on_protobuf_to_ddl_conversion). Typically as user you do not need to define these extensions manually in simple scenarios. When you supply the schema in DDL, the driver will first convert this schema into a compatible .proto file and register that protobuf file with the Infinispan cache.

# Enhancing Protobuf Metadata
When you define your cache content structure in the Protobuf format, there are many different limitations. By defining few annotations below, you can solve some of these issues.

### No Identity Key
When you define a message in Protobuf, there is no way to define which field of the message should be used as the key  store in Infinispan cache. This is typically left out to client applications to define. The below defines an annotation `@Id` that used by this driver when doing any updates to cache. Add this annotation to all the top level messages in Protobuf. For example:

```
message Person {

   required string name = 1;
   /* @Id */
   required int32 id = 2;

   optional bytes picture = 3;
}
```
Note: This is way Teiid (this Driver) choose to define the Key declaratively.

### Single Top Level Message, Can not define multiple top level messages in given Protobuf file
If you have single top level message in a given Protobuf file per Cache, then this does not affect you. However if you want to define multiple domain messages in a single Protobuf file, but they need to be stored in different Infinispan caches, you can use @Cache annotation to do so. If the defined Cache is not configured one will be created automatically. For example:

```
/* @Cache(name=PersonCache)
message Person {

   required string name = 1;
   /* @Id */
   required int32 id = 2;

   optional bytes picture = 3;
}
```
Note: PersonCache from above is name of the Infinispan cache the contents of the Person object stored or read from. If you are working with an custom application, then that application defines programmatically where it reads/writes from. Since there is no code in this model, this is way Teiid choose to define this property declaratively.

### Data Types
Protobuf defines a very limited set of data types namely int32, int64, float, double, string, bool, bytes. However typically JDBC  applications have more rich in types like Date, Timestamp, XML, Blobs, Geography etc. This driver provides support for @Teiid annotation to decorate a Protobuf's message field such that they can be read as rich data types through this driver. For example to read a "bytes" field as "blob" you can define as

```
/* @Cache(name=PersonCache)
message Person {

   required string name = 1;
   /* @Id */
   required int32 id = 2;

   /* @Teiid(type=blob) */
   optional bytes picture = 3;
}
```
Similarly if you want to read `int64` as `timestamp` then define

```
  @Teiid(type=timestamp)
  int64 dateofbirth;
```
Now when using the above driver, the `dateofbirth` column will be represented as `timestamp` and read/updated as `int64`. For full list of data types checkout http://teiid.github.io/teiid-documents/master/content/reference/Supported_Types.html. Please note that if you were using Java to define marshalers most of these mappings will map one to one, but be cautious not writing different formats when using the custom applications VS using this driver.

repository: rareddy/infinispan-jdbc

branch_name: refs/heads/master

repo_name: rareddy/infinispan-jdbc


text:
**Secure Network Messenger**
------------------------

This project is part of curriculum of UTDallas : Network Security CS6349

**Overview**

This project exhibits custom SSl layer using various libraries and protocol techniques. It basically start and maintain secure end to end connection between two chat clients and server.

**Protocol Design**

(1) Authentication with server

![](/SupportedImages/authentication.jpg?raw=true)

(2) Customize Kerberos for TGT of another client

![](/SupportedImages/kerberos.jpg?raw=true)

(3) Message Transfer from one client to another client

![](/SupportedImages/msg.jpg?raw=true)

**Security Features**

1.	Authentication: Client is authenticated using password based authentication. When client enters the username and password into the workstation, the workstation generates SHA512 hash of the password.
2.	Communication: Communication between clients is session based. That is, for each session a session key is assigned by the server for client to client or peer to peer communication. This session key remains valid only for that particular session.
3.	Confidentiality: As the session keys are known only to the clients, the message to be sent remains confidential.
4.	Integrity: Integrity is maintained by sending HMAC of the message along with the message. If the message is changed by the attacker, its integrity won’t be the same when calculated at the receiver end. Hence, a change in message won’t go undetected.
5.	Attacks considered
1.      Eavesdropping
2.      Man in the Middle
3.      Replay attack
4.      Message modification(Integrity)
5.      Active attacker posing as Alice to server or other clients

**Messenger Screens**

(1) Login Screen

![](/SupportedImages/loginScreen.jpg?raw=true)

(2) Main Screen for Users and Chat Message

![](/SupportedImages/UserSelection.jpg?raw=true)

(3) Availability for User.

![](/SupportedImages/NotAvailableMsg.jpg?raw=true)

license: MIT

repository: VarunDani/secure-network-messenger

repo_name: VarunDani/secure-network-messenger


text:
---
layout: default
---

# 1993-10-09 - Re: PHONE PRIVACY

## Header Data

From: Matthew J Ghio<EMAIL_ADDRESS>To<EMAIL_ADDRESS>Message Hash: 2c84d225801ed7baa34e5d3c964b29cf5b3b0ec56698ea10e38ee49d70d829e9

Message ID<EMAIL_ADDRESS>Reply To<EMAIL_ADDRESS>UTC Datetime: 1993-10-09 16:49:29 UTC

Raw Date: Sat, 9 Oct 93 09:49:29 PDT

## Raw message

```
{% raw  %}From: Matthew J Ghio<EMAIL_ADDRESS>Date: Sat, 9 Oct 93 09:49:29 PDT
To<EMAIL_ADDRESS>Subject: Re: PHONE PRIVACY
In-Reply-To<EMAIL_ADDRESS>Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

> I would not trust this for hiding from law enforcement.
> You can get the 900 service's fone records with a warrant.
> If not law enforcement, then who do you need this to
> hide from?  You can use a pay fone to fool caller-id boxes.
> Well, I guess they dont hide the city.

Well, if you have a pair of pay phones nearby, and the wires are
concealed but accessable, you could rig it to answer calls on one line
and then let the caller dial out on the other line.  Only problem is
that you have to use a calling card...unless you have a red box or rig a
COCOT. ;)

{% endraw %}
```

## Thread

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

+ Return to "[Brad Huntting <huntting@glarp.com>](/authors/brad_huntting_huntting_at_glarp_com_)"
+ Return to "[charliemerritt@BIX.com](/authors/charliemerritt_at_bix_com)"
+ Return to "[Matthew J Ghio <mg5n+@andrew.cmu.edu>](/authors/matthew_j_ghio_mg5n_at_andrew_cmu_edu_)"
+ Return to<EMAIL_ADDRESS>(Nick Szabo)](/authors/szabo_at_netcom_com_nick_szabo_)"

+ 1993-10-09 (Fri, 8 Oct 93 17:55:49 PDT) - [PHONE PRIVACY](/archive/1993/10/54b706a1fa712c9da5d20c312b1ecb2ecdc7879f7205bc1886711735d19c4b62) -<EMAIL_ADDRESS>  + 1993-10-09 (Sat, 9 Oct 93 09:49:29 PDT) - Re: PHONE PRIVACY - _Matthew J Ghio<EMAIL_ADDRESS>    + 1993-10-10 (Sat, 9 Oct 93 23:20:58 PDT) - [PHONE PRIVACY: real-time billing with digital postage](/archive/1993/10/ccc2b884fed936b73fd84ad113c8218369431bc3915b7f14c8caf1922780b3f8) -<EMAIL_ADDRESS>(Nick Szabo)_
      + 1993-10-10 (Sun, 10 Oct 93 09:49:42 PDT) - [Re: PHONE PRIVACY: real-time billing with digital postage](/archive/1993/10/2826d0b946ffcd1c0a36b21faf30b75bf676a52f390e695b783262dc0243d2ff) - _Brad Huntting<EMAIL_ADDRESS>      + 1993-10-10 (Sun, 10 Oct 93 11:39:46 PDT) - [Re: PHONE PRIVACY: real-time billing with digital postage](/archive/1993/10/70f22964e0aa13496e941403208c8ccd1973700c7022b10dd30a531d63d42b6a) - _Matthew J Ghio<EMAIL_ADDRESS>

gha_license_id: MIT


text:
---
title: JSON Web Tokens (JWT)
---

The best and easy way to integrate [JWT](https://jwt.io) authentication to your API is using
[LexikJWTAuthenticationBundle](https://github.com/lexik/LexikJWTAuthenticationBundle).

> This bundle require a previously configured user provider or install FOSUserBundle.

Install and configure LexikJWTAuthenticationBundle as described in
the [documentation](https://github.com/lexik/LexikJWTAuthenticationBundle/blob/master/Resources/doc/index.md#installation).

The following configuration is a full example of the `securitty.yml` of any symfony application working like a API.

````yaml
security:
    encoders:
        App\Entity\User:
            algorithm: md5
            encode_as_base64: false
            iterations: 1

    role_hierarchy:
        ROLE_API:       ROLE_USER

    providers:
        fos_userbundle:
            id: fos_user.user_provider.username

    firewalls:
      options:
            methods: [OPTIONS]
            pattern: ^/
            security: false
      dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
      login:
          pattern:  ^/login
          stateless: true
          anonymous: true
          provider: fos_userbundle
          form_login:
              check_path:               /login
              success_handler:          lexik_jwt_authentication.handler.authentication_success
              failure_handler:          lexik_jwt_authentication.handler.authentication_failure
              require_previous_session: false
              post_only:                true
              #paramaters names changes for readability in API usage
              username_parameter:       username
              password_parameter:       password
      api:
          pattern:   ^/(?!explorer|login)
          stateless: true
          provider: fos_userbundle
          guard:
              authenticators:
                  - lexik_jwt_authentication.jwt_token_authenticator

    access_control:
        - { path: ^/login,  roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/explorer,  roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/,       roles: IS_AUTHENTICATED_FULLY }
````

In the above example:

- The application root is the API, then the endpoint is the domain. Can change to use a path like `/api`.
- The `username_parameter` and `password_parameter` has been changed to remove the `_` prefix
- `login` and `explorer` allow ANONYMOUSLY access, but both methods require valid credentials. See [how configure GraphiQL with authentication](../../05_GraphiQL/01_Installation.md)

> This is a basic example and you can configure you application like you want.

repository: ynloultratech/graphql-bundle-docs

repo_name: ynloultratech/graphql-bundle-docs


text:
**Music List Player**

**Level:** Beginner

**Objectives:**

This project demonstrates:

 1. Use of `RecyclerView` to show list of songs. Each list item (cell) displays play/pause button and a seek bar to control the playback of the audio.
 2. Controlling playback of a song with a play/pause button and updating button state when playback is toggled and completed
 3. Displaying song playback progress and controlling it with a seek bar
 4. Stopping playback when activity moves out of screen

**Description**

`AudioItem` is a simple POJO which has properties describing audio items, such as title, artist, album, genre, url etc. For this demo application, only one property is considered, that is resource id of audio from `raw` directory. A list of 256 `AudioItem`s is constructed to display in the form of vertically scrollable list. These all items are constructed with the same resource id, and as a result only one audio is played for all the cells.

`RecyclerView` optimises space by constructing (roughly) only as much cell children (or `ViewHolder`s) as displayed on the screen. When one scrolls the list upward, unused `ViewHolder` of the top-most cell, which is moving out of the screen, will be reused to display the new cell coming from the bottom. UI elements's states are updated to proper audio item `position` in `onBindViewHolder` method.

`MediaPlayer` is owned and managed by the `AudioItemAdapter`. It is made sure through `uiUpdateHandler` that the seek bar is updated only while media player is in playing state. `AudioItemAdapter.stopPlayer` is used to stop media player when acticity is paused.


text:
#CIVIC'ACT
##CEVIPOF

-

These slides are online at [diegantobass.github.io/polearth](https://diegantobass.github.io/polearth/civicact/RCN_meeting/sampling_slides/index.html)

The huge survey on the presidential election that's taking all of our time at the Cevipof : [www.enef.fr](http://www.enef.fr/)

===

###Since December in Paris

- (The survey and the interviews)

- __The échantillonnage__, of CSOs based on territories

- MORE DATA, CSOs galore and health issues

- (some ERGMs maybe?)

===

(it means sampling)

#The échantillonnage
###how we choose which CSOS we want to interview

-
##The échantillonnage is
###1. Guide for the qualitative interviews
###2. Based on environmental data
###3. "Socio-politico-demographicaly coherent"

(+++ inter-disciplinary bonus points!)

===

###1. Guide for the qualitative interviews

- Need a reasonable number of CSOs to interview

- Need to be representative of territories and of people

- Need to be driven by our hypothesises :
    + _Presence or absence of green space drives green votes_
    + _CSOs drive political implication_
    + _Bad health is linked to presence CSOs_
    + _Pollution drives far-right_
    + _[insert your question]_

===

###2. it is based on environmental data

- The [__MOS database__](https://www.data.gouv.fr/fr/datasets/mode-d-occupation-du-sol-mos-en-11-postes-en-2012-idf/) : _mode d'occupation des sols_

- Fine-grained spatial units : blocks, parks, buildings

- Sub-divided into 11 categories of land-use type

-

ACP (_principal component analysis_)
 on the 11 variables of the MOS db for our _communes_.

CAH (_hierarchical clustering_)
 to divide the geometricaly projected _communes_ into 3 classes

-

![plan](images/plan.png)

-

![plan](images/plan_zoom.png)

-

## Problems?

- Similar db for Strasbourg
- Reproduce that sampling on US data
- New CSOs data

===

###3. "Socio-politico-demographicaly coherent"

The hierarchical clustering was stopped at 3 classes with the _variables continues_ in mind.

We want to maximize intra-class coherence and inter-class heterogeneity

-

![classes](images/classes_all.png)

-

![classe_un](images/classe_1.png)

-

![classe_deux](images/classe_2.png)

-

![classe_trois](images/classe_3.png)

===

moaaarrrrrr

#MORE DATA
###some much data

-

###1. New database of CSOs just published
###2. Health data on cancer death

===

###1. New database of CSOs just published

Last week the government (of La France) released through its portal [data.gouv.fr](data.gouv.fr) a new dataset of [all CSOs ever](http://www.data.gouv.fr/fr/datasets/repertoire-national-des-associations-rna/)

I haven't yet explored the data

===

###2. Health data on cancer death

Mahdi contacts with the [INERIS](http://www.ineris.fr/) (_Institut National de l'EnviRonnement Industriel et des risqueS_) and [CepiDC](http://www.cepidc.inserm.fr/) (_centre d'épidémiologie sur les causes médicales de décès_) and his personal interest in health data

-

![tous_cancer](images/tous_cancer.jpg)

-

![poumon_cancer](images/poumon_cancer.jpg)

-

![sein_cancer](images/sein_cancer.jpg)

-

- Spatial scale is _canton_ (from INSEE) : higher scale than the the _communes_

- Temporal scale is 2000 to 2007, recent years and a long enough period to have sufficient cumulated data on the four types of cancer analysed

- Data include cause of death, age, sex, _commune_ where the person lived

===

Actualy no ERGMs

repository: diegantobass/polearth

repo_name: diegantobass/polearth


text:
# shrapnel [![Build Status][build-badge]][build-url] [![Linux Release Status][release-linux-badge]][release-url] [![Windows Release Status][release-windows-badge]][release-url]

[build-url]: https://github.com/aeldar/shrapnel/actions
[release-url]: https://github.com/aeldar/shrapnel/releases
[build-badge]: https://github.com/aeldar/shrapnel/workflows/build/badge.svg
[release-linux-badge]: https://github.com/aeldar/shrapnel/workflows/release%20(linux)/badge.svg
[release-windows-badge]: https://github.com/aeldar/shrapnel/workflows/release%20(windows)/badge.svg

A damned simple runner of multiple commands at once. Works on Windows and Linux.

## What for?

It can be used to start multiple micro-front-end applications with a simple command.

## How to use it?

Add a damned simple `shrapnel.yml` configuration to the directory you are going to run the commands in:

```yaml
fragments:
  - name: Description of the run process
    dir: /path/to/dir/to/run/command/in # Optional
    cmd: your-marvelous-command
  - name: Description of another run process
    dir: ../../relative/path/to/dir/to/run/another/command/in
    cmd: ./your-marvelous-command-like-npm-start
```

... and run it:

```bash
shrapnel
```

## How to install it?

Download the binary from the [Releases](https://github.com/aeldar/shrapnel/releases) section, unpack and place it somewhere in your PATH.

## Why to not use it?

The `shrapnel` runner is just an excercise in using rust for simple cli applications. It is not supposed to be a robust tool. Please use it for your own purposes.

## What to improve?

- The `shrapnel` starts the processes in parallel and joins all the IO streams without any differentiation of them in the console. There should be a way to distinguish the streams and print them in the console with colors (or/and prefixed).
- The `shrapnel` starts the processes, but cannot stop them. There should be a way to stop the processes on killing the `shrapnel` itself.
- The `shrapnel` should be able to run the commands in a different directory than the current one.

repository: aeldar/shrapnel

gha_language: Rust

repo_name: aeldar/shrapnel


text:
# ClockAngle

#### _Clock Angle, 4/23/18_

#### By _**Alex Noble and Randy Weyer**_

## Description
_An program for calculating the angle between the hour and minute hands on an analog clock using tests_

## Setup/Installation Requirements

* _Clone or download the repository._
* _Install C# with the .NET framework_
* _Locate and change to the ClockAngle.Tests directory in the terminal_
* _Run dotnet restore then dotnet test commands in the terminal_

## Specifications
| Spec | Input | Output |
| :-------------     | :------------- | :------------- |
| **Given 12:00, return 0 degrees** | 12, 0  | 0 |
| **Given 6:00, return 180 degrees**| 6, 0 | 180 |
| **It should always return the smallest angle** | 11, 59 | 35.5 |

## Known Bugs

_No known bugs_

## Technologies Used
* C#/.NET

### License

*This software is licensed under the MIT license.*

Copyright (c) 2018 **_Alex Noble, Randy Weyer_**

repository: RandyWeyer/ClockAngleCalculation

repo_name: RandyWeyer/ClockAngleCalculation


text:
---
layout: default
---

# 1997-11-14 - Re: [OB: CRYTO] Re: about RC4

## Header Data

From: Ryan Anderson<EMAIL_ADDRESS>To: Anonymous<EMAIL_ADDRESS>Message Hash: 362530785f2544eaeaf7e00edae3edd5ff0de2fe0e837ad1decc09189aa0e21d

Message ID: \<Pine.GSO.3.95.971114013803.17808F-100000@king\>

Reply To<EMAIL_ADDRESS>UTC Datetime: 1997-11-14 06:50:02 UTC

Raw Date: Fri, 14 Nov 1997 14:50:02 +0800

## Raw message

```
{% raw  %}From: Ryan Anderson<EMAIL_ADDRESS>Date: Fri, 14 Nov 1997 14:50:02 +0800
To: Anonymous<EMAIL_ADDRESS>Subject: Re: [OB: CRYTO] Re: about RC4
In-Reply-To<EMAIL_ADDRESS>Message-ID: <Pine.GSO.3.95.971114013803.17808F-100000@king>
MIME-Version: 1.0
Content-Type: text/plain

On Fri, 14 Nov 1997, Anonymous wrote:

> > >   No...because they couldn't speak a 'Native' language perfectly.
> > > Cherokee!
>
> > Navajo, if I understand what reference you're making. :-)  You are
> > referring to the practice of using Navajo Indians for much of the
> > top-secret communications during WWII, right?
>
>   Right! It is em-bare-ass'ing to admit that my second 'guess' was
> going to be Comanche...
>   I'm not too dumb to use a Search Engine, just too lazy.

That's not as embarassing as the fact that we're running low on speakers
of Navajo in this country now.  It would be kinda convenient to have that
ability available again.  My gut feeling is that Navajo remains one of the
most poorly documented languages in the world....  government research
(funny name for it, come to think of it) into the language is probably
quite classified....

Ryan Anderson - Alpha Geek
PGP fp: 7E 8E C6 54 96 AC D9 57  E4 F8 AE 9C 10 7E 78 C9
print pack"C*",split/\D+/,`echo "16iII*o\U@{$/=$z;[(pop,pop,unpack"H*",<>
)]}\EsMsKsN0[lN*1lK[d2%Sa2/d0<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<J]dsJxp"|dc`

{% endraw %}
```

## Thread

+ Return to [November 1997](/archive/1997/11)

+ Return to<EMAIL_ADDRESS>(Dr.Dimitri Vulis KOTM)](/authors/dlv_at_bwalk_dm_com_dr_dimitri_vulis_kotm_)"
+ Return to<EMAIL_ADDRESS>(Anonymous)](/authors/nobody_at_replay_com_anonymous_)"
+ Return to "[Ryan Anderson <ryan@michonline.com>](/authors/ryan_anderson_ryan_at_michonline_com_)"
+ Return to "[Tim May <tcmay@got.net>](/authors/tim_may_tcmay_at_got_net_)"

+ 1997-11-14 (Fri, 14 Nov 1997 13:19:02 +0800) - [Re: [OB: CRYTO] Re: about RC4](/archive/1997/11/9a44ef333bab82debc04ced6b991d3dcd48fc83ea5eb85a11b8dbf4a8ccbb2f0) -<EMAIL_ADDRESS>(Anonymous)_
  + 1997-11-14 (Fri, 14 Nov 1997 14:50:02 +0800) - Re: [OB: CRYTO] Re: about RC4 - _Ryan Anderson<EMAIL_ADDRESS>  + 1997-11-14 (Fri, 14 Nov 1997 15:40:43 +0800) - [Navajo Code Talkers](/archive/1997/11/78feff6a2ba663e8d47b8d4e6d395f6d2a79a82a4edf1f317d2fc0b6b2e67b5e) - _Tim May<EMAIL_ADDRESS>    + 1997-11-14 (Sat, 15 Nov 1997 01:46:08 +0800) - [Re: Navajo Code Talkers](/archive/1997/11/6498fcfb0ec480218a8873827c07bd21e1a8fb5b78a483008d017d79e235171f) -<EMAIL_ADDRESS>(Dr.Dimitri Vulis KOTM)_


text:
# Comuka(Code eating hippo) #0 Planetarium day

The first event of the Code eating hippo to hangout and code together was held successfuly on Feb 23rd 2019, at nonce.

### Participants and projects

🦛The first Saturday coding salon🦛
1. Non-fungible hippo([@wanseob](https://github.com/wanseob))! https://github.com/wanseob/code-eating-hippo
2. Research De-Fi & ETHTTT([@younhoon-nonce](https://github.com/younhoon-nonce))
3. Meterman: out of gas troubleshooting framework([@maczniak](https://github.com/maczniak)) https://github.com/maczniak/meterman
4. Android sample DApp ([@HeesungB](https://github.com/HeesungB))
5. Research Economics for blockchain games([@kijun](https://github.com/kijun))
6. Libplanet (@longfin(https://github.com/longfin))
https://github.com/planetarium/libplanet.net/pull/88
https://github.com/planetarium/libplanet.net/projects/1
7. Libplanet PR! ([@qria](https://github.com/qria))
https://github.com/planetarium/libplanet.net/pull/103
8. Blockchain lab(Minhyun Kim)
9. Took "nomadcoder" courses (Dongook)

### Subscribe Code Eating Hippo!

https://comuka.nonce.community
https://twitter.com/CodeEatingHippo

### Hosted by
[Planetarium](https://planetariumhq.com/) team and nonce.

repository: nonce-community/comuka

repo_name: nonce-community/comuka


text:
# DiffGaem
A procedurally-generated text-based game

## Usage
Run with nimble

```bash
nimble run diffgaem
```

## Program Requirements
[Nim](https://nim-lang.org/) version 1.0.6 or greater
[Nimble](https://github.com/nim-lang/nimble)

## License
[MIT](https://choosealicense.com/licenses/mit/)

gha_language: Nim


text:
# C++ interface of RTE+RRTMGP
This is a C++ interface to the Radiative Transfer for Energetics (RTE)
and Rapid Radiative Transfer Model for GCM applications Parallel (RRTMGP).

The original code is found at https://github.com/RobertPincus/rte-rrtmgp.

Contacts: Robert Pincus and Eli Mlawer
email<EMAIL_ADDRESS>
This C++ interface can be downloaded from https://github.com/microhh/rte-rrtmgp-cpp

Contact: Chiel van Heerwaarden
email<EMAIL_ADDRESS>
Use and duplication is permitted under the terms of the
BSD 3-clause license, see http://opensource.org/licenses/BSD-3-Clause

In order to check out the code including the `rte-rrtmgp` submodule, use:

    git clone --recurse-submodules https://github.com/microhh/rte-rrtmgp-cpp

In case you had already checked out the repository, use:

    git submodule update --init

# Some temporary instructions
In order to run the RCEMIP test:
1. Place the long wave coefficients file from the original RTE+RRTMGP repository as `coefficients_lw.nc` in the directory of the executable.
2. Place the short wave coefficients file from the original RTE+RRTMGP repository as `coefficients_sw.nc` in the directory of the executable.

In order to run the RTE+RRTMGP unit test with long wave:
1. Place either the long wave coefficients file from the original RTE+RRTMGP repository as `coefficients.nc` in the directory of the executable.
2. Place the `rrtmgp-lw-inputs-outputs-clear.nc` under the name `rrtmgp-inputs-outputs.nc` in the directory of the executable.

In order to run the RTE+RRTMGP unit test with short wave:
1. Place either the short wave coefficients file from the original RTE+RRTMGP repository as `coefficients.nc` in the directory of the executable.
2. Place the `rrtmgp-sw-inputs-outputs-clear.nc` under the name `rrtmgp-inputs-outputs.nc` in the directory of the executable.


text:
# DarkMaps
iOS 12

## Description
Forces MKMapViews to be in Night Mode. (Basically any app that uses Apple's MapKit)

## Repo
https://sn50repo.github.io/

## Support
[paypal](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=TBB3GGAEF9GJA&currency_code=USD&source=url)

[twitter](https://twitter.com/lilboipham)


text:
# traefik

cool/hipster reverse proxy and/or load balancer.

* [website](https://traefik.io)
* [documentation](https://docs.traefik.io)

I'll write some things in here which helped me in some edge cases I couldn't really find in the documentation but were in fact available.

## middlewares

if you define a middleware it needs to be applied to a router. that's it. they mention it somewhere in the docs but never ever on another page with proper examples.

**`docker-compose.yaml` example**

```yaml
version: "3.7"

services:
  frontend:
    image: some-image-here
    restart: unless-stopped
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=web"
      - "traefik.http.middlewares.redirect-https.redirectScheme.scheme=https"
      - "traefik.http.middlewares.redirect-https.redirectScheme.permanent=true"

      - "traefik.http.middlewares.no-www.redirectregex.regex=^https://www.(.*)"
      - "traefik.http.middlewares.no-www.redirectregex.replacement=https://$$1"

      - "traefik.http.routers.frontend.rule=Host(`ilayk.com`) || Host(`www.ilayk.com`)"
      - "traefik.http.routers.frontend.entrypoints=websecure"

      - "traefik.http.middlewares.frontend-header.headers.browserXssFilter=true"
      - "traefik.http.middlewares.frontend-header.headers.frameDeny=true"
      - "traefik.http.middlewares.frontend-header.headers.contentTypeNosniff=true"

      - "traefik.http.middlewares.compress.compress=true"

      - "traefik.http.routers.frontend.middlewares=redirect-https,no-www,compress,frontend-header"
```

the *middlewares* are defined and then applied to the router in the last line.

**basic auth example:**

this is a label excerpt from a `docker-compose.yaml` file

```
  wordpress-www:
    image: wordpress:latest
    restart: unless-stopped
    links:
      - my-db
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=web"

      - "traefik.http.middlewares.redirect-https.redirectScheme.scheme=https"
      - "traefik.http.middlewares.redirect-https.redirectScheme.permanent=true"

      - "traefik.http.routers.wordpress-www.tls.certresolver=dnsssl"
      - "traefik.http.routers.wordpress-www.tls=true"

      - "traefik.http.middlewares.wordpress-auth.basicauth.users=test2:$$apr1$$d9hr9HBB$$4HxwgUir3HP4EsggP/QNo0"
      - "traefik.http.routers.wordpress-www.middlewares=wordpress-auth"
```

for some reason it works if you take the service name (wordpress-www), create the middleware (2nd last line) and use it again in the last. I have no idea, this is probably totally wrong but it works.

## docker labels hints

`$` characters in `docker-compose.yml` files have to be escaped by another `$` = meaning: `$$`

## redirects

www to no-www and http to https

### http to https redirect

this one goes into `traefik.toml` and applies globally

```
[entryPoints]
  [entryPoints.http]
  address = ":80"
    [entryPoints.http.redirect]
    entryPoint = "https"
  [entryPoints.https]
  address = ":443"
  [entryPoints.https.tls]
```

### global: www to no-www redirect

this example applies globally and goes into `traefik.toml`

```
[entryPoints.https.redirect]
permanent=true
regex = "^https://www.(.*)"
replacement = "https://$1"
```

[see also rewriting documentation](https://docs.traefik.io/configuration/entrypoints/#rewriting-url)

### docker(-compose): www to no-www

```
- "traefik.frontend.redirect.regex=^https://www.(.*)"
- "traefik.frontend.redirect.replacement=https://$$1"
- "traefik.frontend.redirect.permanent=true"
```

## multiple domain names

(this is a docker label)

```
- "traefik.frontend.rule=Host:example.com,example2.com"
```

## http basic auth and path rules

suppose you want to protect `/post` and `/edit` endpoints but everything else should work without username/password:

```
- "traefik.docker.network=web"
- "traefik.enable=true"
- "traefik.basic.protocol=http"
- "traefik.basic.frontend.rule=Host:domain.tld,www.domain.tld"
- "traefik.auth.frontend.rule=Host:domain.tld;PathPrefix:/edit,/post"
- "traefik.auth.frontend.auth.basic=jonas:$$2a$$10$asdf"
- "traefik.frontend.redirect.regex=^https://www.(.*)"
- "traefik.frontend.redirect.replacement=https://$$1"
- "traefik.frontend.redirect.permanent=true"
- "traefik.basic.port=8000"
```

this part is the important one:

```
- "traefik.auth.frontend.rule=Host:domain.tld;PathPrefix:/edit,/post"
```

also, the priority evaluation is important, [read about in-depth here](https://docs.traefik.io/basics/#frontends) - I couldn't write it in a way someone can understand it.

[this post also helped me quite a lot](https://stackoverflow.com/q/50253357/10272994)

**generate username and password hash**:

```
echo $(htpasswd -nbB username "password!1234") | sed -e s/\\$/\\$\\$/g
```

the `sed` part will also directly escape the output suited for a docker label

## priorities

this is very important to understand and it's probably best to always check the [documentation about this here](https://docs.traefik.io/basics/#priorities) - search for *priorities* if they ever change the link. basically routes will be sorted by length in descending order (see http auth example above).

> By default, routes will be sorted (in descending order) using rules length (to avoid path overlap): - `PathPrefix:/foo;Host:foo.com` (length == 28) will be matched before `PathPrefixStrip:/foobar` (length == 23) will be matched before `PathPrefix:/foo,/bar` (length == 20).

repository: pew/hitchhikers-guide

repo_name: pew/hitchhikers-guide


text:
# 2.0.0

- Changing the design of the sequence, so that it gives a proper database rather than a single query method.
- Changing the design of the relationships. You can find more about it [here](https://github.com/Seb-C/kiss-orm/pull/22/commits/9d076e2f8edfd0737841d9583f8ec94eb6c2e62f#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5)
- Added a simple abstraction layer to better support the databases capabilities when getting data after an insert or update
- Added experimental support for MySQL databases
- Added experimental support for Sqlite databases
- Changed the minimal node version to 12 to avoid problems related to the ES6 modules
- Updated the node dependencies

# 1.1.1

- Fixing some classes requiring the index, creating recursive dependencies
- Fixing the update method removing all properties unrelated to the table

# 1.1.0

- Added a default value (comma) for the `sqlJoin` function

# 1.0.0

- Removing the auto-reconnect option
- Using pg-pool instead of a simple connection
- Added a missing method in `DatabaseInterface`
- Removing the `connect` method from the database class and interface
- Allowing injection of an already-instanciated database rather that a database configuration
- Separating the `indexToPlaceholder` method and unit-testing it
- Adding the `sequence` method for multi-query transactions
- Fixing the migration transaction isolation

# 0.5.1

- Fixing the auto-reconnect option design

# 0.5.0

- Automatically reconnecting the database

# 0.4.0

- Changed the error objects so that it extends the native `Error`.

# 0.2.0

- Adding advanced generic typings for the method arguments
- Exported the exception classes

# 0.1.1

- Fixing incompatible imports syntax when used as a dependency

# 0.1.0

- Made the repository use the abstract interface rather than a specific implementation
- Fixing the publication script to have proper types and plain JS

# 0.0.0

- Initial release

repository: Seb-C/kiss-orm

gha_language: TypeScript

repo_name: Seb-C/kiss-orm


text:
# Web App Template

The boilerplate for a basic web app

- HTML file linking CSS/JS files
- Material Design Components (v6)
- Code of Conduct/MIT License

## Local setup

1. Fork + clone the project (consider using [GitHub Desktop](https://desktop.github.com/) if you're unfamiliar with git)
2. Open a terminal in the project directory
3. Serve the directory as a website using:
  - `python3 -m http.server` if you have Python installed
  - `ruby -run -ehttpd . -p8000` if you have Ruby installed
  - Any of [these other methods](https://gist.github.com/willurd/5720255)

## Contributing

Contributions are always welcome. This could mean requesting features, reporting bugs or creating pull requests.

If you don't have or want a GitHub account you could drop me a line via Twitter ([@kittsville](https://twitter.com/kittsville)) or email (kittsville@gmail.com).

Please bear in mind there is a [Code of Conduct](CODE_OF_CONDUCT.md) which defines acceptable behavior.

repository: kittsville/webapp-template

repo_name: kittsville/webapp-template


text:
 TBSP: **T**rajectory Inference **B**ased on **S**N**P** information.
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

# Table of Contents
1. [INTRODUCTION](#introduction)
2. [PREREQUISITES](#prerequisites)
3. [INSTALLATION](#installation)
4. [USAGE](#usage)
5. [INPUTS AND PRE-PROCESSINGS](#inputs-and-pre-processings)
6. [OUTPUTS](#outputs)
7. [EXAMPLES](#examples)
8. [INTEGRATION WITH EXISTING METHODS](#integration-with-existing-methods)

# INTRODUCTION

Several recent studies focus on the inference of developmental and response trajectories from single cell RNA-Seq (scRNA-Seq) data. A number of computational methods,
often referred to as pseudo-time ordering, have been developed for this task.
Recently, CRISPR has also been used to reconstruct lineage trees by inserting random mutations.
However, both approaches suffer from drawbacks that limit their use. Here we develop a method to detect significant, cell type specific,
sequence mutations from scRNA-Seq data. We show that only a few mutations are enough for reconstructing good branching models.
Integrating these mutations with expression data further improves the accuracy of the reconstructed models.

![flowchart](./images/flowchart.jpg)

# PREREQUISITES

* python (python 2 and python 3 are both supported)
It was installed by default for most Linux distribution and MAC.
If not, please check [https://www.python.org/downloads/](https://www.python.org/downloads/) for installation
instructions.

* Python packages dependencies:
-- scikit-learn
-- scipy
-- numpy
-- matplotlib
-- networkx
-- pyBigWig
-- Biopython
-- decorator

Note that networkx might not work well with some versions of decorator. In that case, consider upgrading or downgrading decorator. For example, "pip install decorator==5.0.7" should solve the problem.

* other dependencies:
-- python-dev (python2) or python3-dev (python3)
It can be installed easily for most linux distributions. For example, debian/ubuntu:
	```
	sudo apt-get install python-dev
	or
	sudo apt-get install python3-dev
	```
	For Macos, it was installed by default.
	The python setup.py script (or pip) will try to install these packages automatically.
	However, please install them manually if, by any reason, the automatic
	installation fails.

* Platform:
Macos and Linux verified. For windows, the dependent pyBigWig package is not available.
However, the Docker version of TBSP is available for all platforms.

# INSTALLATION

 There are 4 options to install tbsp.
* __Option 1: setup.py script installation from download directory__
	cd to the downloaded scdiff package root directory

	```shell
	$cd tbsp
	```
	run python setup to install

	```shell
	$python setup.py install
	```

	MacOS or Linux users might need the sudo/root access to install.
	Users without the root access can install the package using the pip/easy_install with a --user parameter ([install python libraries without root](https://stackoverflow.com/questions/7465445/how-to-install-python-modules-without-root-access))．

	```shell
	$sudo python setup.py install
	```
	use python3 instead of python in the above commands to install if using python3.

* __Option 2: pip installation from Github__:

	python 2:
	```shell
	$sudo pip install  --trusted-host github.com --upgrade http://github.com/phoenixding/tbsp/zipball/master
	```
	python 3:
	```shell
	$sudo pip3 install --trusted-host github.com --upgrade http://github.com/phoenixding/tbsp/zipball/master
	```

* __Option 3: pip installation from PyPI__:

	python 2:
	```shell
	$sudo pip install  --trusted-host pypi.org --trusted-host files.pythonhosted.org --upgrade tbsp
	```
	python 3:
	```shell
	$sudo pip3 install  --trusted-host pypi.org --trusted-host files.pythonhosted.org --upgrade tbsp
	```

	The above pip installation options should be working for Linux and MacOS systems.
	For MacOS users, it's recommended to use python3 installation. The default python2 in MacOS has
	some compatibility issues with a few dependent libraries. The users would have to install their own
	version of python2 (e.g. via [Anocanda](https://anaconda.org/)) if they prefer to use python2 in MacOS.

* __Option 4: Installation as Docker images__ (Most robust way, no dependencies on all platforms)
	Users would need to install Docker to run the tbsp image. Please refer to [Docker installation page](https://docs.docker.com/install/) for detailed installation instructions.

	To install tbsp image:

	```
	$sudo docker pull johnding1986/tbsp
	```
	To run tbsp image :

	```
	$sudo docker run -v /PATH_TO_FILE_DIRECTORY:/tbsp  johnding1986/tbsp
	```
	Users would need to use the -v command to mount local directories.

# USAGE

```shell
usage: tbsp.py [-h] -i IVCF [-b [IBW]] [-k KCLUSTER] [-l [CELL_LABEL]] -o
               OUTPUT [--cutl CUTL] [--cuth CUTH] [--greedycut GREEDYCUT]
               [--cutc CUTC] [--maxiter MAXITER]

optional arguments:
  -h, --help            show this help message and exit
  -i IVCF, --ivcf IVCF  Required,directory with all input .vcf files. This
                        specifies the directory of SNP files (.vcf) for the
                        cells (one .vcf file for each cell). These .vcf files
                        can be obtained using the provided bam2vcf script or
                        other RNA-seq variant calling pipelines preferred by
                        the users.
  -b [IBW], --ibw [IBW]
                        Optional,directory with all input bigwig (.bw) files
                        with the information about the number of aligned reads
                        at each genomic position. These bigwig files are used
                        to filter the SNPs, which are redundant to expression
                        information.
  -k KCLUSTER, --kcluster KCLUSTER
                        Optional, number of clusters, Integer. If not
                        specified, the program will choose the k with best
                        silhouette score.
  -l [CELL_LABEL], --cell_label [CELL_LABEL]
                        Optional, labels for the cells. This is used only to
                        annotate the cells with known information, not used
                        for building the model.
  -o OUTPUT, --output OUTPUT
                        Required,output directory
  --cutl CUTL           Optional, lower bound cutoff to remove potential false
                        positive SNPs, default=0.1
  --cuth CUTH           Optional, upper bound cutoff to remove baseline SNPs,
                        which are common in most cells, default=0.8
  --greedycut GREEDYCUT
                        Optional, the stopping cutoff for the greedy search of
                        candidate SNPs, default=0.05 (less than 0.05 score
                        improvement). A larger cutoff means less strict SNP
                        candidate search
  --cutc CUTC           Optional, convergence cutoff, a smaller cutoff
                        represents a stricter convergence
                        criterion,default=0.001
  --maxiter MAXITER     Optional, the maximal number of iterations allowed

```

# INPUTS AND PRE-PROCESSINGS

* __-i__:
Required input, this specifies the directory of all SNP(.vcf) files. We recommend using [GATK RNA-seq variant calling pipeline](https://software.broadinstitute.org/gatk/documentation/article.php?id=3891) to call the vcfs from .bam (mapped reads) files.
Users are also allowed to use the SNPs (.vcfs) identified by programs of their preferences (e.g. freebayes).
We also provied a GATK based SNP calling script (bam2vcf.py) at [bam2vcf](https://my.pcloud.com/publink/show?code=XZH5iFkZz0uXbbvQ8AQznXWoRXBOS0VJUtuV), which automates the SNP calling procedure from .bam files to .vcf files.
Please use "python bam2vcf.py --help" to see the script usage.

* __-b__:
Optional input, this specifies the directory of all bigwig (.bw) files. We provided the script [bam2bw.py](./bam2bw/bam2bw.py) under [bam2bw](./bam2bw) directory to convert the bam files to bigwig files. This files are
used to filter SNPs, potentially redundant to expression.

* __-l__:
Optional input, this specifies the labels for the cells.
File format (tab-delimited):
```
cell1	label1
cell2	label2
```
These cell labels are only used to annotate the cells in the trajectory.
The other optional parameters are specified above.

# OUTPUTS

* __GroupCells.txt__:
A text file, which describes the cells in each cluster.

	Format:
	```
	Cell_ID	Cluster_ID
	SRR1931024	cluter:0
	SRR1930999	cluter:0
	SRR1930977	cluter:0
	SRR1931041	cluter:0
	SRR1931012	cluter:0
	SRR1930945	cluter:0
	SRR1931003	cluter:0
	SRR1931002	cluter:0
	SRR1931004	cluter:0
	..
	```

* __SNP_matrix.tsv__:
The SNP matrix for all the cells.
Row: SNPs
Column: Cells
Value: Binary (0/1), which indicates whther the SNP is included in the cell.

	```
	SNP	SRR1931024	SRR1930999	SRR1930977	SRR1931041	SRR1931012	SRR1930945	SRR1931003	SRR1931002	SRR1931004	SRR1931009	SRR1931031	SRR1930994	SRR1930995	SRR1930992
	chr18,31438715	0	0	0	0	0	0	0	0	0	0	0	0	0	0
	chr13,99421798	0	0	0	0	0	0	0	0	0	0	0	0	0	0
	chr18,48047497	0	0	0	0	0	0	0	0	0	0	0	0	0	0
	chr1,98777608	0	1	1	1	0	1	1	0	0	0	0	0	1	0
	chr12,75631154	0	0	0	0	0	0	0	0	0	0	0	0	0	0
	chr2,80837890	0	0	0	0	0	0	0	0	0	0	0	0	0	0
	chr10,56497362	1	0	0	1	0	1	1	0	1	1	0	0	1	0
	chr9,42254324	0	0	0	0	0	0	0	0	0	0	1	0	1	0
	chr10,56497777	0	0	0	0	0	0	1	1	0	1	0	0	0	1
	chr9,42254361	0	0	0	0	0	0	0	0	0	0	1	0	1	0
	chr18,28188943	0	1	1	1	1	1	1	1	0	0	1	1	0	1
	chr14,46775753	1	0	0	1	0	1	0	1	0	1	1	0	1	1
	chr4,141015053	0	0	0	1	0	0	0	0	0	0	0	0	0	0
	chr6,3201327	0	0	1	0	0	0	1	1	1	0	0	0	0	0
	chr2,152737258	0	1	0	0	1	0	1	1	0	1	1	0	1	0
	chr4,150417174	1	0	0	0	1	0	1	0	1	0	0	1	0	0
	chr6,136872487	0	1	1	1	0	0	1	1	0	0	1	0	0	0
	chr8,41341106	1	1	1	0	1	1	1	1	1	0	1	1	0	1
	chr17,72849135	1	1	1	1	0	0	1	1	1	1	1	1	1	1
	chr17,6132279	0	0	0	0	0	0	0	0	0	0	0	0	0	0
	chr8,102864840	0	0	0	0	0	0	0	0	0	0	0	0	0	0
	chr13,74406968	1	1	1	1	0	1	1	1	1	1	1	0	1	1
	chr11,45829261	0	1	1	0	0	1	1	0	0	1	0	0	0	0
	chr8,54522180	0	1	1	0	0	1	0	0	0	0	0	0	0	0
	chr9,67023057	0	1	1	0	1	1	0	1	0	0	1	1	1	1
	chr10,128076602	1	1	1	1	1	0	1	1	1	1	1	1	1	1
	chr6,4540674	0	1	1	1	1	1	1	0	1	1	1	0	1	1
	chr17,70996716	1	1	1	1	0	1	1	1	1	1	1	1	1	1
	chr5,115345677	0	1	1	1	1	1	0	1	0	0	0	1	1	1
	chr2,136782052	0	0	0	0	0	0	0	0	0	0	0	0	0	0

	```

* __SNP_matrix.jpg__:
The SNP matrix in jpg image.
![snp_matrix](./images/SNP_matrix.jpg)
* __Trajectory.dat__:

	```
	4	(-0.6168642633606496, -0.29504774213348317)
	Inner4	(-0.01784069226314263, -0.19237987266625067)
	2	(-1.0, 0.1907479586411944)
	Inner5	(0.526511663382742, -0.048432121394020027)
	6	(0.6167190582080249, -0.21090119687699874)
	0	(-0.02807716265846153, -0.3564777531262085)
	3	(-0.7661682030072015, 0.29873283057457906)
	Inner3	(-0.4986251141938113, -0.13657170781011707)
	Inner1	(0.785885623794461, 0.14046537917538365)
	5	(0.8477737598817315, 0.3307492805568145)
	1	(0.9509945159224894, 0.1308847244003101)
	Inner2	(-0.8003091857061821, 0.14823022065879607)
	```
	First column: cluster id
	second column: coordinates
	TBSP trajectories were presented in the form of uprooted phylogenetic tree structure.
	The coordinates for each node(cluster) are given by the above Trajectory.dat result.
	With the coordinates, users can able to compute the length for each of the branches in the tree.
	User can setup a user-defined distance cutoff to find out major divergence events. An example cutoff can be set
	as top 25% of all branch lengths.

* __Trajectory.jpg__:
Graph representation of Trajectory.dat
![ti](./images/Trajectory.jpg)

# INTEGRATION WITH EXISTING METHODS
TBSP model provides a SNP MATRIX, which presents the SNP signature vector for each of the cells in the dataset.
As we show in the paper, such SNP MATRIX is very informative for trajectory inference.
The cell trajectories can be improved by integrating SNP matrix with expression data.

There are many ways to utilize the SNP matrix information, here we used a simple example to demonstrate the integration.

MONOCLE 2 is used widely for trajectory inference and has very good performance.  However, it's based on only single-cell expression
data and thus may be limited in many scenarios.

For example, the following is the Monocle 2 results on a 2016 neuron reprogramming single-cell dataset (https://www.ncbi.nlm.nih.gov/pubmed/27281220)
![images/monocle_neuron.jpg](images/monocle_neuron.jpg). The processed expression data can be found in the [integration_example](integration_example/neuron_original.tsv) directory.

(1) In the above results, we observe that d2_induced cells are in a separate branch in the bottom right while the neuron cells are on the branch at top right,
which contradicts the findings in the original study (Trajectory: MEF->d2_intermediate-> d2_induced-> d5_intermeidate-> d5_earlyiN->Neuron), in which the d2_induced cells are serving as the progenitors to the neuron cells.
(2) Running TBSP on the same dataset, we have obtained 36 SNPs as shown in [integration_example/SNP_matrix.tsv](integration_example/SNP_matrix.tsv).
(3) Combine the expression features and SNP features.  There are multiple ways to combine these two types of information.
In the paper, we have discussed the strategy of refining the cell assignment in the expression-based trajectories using SNP information.
To be more specific, we integrate the SNP information to re-calculate the likelihood when re-assigning the cells to the trajectories.
Here, we discuss the most naive way to integrate SNP features with expression features: Merge the  features directly.
For each cell, we put together the expression features (gene expression levels associated with cell) and SNP features (Binary SNP features 0/1 associated with the cell).

```
expression:
cell	gene1	gene2	gene3 ...
c1	1.6	2.4	3.8 ...
c2	2.8	4.8	6.4	...

+snp:
cell snp1	snp2	snp3
c1	1	0	1	...
c2	0	1	0	...

=>combined:
combined_info	gene1	gene2	gene3	snp1	snp2	snp3	...
c1	1.6	2.4	3.8	1	0	1	...
c2	2.8	4.8	6.5	0	1	0	...

```

Please note that number of the SNP features (usually in the range of 30-100) is much smaller than the number of genes (expression features).
Therefore, to put more weights on the SNP features, we need to over-sample the SNP features.  In the above example, we oversampled the SNPs for 100 times (=> 3600 SNP features).
The combined dataset for the above example can be found in the [integration_example](integration_example/neuron_combined.tsv) directory.

(4) Run Monocle on the SNP-integrated dataset.
![images/monocle_snp.jpg](images/monocle_snp.jpg)

The above SNP-integrated Monocle results on the neuron reprogramming dataset perfectly matches the findings in the original study (MEF->d2_intermediate-> d2_induced-> d5_intermeidate-> d5_earlyiN->Neuron).
d2_induced cells nows are the progenitors of the neuron cells. Also, d5 cells are coming later than d2 cells.
Even using very simple integration strategy as shown above, the cell trajectories can be significantly improved.

# EXAMPLES
* __Direct Run__:
	* __Example inputs__:
	We provided example vcf files under [examples](./examples/vcf_example) folder.
	To run tbsp on the example data:
	```
	$tbsp -i examples/vcf_example -o example_out
	```

	* __Example outputs__:
	Example output files can be found under [examples](./examples/output_example) folder.

* __Docker Run__:
	We provided example vcf files under [examples](./examples/vcf_example) folder.
	To run docker tbsp on the example data:

	```
	$sudo docker run -v ~/Download/examples:/tbsp  johnding1986/tbsp -i /tbsp/vcf_example -o /tbsp/example_out
	```
	where ~/Download/examples  should be replaced by the parent directory of the folder of vcf files.  The result files
	are the same as described above.

# CREDITS

This software was developed by ZIV-system biology group @ Carnegie Mellon University.
Implemented by Jun Ding.

# LICENSE

This software is under MIT license.

# CONTACT

zivbj at cs.cmu.edu
jund  at cs.cmu.edu

repository: phoenixding/tbsp

gha_language: Python

repo_name: phoenixding/tbsp


text:
---
title:  "Whiteboards"
tags: [training]
---

I recently finished conducting a bootcamp at ASU and I think I've found a new tradition: **Whiteboards**.

> In my walks, every man I meet is my superior in some way, and in that I learn from him.
>
> Ralph Waldo Emerson

As a technical trainer, it's very easy to do all the wrong things:

* Read from PowerPoint in a monotone voice
* Talk *at* people
* Be boring as hell

I've done my best to inspire the people I teach. Code is an unbelievable
skill that let's you impact the world in a significant way. I think we *need*
more talented developers in the world and this is why I love my job. During my
years as a technical trainer, I've put together some commonsense ideas to
inspire and effectively teach difficult skills:

* Create a learning environment
* Encourage questions
* Hands on is better than theory
* Opinionated is better than generalized
* Direction is better than the answer
* Whiteboards are awesome

**Whiteboard time** is when each person gets 5 minutes to talk about whatever they want.
They are encouraged to use the whiteboard and typically discouraged from using a
projector, however there are exceptions.

I recently finished running a 10 week bootcamp at ASU, during which we did whiteboards
every day first thing in the morning. There were fortunate side effects of doing this,
such as people being more energetic after talking in front of others. However, there
were fundamental benefits we achieved from whiteboards:

* They certainly created a learning environment
* The batch was more engaged
* The batch became closer, faster
* They were so much fun and everyone learned a lot

There was no restriction on the topic of whiteboards. I think this was really important
for the successful introduction into our team. In the beginning, any new idea may
be met with resistance, but once the batch saw that whiteboards were a way of expressing
themselves, they owned it.

My personal goal was for them to talk about Java, AWS,
design patterns or anything that would further their understanding of the industry.
They certainly talked about these topics, and because it was on their own terms they
had a lot of fun doing it. It's really funny comparing the whiteboards of week 1 with
week 10. In the beginning, the whiteboards were short, really short. By week 10,
the batch was overstepping their 5 minutes, sometimes by a lot. But they were prepared,
energetic, and was too much fun to stop.

I should also note that many topics were
not about software engineering. We had topics ranging from genetics to special relativity
to military aircraft. I think this closely relates to one of my favorite quotes from Emerson:

> In my walks, every man I meet is my superior in some way, and in that I learn from him.

It's very important as a teacher to be humble and understand that people have knowledge
that you do not. Creating a learning environment to bring out this knowledge is very
important for every team and whiteboards is the best tool I've seen to accomplish this.

repository: tjkemper/blog

repo_name: tjkemper/blog


text:
# Linked Lists
Create your own technical documentation for your new implementation.
1. Explain to your audience what the data structure is (in your own words)
1. Visuals of what it looks like
1. How you implemented it
1. What type of uses you would use this for (provide 2 examples)

## The Data Structure

The data structure for a linked list is a heap since there are multiple nodes located randomly throughout memory.
The nodes are connected in a linked list by having one be considered the "Head" and then every node points to another unique node.

## Visuals

This visual shows that a linked list does not need to be orderly and all it needs is a starting point and the next node.
![A Visual of a Linked List] (../../assets/LinkedListVisual.png)

## Implementation

I implemented this by creating a node and then adding another node which references it in its Next property.
I kept adding to this chain and I get a linked list (It is already considered a linked list after 1 node).

## Uses for Linked Lists

Internet History, though it uses a doubly linked list (which also has a Previous property) it is a great example of a linked list.
Every time you change websites, it records the previous site that you visited in your history.

Trains, though the front and end are different, adding a new part to a train is like adding a new link.
Each part is connected to the next though the linked lists in programming is a lot more of a loose structure.

gha_language: C#


text:
# yas

Yet Another Sequence library

![YAS](https://i.giphy.com/media/3o7btWMurfV7OeRBpC/giphy-downsized.gif)

## What Are Sequences?

Sequences are immutable ordered lists of zero or more non-distinct values.

* __Ordered__: The order of values is well-defined and controlled by the
programmer.
* __Immutable__: Values can never be added to or removed a sequence, nor can
existing values be re-ordered.
* __Non-distinct__: A sequence may contain duplicate values.

The sequence interface has two primary abstractions:

* `first`: Returns the first value in the sequence.
* `rest`: Returns the remaining values in the sequence as a sub-sequence.

Traversing a sequence involves recursively calling `rest` until reaching the
empty sequence. This abstraction permits two special kinds of sequences:

* __Lazy__: A lazy sequence does not generate its value until the first time
it is needed.
* __Infinite__: An infinite sequence never ends. (`rest` never returns the
empty sequence.)

## Usage

Complete documentation is available in Javadoc format.

YAS requires Java 8 for the [`java.util.function`][j.u.f] package and is
designed to be used with [lambdas][lambdas].

A sequence implements the `Seq` interface, which is a minimal abstraction.
Generally, applications should use the higher level functions in `Seqs` (e.g.
`map`, `filter`) to create and manipulate `Seq` instances.

[j.u.f]: https://docs.oracle.com/javase/8/docs/api/java/util/function/package-summary.html
[lambdas]: https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html


text:
# spaghetti-code 🍝

- **Idea**: Private-sessioned code battles (with Video/Audio chat)
  - First player writes the code, second player guesses the output
  - Both players attempt to solve the challenge as quick as possible
  - Both players attempt to solve the challenge in smallest code size

---

![spaghettiCode](./assets/spaghetti-code-05.png)

---

File structure
![file structure](./assets/fs.jpg)

---

MongoDB schemas
![schemas](./assets/schemas.jpg)

---
### Challenge Route

| Method | Endpoint | Description  |
| :---: | :--- | :--- |
| GET | /challenge | Gets all challenges in the DB. |
| GET | /challenge/:id | Gets one challenge from the DB by ID. |
| POST | /challenge | adds one challenge to the DB. |
| PUT | /challenge/:id| Edits one challenge from the DB. |
| DELET | /challenge/:id| Deletes one challenge from the DB. |

---

### User Route

| Method | Endpoint | Description  |
| :---: | :--- | :--- |
| GET | /User | Gets all Users in the DB. |
| GET | /User/:id | Gets one User from the DB by ID. |
| POST | /User | adds one User to the DB. |
| PUT | /User/:id| Edits one User from the DB. |
| DELET | /User/:id| Deletes one User from the DB. |

---

### Random Challenge Route

| Method | Endpoint | Description  |
| :---: | :--- | :--- |
| GET | /getrandom | Gets one challenge from the DB randomly. |

---

### Leaderboard Route

| Method | Endpoint | Description  |
| :---: | :--- | :--- |
| GET | /leaderboard | Gets the top 10 users in the DB sorted by score. |

---

### Technology

![tech](./assets/tech.jpg)

---

## Deployed Link

https://spaghetti-code.herokuapp.com

gha_language: JavaScript


text:
# GopherJS Bindings for Googles ProtobufJS
[![GoDoc](https://godoc.org/github.com/johanbrandhorst/protobuf/jspb?status.svg)](https://godoc.org/github.com/johanbrandhorst/protobuf/jspb)

This package is based on the node package `google-protobuf`.
It has been "compiled" with webpack.

## Usage
The API is still experimental, and is not currently intended for general use outside
of via the [GopherJS protoc compiler plugin](https://github.com/johanbrandhorst/protobuf/tree/master/protoc-gen-gopherjs).
See the [`protoc-gen-gopherjs` README](https://github.com/johanbrandhorst/protobuf/tree/master/protoc-gen-gopherjs/README.md)
for more information on generating the interface.

repository: gbotrel/zsldemo

repo_name: gbotrel/zsldemo


text:
# Formidable

[![Build Status](https://secure.travis-ci.org/felixge/node-formidable.png?branch=master)](http://travis-ci.org/felixge/node-formidable)

## Purpose

This module was addopted to meet the requirements to communicate with the proprietary SOAP Webservices of HP Service Manager.

For Details about the general module please refer to https://github.com/felixge/node-formidable.

repository: Alexlambertz/node-formidable

repo_name: Alexlambertz/node-formidable


text:
# DbConnectorCommand.IsPrepared property

True after [`Prepare`](./Prepare.md) is called.

```csharp
public bool IsPrepared { get; }
```

## See Also

* struct [DbConnectorCommand](../DbConnectorCommand.md)
* namespace [Faithlife.Data](../../Faithlife.Data.md)

<!-- DO NOT EDIT: generated by xmldocmd for Faithlife.Data.dll -->

repository: ejball/FaithlifeData

repo_name: ejball/FaithlifeData


text:
---
title: "Coin Multiplier"
menu:
  main:
    parent: "general"
    weight: 60
---

The **Coin Multiplier** makes a return from the Crypt of the Necrodancer into Cadence of Hyrule. Despite the lack of coins it works similarly - rewarding you for keeping the rhythm.

The Multiplier starts at x1 and goes up to x3. You can increase the multiplier by defeating enemies. You can lose it when you miss the beat or take damage (includes self damage like running into a cactus).

## Multiplier Levels
The triforce peice under the beat bars displays the current multiplier level.

**x1**
![](/img/mechanics/beat-combo-1.png)

**x2**
![](/img/mechanics/beat-combo-2.png)

**x3**
![](/img/mechanics/beat-combo-3.png)

## Increasing the Multiplier
Defeating enemies without dropping the beat will increase the multiplier.

* Defeat 1 enemy; then it increases from x1 to x2.
* Defeat 4 more enemies (5 total); then it increases from x2 to the maximum of x3.

## Dropping the beat
There's a handful of ways to drop the beat and reset your Coin Multiplier.

* Take Damage
* Skip the beat
* Do more than one action per beat
* Move while sliding on ice
* Load the game
* Activate the Shrine of Conga

It's unlikely, but sometimes you *want* to drop the beat. The fastest way tends to be pressing a direction twice in one beat.

## Multiplier Effects

### Increased Stamina Regeneration
The multiplier increases the amount of stamina gained per kill. The formula is 5 * Coin Multiplier.

x1 = 5%
x2 = 10%
x3 = 15%

*Note: It's 5%/10%/15% of a single stamina bar. Adding a second bar does not increase the regen rate*

### Improved Loot
The coin multiplier improves loot drops. For example, with a x1 multiplier a mushboom might drop a single bomb. But at x3, that mushboom will drop a 3-bomb pack instead.

This applies to the diamonds as well. With a x3 multiplier you'll get 2 diamonds for clearing a screen instead of 1.

## Edge Cases

### Power Glove
The Power Glove has some special magic in them. Using the Glove will keep the beat, *even if you lift nothing at all*.

Which means you can use the Power Glove as a pseudo War Drum. Allowing you to stand still without dropping the beat. This is very useful when you have an obsidian weapon.

### Item Fail
Failing to use an item does **NOT** drop the beat. It's like a null or non-action instead of a bad/invalid one. Examples of item fail would be tring to use the bow when you're quiver is empty. Or trying to use naryu's love without enough stamina. This also includes using an empty item.

If you fail to use an item, you can *still* do something else. The timing is a little strict, you need to fail to use an item and then do something after (you can't do 2 actions at the same time). This is useful to keep in mind when you're running low on stamina, surrounded by enemies, and trying to use naryu's love. Use naryu's love early in the beat and then do something else when it fails.

The one exception as mentioned above is the Power Glove. Failing to lift still consumes the beat.

### Ignoring the Beat
There's a few times where you can ignore the beat and not drop it.
* After you close the menu. This includes using the lute, then cancelling out.
* After you enter a new screen.
* When you're charging the Pegasus Anklet or holding the Bow.

### Sliding on Ice
Even though you can't move while sliding on ice, you can still use items. This means you can save beats by doing 2 things at once, or you can perform some Frozen Grotto 1F skips.

Examples:
* Activate an Electric Scroll while sliding into the Wizzroboe fight.
* Create a block with the Cane of Somaria to stop yourself.
* Charge the Pegasus Anklet, turn, and release to dash off of the ice.
* Naryu's Love to protect yourself from enemies.
* Pull out the Longsword to stop yourself early.


text:
## PhysCon

Makes it easy to insert physical constants and units in python calculations.

`fuzzywuzzy` is a requirements, which can be installed by:

    pip install fuzzywuzzy

The **physcon** library is simply used like:

    import physcon

    physcon.e      # --> returns 1.6022e-19
    physcon.Rsun   # --> returns 6.9600e8

In addition **physcon** supplies two methods, which match constant values and units to a `search_string` through `values(search_string)` and `units(search_string)`.

    import physcon

    physcon.values('Planck's constant')
	# --> returns 6.6261e-34

    physcon.units(('Planck's constant')
	# --> returns 'J s'

repository: georglind/physcon

repo_name: georglind/physcon


text:
---
layout: post
title: Oct 2020 - Changes that will impact Learn B2 Integrations
date: 2020-10-04 08:40
category: blog
post_id: 20201004-changesthatimpactlearnb2
author: Mark Kauffman
tags: ["building-blocks", "update"]
summary: Read more to learn about important changes coming for Building Block Developers.
---

# Changes that will impact B2 Integrations

Read [this article](/archive/b2/resources/preparing-for-saas-and-new-learn-versions) . Download [Oct 2020 - Changes that will impact Learn Integrations.docx](/assets/files/changes-that-will-impact-learn-oct2020.docx) to find out how to get early access for testing.

-Mark Kauffman

gha_language: HTML


text:
---
layout: default
---

# 1997-12-09 - Re: Cato forum tomorrow: should money laundering be a crime?

## Header Data

From: Mix<EMAIL_ADDRESS>To<EMAIL_ADDRESS>Message Hash: daa02b66ee6596c53116315c0305e36f910426cdf232770aeb471aa8e8e56a2f

Message ID<EMAIL_ADDRESS>Reply To: _N/A_

UTC Datetime: 1997-12-09 20:25:37 UTC

Raw Date: Wed, 10 Dec 1997 04:25:37 +0800

## Raw message

```
{% raw  %}From: Mix<EMAIL_ADDRESS>Date: Wed, 10 Dec 1997 04:25:37 +0800
To<EMAIL_ADDRESS>Subject: Re: Cato forum tomorrow: should money laundering be a crime?
Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

Lucky Green wrote:

>If the feds can *kill* you for any reason or no reason at all, they
>certainly can throw you into the slammer for  whatever you may choose to
>utter.

>From Thoreau's "Civil Disobedience":

"Under a government which imprisons any unjustly, the true place for a just
man is also a prison."

[...]

"If the injustice is part of the necessary friction of the machine of
government, let it go, let it go: perchance it will wear smooth, -certainly
the machine will wear out.  If the injustice has a spring, or a pulley, or a
rope, or a crank, exclusively for itself, then perhaps you may consider
whether the remedy will not be worse than the evil; but if it is of such a
nature that it requires you to be the agent of injustice to another, then, I
say, break the law.  Let your life be a counter friction to stop the
machine.  What I have to do is to see, at any rate, that I do not lend
myself to the wrong which I condemn."

{% endraw %}
```

## Thread

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

+ Return to "[Mix <mixmaster@remail.obscura.com>](/authors/mix_mixmaster_at_remail_obscura_com_)"

+ 1997-12-09 (Wed, 10 Dec 1997 04:25:37 +0800) - Re: Cato forum tomorrow: should money laundering be a crime? - _Mix<EMAIL_ADDRESS>


text:
# Test environment
## OVA File

For your convinience, `OVA` files have been built and made available, see details below.

These `OVA` files are provided "AS IS", without warranty of any kind. Please use ONLY in TEST environments.

These can be used to quickly spin up a TrueNas instance and play with the PowerShell module.

||Link|Size|MD5|Specs|
|---|---|---|---|---|
|FreeNas_Large.ova     |[Link](https://www.dropbox.com/s/gcd06u23fxnx94x/FreeNas_Large.ova?dl=0)         |**833 MB** |659F4C3217F3B15C99011B508F67ED15|16GB Memory / 4vCpu
Disks: #1 OS 30GB #2 iSCSI 50GB|
|FreeNas_Small.ova     |[Link](https://www.dropbox.com/s/iqwzjvf3fq1cqfm/FreeNas_Small.ova?dl=0)         |**932 MB**|D16D8D8D8559B9C223859311FF3F38EE|4GB Memory / 2vCpu
Disks: #1 OS 30GB #2 iSCSI 50GB|
|TrueNas     |  Not Available Yet  | n/a |  n/a  |n/a|

**Notes**
* All appliances are configured in DHCP.
* The virtual Hardware is set to run on **ESXI 6.7 min**.


text:
# open-in-edge
This is a Chrome extension that adds an "Open in Edge" option to the context menu.

Microsoft Edge has a feature where downloaded installers have the option to be run directly instead of being downloaded and run. This extension adds a context menu option so you can use that feature while still using Chrome as your default browser.

repository: syntacticsplenda/open-in-edge

repo_name: syntacticsplenda/open-in-edge


text:
+++
date = "2020-03-08T22:03:37+07:00"
title = "About"
hidden = true
+++

This is yet another static site I made as a place for me to write some stuff.

What you see is probably going to change in the (hopefully near) future. I'm
planning to build a [new website] and blog using some fancy frontend stuff like
[React] or [Vue]. However, I haven't got the time to do that, so I made this
instead.

It's built on [Hugo] using the [Cactus Plus] theme with [some modifications].
If you think this site is familiar, yes, I based this off another site I made.

[new website]: https://laymonage.com
[React]: https://reactjs.org
[Vue]: https://vuejs.org
[Hugo]: https://gohugo.io
[Cactus Plus]: https://github.com/nodejh/hugo-theme-cactus-plus
[some modifications]: https://github.com/laymonage/hugo-theme-cactus-plus

repository: laymonage/blog

repo_name: laymonage/blog


text:
+++
title = "Modeling cognitive processes with neural reinforcement learning"
date = 2016-10-29T00:00:00
draft = false

# Authors. Comma separated list, e.g. `["Bob Smith", "David Jones"]`.
authors = ["__SE Bosch__", "K Seeliger", "MAJ van Gerven"]

# Publication type.
# Legend:
# 0 = Uncategorized
# 1 = Conference paper
# 2 = Journal article
# 3 = Preprint / Working Paper
# 4 = Report
# 5 = Book
# 6 = Book section
# 7 = Thesis
# 8 = Patent
publication_types = ["3"]

# Publication name and optional abbreviated version.
publication = "_bioRxiv_"
publication_short = ""

# Abstract and optional shortened version.
abstract = "Artificial neural networks (ANNs) have seen renewed interest in the fields of computer science, artificial intelligence and neuroscience. Recent advances in improving the performance of ANNs open up an exciting new avenue for cognitive neuroscience research. Here, we propose that ANNs that learn to solve complex tasks based on reinforcement learning, can serve as a universal computational framework for analyzing the neural and behavioural correlates of cognitive processing. We demonstrate this idea on a challenging probabilistic categorization task, where neural network dynamics are linked to human behavioural and neural data as identical tasks are solved."
abstract_short = ""

# Is this a featured publication? (true/false)
featured = false

# Projects (optional).
#   Associate this publication with one or more of your projects.
#   Simply enter your project's folder or file name without extension.
#   E.g. `projects = ["deep-learning"]` references
#   `content/project/deep-learning/index.md`.
#   Otherwise, set `projects = []`.
projects = []

# Slides (optional).
#   Associate this publication with Markdown slides.
#   Simply enter your slide deck's filename without extension.
#   E.g. `slides = "example-slides"` references
#   `content/slides/example-slides.md`.
#   Otherwise, set `slides = ""`.
slides = ""

# Tags (optional).
#   Set `tags = []` for no tags, or use the form `tags = ["A Tag", "Another Tag"]` for one or more tags.
tags = ["behavioural modelling", "artificial neural networks", "probabilistic learning"]

# Links (optional).
url_pdf = "/files/2016_bosch_biorxiv.pdf"
url_preprint = ""
url_code = ""
url_dataset = ""
url_project = ""
url_slides = ""
url_video = ""
url_poster = ""
url_source = ""

# Custom links (optional).
#   Uncomment line below to enable. For multiple links, use the form `[{...}, {...}, {...}]`.
# url_custom = [{name = "Custom Link", url = "http://example.org"}]

# Digital Object Identifier (DOI)
doi = "10.1101/084111"

# Does this page contain LaTeX math? (true/false)
math = false

# Featured image
# To use, add an image named `featured.jpg/png` to your page's folder.
[image]
  # Caption (optional)
  # caption = "Image credit: [**Unsplash**](https://unsplash.com/photos/jdD8gXaTZsc)"

  # Focal point (optional)
  # Options: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight
  focal_point = ""
+++

repository: sebosch/website

repo_name: sebosch/website


text:
# LogicBoxes API tools [![Build Status](https://travis-ci.org/Urethramancer/lbapi.svg?branch=master)](https://travis-ci.org/Urethramancer/lbapi)
Go SDK and tools for the LogicBoxes API used by ResellerClub and other domain registrars.

## Who is it for?
This is only useful if you have a reseller account with anyone using the LogicBoxes system and its APIs, and would like to manage customers, domains and DNS from the command line.

The planned backend server will also be useful if you need to expose DNS management or other simpler management to users, either via web or custom clients.

## Features (work in progress)
- Manage customers: Look up account details, sign up new ones, reset passwords, edit details, suspend and delete, authenticate passwords (for making backend services).
- Manage domains: Look up domains per customer, list all, edit details, toggle locks, transfer, renew, change name servers.
- Manage DNS for domains: Add, remove and change all records.

## Planned features
The following features take a lower priority than getting the three major parts of the API supported (customers, domains and DNS) with a command line tool to handle everything implemented.

- Backend server: REST layer between frontends and the LB API to make it easier to set up your own custom website, rather than using LB's Supersite.
- Client tool for DNS management via the backend server.

These planned features are things I will be dogfooding. Likely to be implemented soon, depending on when the main features are done.

## Possible features
- Managing other products than just domains
- Reseller management
- Interactive mode using a fancy terminal interface.

## Dependencies
1. Go, currently tested with v1.8.x+.
2. [go-flags](https://github.com/jessevdk/go-flags)
3. [columnize](https://github.com/ryanuber/columnize)
4. [gorilla/mux](https://github.com/gorilla/mux)
5. [countries](https://github.com/Urethramancer/countries)
6. [slog](https://github.com/Urethramancer/slog)
7. [x/crypto/sha3](https://golang.org/x/crypto/sha3)

## Platforms
Should work anywhere Go compiles to. The server tools are mainly tested on Linux but work on macOS. The command line tools and SDK should be universal, but currently needs a few lines of code for Windows support.

## Licence
MIT.

repository: Urethramancer/lbapi

repo_name: Urethramancer/lbapi


text:
# @fastify/request-context

[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Build Status](https://github.com/fastify/fastify-request-context/workflows/ci/badge.svg)](https://github.com/fastify/fastify-request-context/actions)
[![Coverage Status](https://coveralls.io/repos/fastify/fastify-request-context/badge.svg?branch=master)](https://coveralls.io/r/fastify/fastify-request-context?branch=master)

Request-scoped storage support, based on [Asynchronous Local Storage](https://github.com/kibertoad/asynchronous-local-storage) (which uses native Node.js ALS with fallback to [cls-hooked](https://github.com/Jeff-Lewis/cls-hooked) for older Node.js versions)

Inspired by work done in [@fastify/http-context](https://github.com/thorough-developer/fastify-http-context).

This plugin introduces thread-local request-scoped http context, where any variables set within the scope of a single http call won't be overwritten by simultaneous calls to the api
nor will variables remain available once a request is completed.

Frequent use-cases are persisting request-aware logger instances and user authorization information.

## Getting started

First install the package:

```bash
npm i @fastify/request-context
```

Next, set up the plugin:

```js
const { fastifyRequestContextPlugin } = require('@fastify/request-context')
const fastify = require('fastify');

fastify.register(fastifyRequestContextPlugin);
```

Or customize hook and default store values:

```js
const { fastifyRequestContextPlugin } = require('@fastify/request-context')
const fastify = require('fastify');

fastify.register(fastifyRequestContextPlugin, {
  hook: 'preValidation',
  defaultStoreValues: {
    user: { id: 'system' }
  }
});
```

Default store values can be set through a function as well:

```js
const { fastifyRequestContextPlugin } = require('@fastify/request-context')
const fastify = require('fastify');

fastify.register(fastifyRequestContextPlugin, {
  defaultStoreValues: request => ({
    log: request.log.child({ foo: 123 })
  })
});
```

This plugin accepts options `hook` and `defaultStoreValues`.

* `hook` allows you to specify to which lifecycle hook should request context initialization be bound. Note that you need to initialize it on the earliest lifecycle stage that you intend to use it in, or earlier. Default value is `onRequest`.
* `defaultStoreValues` / `defaultStoreValues(req: FastifyRequest)` sets initial values for the store (that can be later overwritten during request execution if needed). Can be set to either an object or a function that returns an object. The function will be sent the request object for the new context. This is an optional parameter.

From there you can set a context in another hook, route, or method that is within scope.

Request context (with methods `get` and `set`) is exposed by library itself, but is also available as decorator on `fastify.requestContext` app instance as well as on `req` request instance.

For instance:

```js
const { fastifyRequestContextPlugin, requestContext } = require('@fastify/request-context')
const fastify = require('fastify');

const app = fastify({ logger: true })
app.register(fastifyRequestContextPlugin, {
  defaultStoreValues: {
    user: { id: 'system' }
  }
});

app.addHook('onRequest', (req, reply, done) => {
  // Overwrite the defaults.
  // This is completely equivalent to using app.requestContext or just requestContext
  req.requestContext.set('user', { id: 'helloUser' });
  done();
});

// this should now get `helloUser` instead of the default `system`
app.get('/', (req, reply) => {
  // requestContext singleton exposed by the library retains same request-scoped values that were set using `req.requestContext`
  const user = requestContext.get('user');
  reply.code(200).send( { user });
});

app.get('/decorator', function (req, reply) {
  // requestContext singleton exposed as decorator in the fastify instance and can be retrieved:
  const user = this.requestContext.get('user'); // using `this` thanks to the handler function binding
  const theSameUser = app.requestContext.get('user'); // directly using the `app` instance
  reply.code(200).send( { user });
});

app.listen({ port: 3000 }, (err, address) => {
  if (err) throw err
  app.log.info(`server listening on ${address}`)
});

return app.ready()
```

## TypeScript

In TypeScript you are expected to augment the module to type your context:

```ts
import {requestContext} from '@fastify/request-context'

declare module '@fastify/request-context' {
  interface RequestContextData {
    foo: string
  }
}

// Type is "string" (if "strictNullChecks: true" in your tsconfig it will be "string | undefined")
const foo = requestContext.get('foo')
// Causes a type violation as 'bar' is not a key on RequestContextData
const bar = requestContext.get('bar')
```

If you have `"strictNullChecks": true` (or have `"strict": true`, which sets `"strictNullChecks": true`) in your TypeScript configuration, you will notice that the type of the returned value can still be `undefined` even though the `RequestContextData` interface has a specific type. For a discussion about how to work around this and the pros/cons of doing so, please read [this issue (#93)](https://github.com/fastify/fastify-request-context/issues/93).

[npm-image]<EMAIL_ADDRESS>[npm-url]: https://npmjs.org/package/@fastify/request-context
[downloads-image]: https://img.shields.io/npm/dm/fastify-request-context.svg
[downloads-url]: https://npmjs.org/package/@fastify/request-context

repository: fastify/fastify-request-context

repo_name: fastify/fastify-request-context