text:
Today I Learned

> Today I Learned.
A collection of concise write-ups on small things I learn across a variety of
languages and technologies.

## Categories
* [CleanCode](#cleancode) [**`3`**]
* [Go](#go) [**`7`**]
* [Miscellaneous](#miscellaneous) [**`10`**]
* [Python](#python) [**`8`**]
* [Shell](#shell) [**`13`**]
* [WebDev](#webdev) [**`4`**]

---

### CleanCode

Naming Variables & Functions Read More 🔽

# Naming Variables & Functions

1. The name of a variable, function, or class should answer all the big questions.
   It should tell you why it exists, what it does, and how it is used.
2. Classes & Objects should have *noun* or noun phrase names like *Student*,*Account* etc.
   A class name should not be a *verb*.
3. Methods should have verb or verb phrase names like *getCategories()*, *saveTutorial()*.

---
_PS : I have been reading [CleanCode](https://www.oreilly.com/library/view/clean-code/9780136083238/) for a while & logging what I learn here._

Writing Comments Read More 🔽

# Writing Comments

1. The proper use of comments is to compensate for our _failure to express
   ourself in code_.
2. Inaccurate comments are far worse than no comments at all.
3. Comments do not make up for the bad code.
   i.e if you find yourself writing comments for a code that is complex to understand.
   *MAKE IT LESS COMPLEX*.
4. Short functions don't need much description. A well-chosen name for a small function
   that does one thing is usually better than a comment header.
5. For example. In this code the comments are not needed bcoz the fucntion name describes what it is doing.

```python
def get_category_list():
    ''' Walk the current directory and get a list of all subdirectories at that
    level.  These are the "categories" in which there are TILs. '''
    dirs = [x for x in os.listdir('.') if os.path.isdir(x) and '.git' not in x]
    return dirs
```

### Summary
Until now I thought writing comments is a good practice & we should write comments wherever possible.
But know reading it is an eye opener & shocking 😱. I will try to avoid comments now.

---
_PS : I have been reading [CleanCode](https://www.oreilly.com/library/view/clean-code/9780136083238/) for a while & logging what I learn here._

Writing Functions Read More 🔽

# Writing Functions

Got to learn some new points regarding functions() in CleanCode.

1. Functions should be small.
2. They should do one thing only.
   > FUNCTIONS SHOULD DO ONE THING. THEY SHOULD DO IT WELL.
     THEY SHOULD DO IT ONLY.
3. To know if a function is doing more than "one thing" see if you can extract another
   funtion from it with a name that is not merely a restatement of its implementation.
4. Function arguments should *NEVER* be greater than 3.
5. We should never ignore any part of code.The parts we ignore are where the bugs will hide.

---
_PS : I have been reading [CleanCode](https://www.oreilly.com/library/view/clean-code/9780136083238/) for a while & logging what I learn here._

### Go

Clearing terminal screen in Go Read More 🔽

# Clearing terminal screen in Go

There are two ways I like (without any external dependency)

### Using `os/exec` package

I have added some boilerplate code to make sure you see whats happening. I think this is probably the best way to do this.

```golang
package main

import (
    "os"
    "fmt"
    "os/exec"
    "time"
)

func main() {
	fmt.Println("this is a line")
	fmt.Println("this is a line")
	fmt.Println("this is a line")
	fmt.Println("this is a line")
	fmt.Println("this is a line")

	fmt.Println("Clearing Screen in 2s...")

	// sleep for 2 seconds
	duration, _ := time.ParseDuration("2s")
	time.Sleep(duration)

    c := exec.Command("clear")
    c.Stdout = os.Stdout
    c.Run()
}
```

### Using ANSI Escape Sequences

Not a good way but may come in handy for some situations.

```golang

package main

import (
    "fmt"
    "time"
)

func main() {
	fmt.Println("this is a line")
	fmt.Println("this is a line")
	fmt.Println("this is a line")
	fmt.Println("this is a line")
	fmt.Println("this is a line")

	fmt.Println("Clearing Screen in 1s...")
	dur, _ := time.ParseDuration("1s")
	time.Sleep(dur)

    fmt.Print("\033[2J")
}
```

> The sequence `\033[2J` is read as _Esc[2J_ where *"2j"* clears the screen and moves the cursor to the home position (line 0, column 0).

Convert `string` to `int` and vice-versa in Go Read More 🔽

# Convert `string` to `int` and vice-versa in Go

There are basically 2-3 methods to convert integer to string and back to integer but the most easiest way is to use the `Itoa` and `Atoi` methods in the `strconv` package.

## Demo

```golang
package main

import (
    "fmt"
    "strconv"
)

func main() {
	// String to Int
	nice, _ := strconv.Atoi("69")
	fmt.Printf("%T", nice)

	//Integer to String
	high := strconv.Itoa(420)
	fmt.Printf("\n%T", high)
}
```

`Atoi` returns a second value (`err` ignored in this example for easier understanding)

The above code should output:
```
int
string
```
See [online](https://play.golang.org/p/moTZJ5LYEz9) demo

Creating Python's `next()` alternative using Go Closures Read More 🔽

# Creating Python's `next()` alternative using Go Closures

If you don't know what next() in python means, the below code illustrates it.

```python

MCU_Movies = iter(["Iron Man", "Thor", "Captain America: The first Avenger"])
x = next(MCU_Movies)
print(x, end="\n")
x = next(MCU_Movies)
print(x, end="\n")
x = next(MCU_Movies)
print(x)

```

So if you had guess this would print

```bash
Iron Man
Thor
Captain America: The first Avenger
```

> The `next()` function is used to get the next item in an iterator.

Go doesn't have a next method (nor the concept of iterators actually) so we will try to achieve something similar using [Closures](https://tour.golang.org/moretypes/25).

- A closure is implemented through a anonymous(_function with no name_) function, basically closure is an instance of function.
- In Go functions are first class citizens, meaning we can do all sort of things with them, assign them to a variable, pass as an argument to another function.

Below is a naive implementation of how this could look in Go. Ping me if you have a better way to do this ;)

```golang

package main

import "fmt"

/*
nextIterator returns another function, which we define anonymously in the body of nextIterator.
The returned function closes over the variable index to form a closure.
*/
func nextIterator(array []int) func() int {
    index := -1

    return func() int{
        index++
        return array[index]
    }
}
func main() {

	// an integer array
    var prices = []int{7, 1, 5}

    // create an instance of the anonymous function. i.e, a closue
    next := nextIterator(prices)

    // call the closure
    fmt.Println(next())
    fmt.Println(next())
    fmt.Println(next())

}
```

See this demo on [Go Playground](https://play.golang.org/p/8nH6t0HfnGu).

Measure Exection time in Go Read More 🔽

# Measure Exection time in Go

To know who how long your go code executes you can use the `time.Now()` and `time.Since()` methods in the `time` package.

## Demo

```golang

package main

import (
	"fmt"
	"time"
)

func main(){

	start := time.Now()
	dur, _ := time.ParseDuration("15ms")

	// A Go Anonymous function (self-executing)
	func (){
		for i := 0; i < 100; i++ {
			time.Sleep(dur)
			fmt.Println("Bhupesh is programming in Go")
		}
	}()

	elapsed := time.Since(start)

	fmt.Printf("Execution Time : %s", elapsed)
}

```

Since() returns the time elapsed since t (`start` in our demo). It is shorthand for `time.Now().Sub(t)`.

## Demo

```golang
package main

import (
	"fmt"
	"os"
)

func main() {
	os.Setenv("NAME", "gopher")

	fmt.Printf("My Desktop Environment : %s.\n", os.Getenv("XDG_CURRENT_DESKTOP"))
}
```

Splitting strings in Go Read More 🔽

# Splitting strings in Go

Splitting strings in Go is done by using the `Split()` method.
You need to import the `strings` standard library to use this.

## Demo

```golang
package main

import (
	"fmt"
	"strings"
)

func main(){
	var date string = "1999-03-12"
	date_array = strings.Split(date, "-")

	fmt.Println(date_array)
}
```

The `split()` return a Go Array, running this program should print the following:
```
[1999 03 12]
```

Where are my build files when I use `go run` Read More 🔽

# Where are my build files when I use `go run`

By default, 'go run' runs the compiled binary directly.
The binaries are stored in a `temp` work folder, to see where they are stored use the `-work` flag.

## Demo

```bash
go run --work fizzbuzz.go
```

Sample Output

```
WORK=/tmp/go-build645222420
[1 2 Fizz]
```

When you run this go will not delete the temporary build when exiting.
The default directory may vary with your system & `GOPATH`.

### Miscellaneous

Deploying to Heroku Read More 🔽

# Deploying to Heroku

## List of steps to follow when you are deployihg a **new** repository/project (Python).

1. `heroku login`
2. `touch Procfile`
Create Procfile for deployment. For a Django Web-App the contents of Procfile would be.
```
gunicorn djangoherokuapp.wsgi --log-file -
```
3. `touch runtime.txt`
Specify your Python version here. For example
```
python-3.6.8
```
4. `heroku create herokuAPPName`
Before running this, Make sure to add `appname.herokuapp.com` in ALLOWED_HOSTS and your `requirements.txt` is updated.

## List of commands to run when you are deployihg a **cloned** repository.

1. `heroku login`
Login with your e-mail and password.
2. `heroku git:remote -a <app-name>`
Where `app-name` is the name of app on heroku.
3. `git push heroku master`
Push new changes to heroku.

Internet search tips & tricks for developers Read More 🔽

# Internet search tips & tricks for developers

All of the below mentioned tips works in both DuckDuckGo & Google (i use both :wink:), it should work fine in other search engines too.

1. **`filetype:pdf golang`**

> Use it to search for books or specific file types

2. **`inurl:docs.djangoproject.com templates`**

> Use it to look for occurence of some phrases in the URL of the website mentioned.
`inurl` [docs.djangoproject.com](docs.djangoproject.com) look for `templates` phrase.

3. **`site:github.com synatx error`**

> Limit search results to a specific site, good for looking for bug fixes.

4. **`"how to add pagination in django"`**

> Double quotes can be used for exact matches of the phrase (doesn't work sometimes).

Killing Open Ports in Linux Read More 🔽

# Killing Open Ports in Linux

I had this weird error while running Django Development Server.

```
System check identified no issues (0 silenced).
January 27, 2020 - 16:42:39
Django version 2.2.9, using settings 'codeclassroom.settings'
Starting development server at http://<IP_ADDRESS>:8000/
Quit the server with CONTROL-C.
Error: That port is already in use.
```

## Solution
1. Run `netstat -ntlp` to see available open ports.
```
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 <IP_ADDRESS>:42405         <IP_ADDRESS>:*               LISTEN      -
tcp        0      0 <IP_ADDRESS>:5940          <IP_ADDRESS>:*               LISTEN      -
tcp        0      0 <IP_ADDRESS>:53           <IP_ADDRESS>:*               LISTEN      -
tcp        0      0 <IP_ADDRESS>:631           <IP_ADDRESS>:*               LISTEN      -
tcp        0      0 <IP_ADDRESS>:8000          <IP_ADDRESS>:*               LISTEN      12054/python3
tcp6       0      0 ::1:631                 :::*                    LISTEN      -
```

Here is a `man netstat` for what it does
> netstat  -  Print  network connections, routing tables, interface statistics,
       masquerade connections, and multicast memberships

You see the _python3_ one? Kill 😈 this process

2. Run `kill -9 12054`
Kill is used for Removing a background process or job, `-9` specifies SIGKILL (Forced termination) where `12054` is the PID

3. Run the development server again.

My vim cheatsheet Read More 🔽

# My vim cheatsheet

I have started transitioning slowly to lightweight editors, because of my low system configuration.
And what can better than `vim`, so I will start logging interesting things I learn here.

For starters I use **neovim**.
(PS: I will write this TIL through vim only :)

### How to install plugins
1. Open up the `~/.config/nvim/init.vim` file add the plugin.

My init file
```
call plug#begin()
Plug 'roxma/nvim-completion-manager'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'scrooloose/nerdtree', { 'on':  'NERDTreeToggle' }
Plug 'gilgigilgil/anderson.vim'
call plug#end()

vnoremap <C-c> "+y
map <C-v> "+p
nmap <F6> :NERDTreeToggle<CR>

colorscheme anderson

set nu
set ai
```

2. Open nvim, use `:PlugInstall` to install the new plugins.

### Some nvim specifc shortcuts

- E - to go back the directory after opening a file.
- :NERDTree - to start the Tree like menu.
- When in NERDTree use m for creating a file.

### Vim Commands

1. `:i` : to come in Insert/Editing Mode.
2. Esc : for command mode.
3. `:V` : to enable visual mode, use shift and arrow keys to select text.
4. `:"+y` : for yanking(copying) text from vim to system's clipboard (tested on Ubuntu 18, might not work on other systems. Search according to your system).
5. `:nohlsearch` : for clearing search highlighting.
6. `:set nu` : to enable Line numbers(left margin).
7. `:"+p` : to paste from system's clipboard (I have added key bindings for copy/paste in my nvim config file).
8. `:u` : Undo latest changes in vim.
9. Ctrl + ws : Split Windows horizontally.
10. Ctrl + wv : Split Windows vertically.
11. Ctrl + ww : Switch between Windows.
12. Ctrl + wq : Quit Window.
13. `:earlier N` : Time travel in past N seconds.
14. `:later N` : Time tavel in future N seconds.
15. `:echo $MYVIMRC`: to view location of your default `.vimrc` file.
16. Use `==` in Visual Mode to fix line indent.
---
I will only add stuff here when I start using it or use it for the first time.

Record your Desktop using `ffmpeg` Read More 🔽

# Record your Desktop using `ffmpeg`

1. Make sure you have ffmpeg installed, by checking `ffmpeg -version`. If not install use `sudo apt-get install ffmpeg`.

2. Run the following command.
```bash
ffmpeg -video_size 1280x1024 -framerate 25 -f x11grab -i :0.0+0,0 -c:v libx264rgb -crf 0 -preset ultrafast output.mkv
```
- `-video_size` specifies the size of the recorded area. If you have a different screen size, use that instead of 1920x1080. If you want to record only an area of the screen, specify the area size here.

- `-framerate` specifies the frame rate, i. e. how many frames of video are recorded in a second. The lowest allowed framerate is 20.

- `-f x11grab` is what actually tells FFmpeg to record your screen. You shouldn't change that.

- `-i :0.0+0,0` is where you specify the x and y offset of the top left corner of the area that you want to record. For example, use :0.0+100,200 to have an x offset of 100 and an y offset of 200.

- `-c:v libx264rgb -crf 0 -preset ultrafast` are encoding options. These specify a fast and lossless recording.

> Run `xdpyinfo | grep 'dimensions:'` to know your monitor dimensions

## Resources
- [Record-Your-Desktop-Using-FFmpeg-on-Ubuntu-Linux](https://www.wikihow.com/Record-Your-Desktop-Using-FFmpeg-on-Ubuntu-Linux)

Releases on GitHub Read More 🔽

# Releases on GitHub

Git tagging is generally used to release software on github.
Here are some basic git commands for tagging.

- To tag specific points of your repo. Run this when you commit something.
  ```shell
  git tag -a v1.4 -m "my version 1.4"
  ```

- To lists all the tags of your repo.
  ```bash
  git tag
  ```

- To tag specific commits.
  ```bash
  git tag -a v1.4 9fceb02
  ```

- To push tags on GitHub.
  ```bash
  git push origin v1.4
  ```

SEO Tools Read More 🔽

# SEO Tools

Here is a list of some tools to test your website for SEO and Social Media.

- [Facebook's Sharing Debugger](https://developers.facebook.com/tools/debug/sharing/).
- [Twitter Card Validator](https://cards-dev.twitter.com/validator).
- [Google's Structured Data Testing Tool](https://search.google.com/structured-data/testing-tool/u/0/).
- [web.dev](https://web.dev/)

Semantic Versioning Read More 🔽

# Semantic Versioning

- Describes how softwares are assigned version numbers.
- We generally see 3 parts in a version number, `x.y.z` (MAJOR, MINOR, PATCH)
	1. `x` represents MAJOR part - meant for describing any major backend code changes, support of APIs etc.
	2. `y` represents MINOR part - meant for describing very small changes.
	3. `z` represents PATCH part - meant for describing bug fixes.

### Resources
- [Semantic Versioning 2.0.0](https://semver.org/)

What's a Procfile 👀 Read More 🔽

# What's a Procfile 👀

I recently deployed a Python application on Heroku, there I encountered a `Procfile`.
This is what I got to know :

- The Procfile is a simple text file that is named `Procfile` without a file extension. For example, `Procfile.txt` is not a valid Procfile.
- It specifies the commands that are executed by the app on startup. For e.g A Django server.
- Example: If you want to run a python script on Heroku, your *Procfile* content should be
   `worker: python script.py`

### Resources
- [The Procfile](https://devcenter.heroku.com/articles/procfile)

Writing Cleaner Commits - Template Read More 🔽

# Writing Cleaner Commits - Template

Writing cleaner commits is hard, so I use this template which makes me a pro 😅

```text
# If applied, this commit will...
# [Add/Fix/Remove/Update/Refactor/Document] [issue #id] [summary]

# Why is it necessary? (Bug fix, feature, improvements?)
-
# How does the change address the issue?
-
# What side effects does this change have?
-

```

##### OR

```text
# If applied, this commit will...
# [Add/Fix/Remove/Update/Refactor/Document]

# Reference any issue number here
- This fixes #454
# Why is it necessary? (Bug fix, feature, improvements?)
-
# How does the change address the issue?
-
```

## How ?
You have to configure Git to use the above template file (for example, `.gitmessage` in your home directory), then create the template file by running.

```bash
git config --global commit.template ~/.gitmessage
subl ~/.gitmessage
```

This will invoke sublime with the template (use `code` if you use VSCode) Now copy paste the above template, hit save and your are done.

Now when commiting changes instead of using `git commit -m ""`, Use `git commit` this will invoke the commit template which you already set.

### Resources

- [How to Write a Git Commit Message](https://chris.beams.io/posts/git-commit/)
- [Git commit practices your future self will thank you for](https://victoria.dev/blog/git-commit-practices-your-future-self-will-thank-you-for/)

### Python

Cryptographically strong random string Read More 🔽

# Cryptographically strong random string

One liner

```bash
python3 -c "import secrets;print(secrets.token_urlsafe())"
```

Sample Runs

```bash
>>> import secrets
>>> secrets.token_urlsafe()
'noLCpWgg5bJbALwlqAKKWUcb4nZg0LvxIUFHyhyei-I'
>>> secrets.token_urlsafe()
'8HhV5FMm2vxfrSoO9o_v65FRy6bLbvc89POSX0fnMqk'
>>> secrets.token_urlsafe()
'bClPydJqA7_0GsDvUAqqShUH5ZucWzdErg0tZIGZU2k'
>>> secrets.token_urlsafe()
'82LSHzCKkwo5y__3NZrck27ZbDL1WiKoSYxQQki8uvA'
>>>
```

Difference b/w Class & Function Based Views in Django Read More 🔽

# Difference b/w Class & Function Based Views in Django

		Function Based Views
		Class Based Views

More setup

Less Abstraction

Requires error checking

Less modular

Little setup

More "magic" abstraction

Error handling built-in (generics)

Much more modular

Sane and stable generic API

Fastest Python First: Tips and Tricks 🏃 Read More 🔽

# Fastest Python First: Tips and Tricks 🏃

Here are some tips that I learned to make Python Programs faster (_WIP_).

1. Always compile regular expression, if you have to match patterns a lot of times.

```python
import re

pattern = re.compile(some_regular_expression)
some_text = re.sub(pattern, '', data)

```

2. Use List comprehension for iterating over a list.

```python
import time

itemlist = [23, 45, 56, 67, 1, 100, 340, 90]
""" Normal Iteration """
start_time = time.time()
for item in itemlist:
	if item % 2 == 0:
		print(item)
end_time = time.time()

print("Without List Comprehension : " + str(end_time - start_time))

""" List Comprehension """
start_time = time.time()
[print(item) for item in itemlist if item % 2 == 0]
end_time = time.time()

print("With List Comprehension : " + str(end_time - start_time))
```

Output :
```bash
56
100
340
90
Without List Comprehension : 0.0002067089080810547
56
100
340
90
With List Comprehension : 0.00019121170043945312
```

Functional Programming in Python 🐍 Read More 🔽

# Functional Programming in Python 🐍

Features like `lambda`, `map`, `filter`, `reduce` are generally used to perform functional programming related tasks in Python.
Let's take a quick look on them.

### Lambdas
- Anonymous functions
- No function name,
- They can be passed as function arguments/objects.
- No `return` statment, evaluated exrpession is returned automatically.
- Single line function.

Example :

```python
double = lambda x: x*x
print(double(34))

elementList = [34, 56, 78, 90, 0, 12]
doubleList = lambda elementList: [e*e for e in elementList]
print(doubleList(elementList))
```

### Map
- applies a function to all the items in an input list.
- `map(function_to_apply, list_of_inputs)`.

Example :

```python
myList = ["bhupesh", "varshney", "is", "a", "developer"]

capitalize = list(map(lambda x: x.upper(), myList))
print(capitalize)
```

### Filter
- creates a list of elements for which a function returns `True`.

Example :

```python
mylist = [23, 45, 6, 8, 10, 16]
evenList = list(filter(lambda x: x%2 == 0, mylist))
print(evenList)
```

### Reduce
- accepts a function and a sequence(list/set *etc*) and returns a single value calculated.
- Initially, the function is called with the first two items from the sequence and the result is returned.
- The function is then called again with the result obtained in step 1 and the next value in the sequence. This process keeps repeating until there are items in the sequence.

Example :

```python
from functools import reduce

li = [5, 8, 10, 20, 50, 100]

sum = reduce((lambda x, y: x + y), li)
print(sum)
```

PEP8 - the fashion 💃 police of Python Read More 🔽

# PEP8 - the fashion 💃 police of Python

Well basically PEP8 is a style guide which provides guidelines and best practices
for writing python code.

### How I learn?
Well bascially the official Python docs for [PEP8](https://www.python.org/dev/peps/pep-0008/) seems good but I use [pep8.org](https://pep8.org/).
It provides much more cleaner interface.

### Summary
Below is a summary which includes some go-to rules you can memorize.

1. Use 4 spaces per indentation level.
2. Spaces are preferred instead of tabs (Why ?? :disappointed_relieved:)
   Python disallows mixing of Tabs & Spaces (Syntax Errors).
   So be consistent with what you choose, I prefer tabs :wink:
3. Limit all lines to a maximum of 79 characters. Use \ to break/continue line.
4. Never use the characters ‘l’ (lowercase letter el), ‘O’ (uppercase letter oh), or ‘I’ (uppercase letter eye) as single character variable names. These are misunderstood with numerals one and zero in some font styles.
5. Function Names - lowercase words separated by _ .
6. Class Names - Start each word with a capital letter. Use CamelCase E.g StudentClass

### Tools
If use Sublime Text, you can install [Python PEP8 Autoformat](https://packagecontrol.io/packages/Python%20PEP8%20Autoformat) - it does the job for you.

Publishing a Package on PyPI Read More 🔽

# Publishing a Package on PyPI

I just published my first package on pypi 😍
I used the following steps to do it :

1. Put your python files/classes inside the folder `package-name`.Also make sure your main class file has the same name `package-name`.

2. Add the `__init__.py` file in the same folder. Use the init file like this.
```python
from coderunner.coderunner import Run
```

3. Now make a file `setup.py` inside the root of your github folder.
Add the following contents in it:
```python
import setuptools

with open("README.md", "r") as fh:
    long_description = fh.read()

setuptools.setup(
    name="plagcheck",
    version="0.1",
    author="Bhupesh Varshney",
<EMAIL_ADDRESS>    description="A Powerful Moss results scrapper",
    keywords='mosspy moss plagiarism cheat',
    long_description=long_description,
    long_description_content_type="text/markdown",
    url="https://github.com/codeclassroom/PlagCheck",
    project_urls={
        "Documentation": "https://github.com/codeclassroom/PlagCheck/blob/master/docs/docs.md",
        "Source Code": "https://github.com/codeclassroom/PlagCheck",
        "Funding": "https://www.patreon.com/bePatron?u=18082750",
        "Say Thanks!": "https://github.com/codeclassroom/PlagCheck/issues/new?assignees=&labels=&template=---say-thank-you.md&title=",
    },
    packages=setuptools.find_packages(),
    install_requires=[
        'requests',
        'mosspy',
        'beautifulsoup4',
        'lxml',
    ],
    classifiers=[
        "Programming Language :: Python :: 3",
        "License :: OSI Approved :: MIT License",
        'Topic :: Software Development :: Build Tools',
        "Operating System :: OS Independent",
    ],
    python_requires='>=3.6',
)
```

4. Now make a file `setup.cfg`.
It is used for displaying project description on PyPi.
```txt
[metadata]
description-file = README.md
```

5. Install the followig libraries.
```bash
pip3 install setuptools wheel twine
```

6. Run the following command.
```bash
python3 setup.py sdist bdist_wheel
```

7. Finally upload it to PyPi.
```bash
twine upload dist/*
```
This will prompt for your PyPi username and password.

## Resources
- [Packaging Python Projects](https://packaging.python.org/tutorials/packaging-projects/)
- [How to upload your python package to<EMAIL_ADDRESS>

Specify dev dependencies in setup.py Read More 🔽

# Specify dev dependencies in setup.py

```python
# setup.py
...

extras_require = {
    "dev": [
        "pytest>=3.7",
    ],
}
```

Test it locally

```bash
pip install -e .[dev]
```

Writing Unit Tests in Python ✅ Read More 🔽

# Writing Unit Tests in Python ✅

1. Simple and easy just import the Python 3 built-in library `unittest`.
2. Wrap up tests in a Class.
3. Use assert methods.

```python
import unittest

class TestSum(unittest.TestCase):

    def test_sum(self):
        self.assertEqual(sum([1, 2, 3]), 6, "Should be 6")

    def test_sum_tuple(self):
        self.assertEqual(sum((1, 2, 2)), 6, "Should be 6")

if __name__ == '__main__':
    unittest.main()

```

### Resources
- [Getting Started With Testing in Python](https://realpython.com/python-testing/)
- [unittest — Unit testing framework](https://docs.python.org/3.6/library/unittest.html)

### Shell

Alternative to 'ls' commnand Read More 🔽

# Alternative to 'ls' commnand

the bash builtin `echo` can be used to list contents of a directory.

```bash
echo *
```

List all files that start with letter 'i'.

```bash
echo i*
```

## How

The character * serves as a "wild card" for filename expansion in globbing. By itself, it matches every filename in a given directory.

## Resource
- [globbing](https://www.tldp.org/LDP/abs/html/globbingref.html)

Colorize Output in Terminal Read More 🔽

# Colorize Output in Terminal

The ANSI escape sequences help adding color to the terminal (Doesn't work on Windows I guess)

Here is the format:

`\033[<ForegroundColorCode>;<BackgroundColorCode>;<Style>mYour Text`

where

`<ForegroundColorCode>`, `<BackgroundColorCode>` & `<Style>` are integer Color Codes.
See [Resources](##Resources) for list of colors.

Example :
```bash
echo -e "\033[92;1mHello\033[0m"
```
Hello will be bold & green in color

## Resources

- [List of ANSI color escape sequences](https://stackoverflow.com/questions/4842424/list-of-ansi-color-escape-sequences)
- [Bash tips: Colors and formatting (ANSI/VT100 Control sequences)](https://misc.flogisoft.com/bash/tip_colors_and_formatting)

Copy one file to multiple files in Bash Read More 🔽

# Copy one file to multiple files in Bash

```bash
for f in file{1..10}.py; do cp main.py $f; done
```
> this will create new files file_1.py, file_2.py etc and copy contents of _main.py_ file to all of them.

Find default git branch name Read More 🔽

# Find default git branch name

```bash
git remote show origin | awk '/HEAD/ {print $3}'
```

Find files changed 7 days ago Read More 🔽

# Find files changed 7 days ago

To find last modified file
```bash
find Documents/ -mtime -1
```
where `mtime` means "Last Modification Time"

To find files Accessed (read operation)
```bash
find Documents/ -atime -7
```
where `atime` means "Last Access Time"

**-7** signifies anything changed 7 days or less.
**+7** signifies anything changed atleast 7 days ago.
**7** signifies anything changed exactly 7 days ago.

an alternative version

```bash
find Documents/ -newermt "7 days ago" -ls
```

Find fonts available in Linux Read More 🔽

# Find fonts available in Linux

```bash
fc-list
```

Finding all Python Virtual Environments in your system Read More 🔽

# Finding all Python Virtual Environments in your system

So if you work with Python all day, you already know about Virtual Environments.
The only problem with me 😅 is that I end up creating a lot of them when using and making my side-projects.
We know that there is a `activate` script that can be used for this purpose.

shut up & give me answer

Ok

## Using `find`

```bash
find /home -name "*activate"
```

This will list out all activate scripts in your home directory (should work fine).
Only problem, it is slow.

**Sample Ouput**

```
/home/bhupesh/Desktop/testFind/bin/activate
/home/bhupesh/Desktop/bits/bin/activate
/home/bhupesh/Desktop/cc-new/bin/activate
/home/bhupesh/Desktop/test-audio/bin/activate
/home/bhupesh/Desktop/comp-code/bin/activate
/home/bhupesh/Desktop/req-blog/bin/activate
/home/bhupesh/Desktop/py-cli/bin/activate
/home/bhupesh/Desktop/sian-env/bin/activate
/home/bhupesh/Desktop/ques/bin/activate
/home/bhupesh/Documents/api/bin/activate
/home/bhupesh/Documents/defe-venv/bin/activate
/home/bhupesh/Documents/bot-tutorial/bin/activate
/home/bhupesh/Documents/cc/bin/activate
/home/bhupesh/Documents/test-package/bin/activate
/home/bhupesh/Documents/qt-lear/bin/activate
/home/bhupesh/Documents/csv-voil/bin/activate
/home/bhupesh/Documents/bottest/bin/activate
/home/bhupesh/Documents/new-tutorialdb/bin/activate
/home/bhupesh/Documents/cc2/bin/activate
/home/bhupesh/Documents/plag/bin/activate
find /home -name "*activate"  2.57s user 4.14s system 7% cpu 1:31.72 total
```

## Using `locate`

```bash
locate -b '\activate' | grep "/home"
```
Grep your home directory for all activate scripts.

**Sample Output**

```
/home/bhupesh/Desktop/bits/bin/activate
/home/bhupesh/Desktop/cc-new/bin/activate
/home/bhupesh/Desktop/comp-code/bin/activate
/home/bhupesh/Desktop/py-cli/bin/activate
/home/bhupesh/Desktop/ques/bin/activate
/home/bhupesh/Desktop/req-blog/bin/activate
/home/bhupesh/Desktop/sian-env/bin/activate
/home/bhupesh/Desktop/test-audio/bin/activate
/home/bhupesh/Desktop/testFind/bin/activate
/home/bhupesh/Documents/api/bin/activate
/home/bhupesh/Documents/bot-tutorial/bin/activate
/home/bhupesh/Documents/bottest/bin/activate
/home/bhupesh/Documents/cc/bin/activate
/home/bhupesh/Documents/cc2/bin/activate
/home/bhupesh/Documents/csv-voil/bin/activate
/home/bhupesh/Documents/defe-venv/bin/activate
/home/bhupesh/Documents/new-tutorialdb/bin/activate
/home/bhupesh/Documents/plag/bin/activate
/home/bhupesh/Documents/qt-lear/bin/activate
/home/bhupesh/Documents/test-package/bin/activate
locate -b '\activate'  0.45s user 0.02s system 99% cpu 0.476 total
grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox} "/home"  0.00s user 0.00s system 0% cpu 0.472 total
```

Now you can just do `source <path>`.

Generate random numbers in bash Read More 🔽

# Generate random numbers in bash

Easiest way is to use the `$RANDOM` variable.

```bash
>> echo "$RANDOM"
12261
```

Each time this parameter is referenced, a random integer between **0** and **32767** is generated.

A better way which I like is to use the GNU coreutil, `shuf`

One Random number between 69 & 420
```bash
shuf -i69-420 -n1
```

Five Random numbers between 69 & 420
```bash
shuf -i69-420 -n5
```

Get System info using Shell Commands Read More 🔽

# Get System info using Shell Commands

### Memory Used/Total

```shell
free -h | awk '/^Mem:/ {print $3 "/" $2}'
```

### Show CPU temperature

```shell
sensors | awk '/^Core*/ {print $1$2, $3}'
```

### Most Memory Intensive processes

```shell
ps axch -o cmd:15,%mem --sort=-%mem | head
```

### Most CPU Intensive processes

```shell
ps axch -o cmd:15,%cpu --sort=-%cpu | head
```

Get Total System Memory using `vmstat` command Read More 🔽

# Get Total System Memory using `vmstat` command

```bash
vmstat -s | grep "total memory" | grep -Eo '[0-9]{1,}'
```

This will print the total memory (your RAM) in highlighted text.

The command `vmstat -s` is usually used to print memory statistics a sample output might look like

```bash
   1882140 K total memory
    644068 K used memory
    861172 K active memory
    653200 K inactive memory
    217160 K free memory
     55140 K buffer memory
    965772 K swap cache
   2097148 K total swap
    230400 K used swap
   1866748 K free swap
    169316 non-nice user cpu ticks
      4939 nice user cpu ticks
     37944 system cpu ticks
    666678 idle cpu ticks
     53315 IO-wait cpu ticks
         0 IRQ cpu ticks
       693 softirq cpu ticks
         0 stolen cpu ticks
   2554778 pages paged in
   1429680 pages paged out
     40722 pages swapped in
    191481 pages swapped out
   3487312 interrupts
  10042547 CPU context switches
1590932382 boot time
      9975 forks
```

Line Discipline in Unix/Linux Machines Read More 🔽

# Line Discipline in Unix/Linux Machines

Line discipline handles things like backspace and also generates various signals for special characters like Ctrl + C/Z etc.

`stty -a` will display all these settings.
To know more do `man ssty`.

## Demo

Other than Ctrl+c and Ctrl+z which you already know about. Here are some other tricks.

Fire up your terminal. And start typing....

		Keyboard Shortcut
		Description

	Ctrl+?
		Delete the last input character, Basically Backspace (See what I am talking about, ^? can be used in terminals which may not support the backspace key

		Ctrl+q
		Erase line, works like carriage return /r

		Ctrl+a
		Moves cursor to beginning of line

		Ctrl+e
		Moves cursor to end of line

		Ctrl+w
		Delete the last input "word"

		Ctrl+k
		Erase line to the end, from current cursor position

		Ctrl+y
		Paste the last erased text

Apart from these line input specific keyboard shortcuts. We also have ...

#### Multiline Input

Use `/` for continuing the multiline input.

```bash
bhupesh@dev: hello my name\
is\
bhupesh\
check\
> my boi\
> hoooo\
>
```

A better version

```bash
#!/bin/bash

echo -e "Enter Commit Message (Ctrl+d to stop) : "
commit_message=$(</dev/stdin)

echo -e "\n\n$commit_message"
```

Make it executable and run.

```bash
Enter Commit Message (Ctrl+d to stop) :
- fixed bug #454
- Increase reponse time
- style fixes

- fixed bug #454
- Increase reponse time
- style fixes

```

All of this is controlled by the `tty` driver

## Resources

- [The TTY demystified](https://www.linusakesson.net/programming/tty/index.php)

Monitor network (data) usage Read More 🔽

# Monitor network (data) usage

The amount of data sent(uploaded) & received (downloaded) can be found out
using the following bash script.

- Only works per session, i.e stats are gathered once you power up your PC (or login).
- Good to have if you have limited data avaiability & want to montior your data usage.

```bash

netu() {
    # [net]work [u]sage: check network usage stats

    net_device=$(route | awk '/default/ {print $8}')
    TRANSMITTED=$(ifconfig "$net_device" | awk '/TX packets/ {print $6$7}')
    RECEIVED=$(ifconfig "$net_device" | awk '/RX packets/ {print $6$7}')

    pc_uptime=$(uptime -p | awk '{for (i=2; i<NF; i++) printf $i " "; if (NF >= 1) print $NF; }')
    printf "%s\n\n" "Network Usage since $pc_uptime"
    printf "%s\n" "$(tput bold)🔼 TRANSMITTED $(tput sgr0): $TRANSMITTED"
    printf "%s\n" "$(tput bold)🔽 RECEIVED    $(tput sgr0): $RECEIVED"
}

```

### Demo
![netu](https://user-images.githubusercontent.com/34342551/89729900-9d0b6100-da57-11ea-8497-233b64e42dc6.png)

[Grab it from here](https://github.com/Bhupesh-V/.Varshney/blob/316cde84f3a666cf3f503a2de34e8289074ffbce/.bash_functions#L69)

Random emoji 😲 in one line Read More 🔽

# Random emoji 😲 in one line

```bash
rand_int=$(shuf -i600-700 -n1); printf "%b\n" "\U1F$rand_int"
```

> PS: I am still working on a better way, this will only generate emojis in UNICODE range `1F601` to `1F700` while ignoring codepoints like `1F60A` 😊. Let me know if you have a beter way (create an issue)

### WebDev

Auto-complete in plain HTML Read More 🔽

# Auto-complete in plain HTML

You can make a type-ahead/autocomplete like thing in plain HTML
using the `<datalist></datalist>` tag.

## Usage
```html
<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<body>
<h1>Type Ahead HTML</h1>
<input list="test" placeholder="Choose an option">
<datalist id="test">
	<option value="C++">
	<option value="Python">
	<option value="Go">
	<option value="JavaScript">
	<option value="HTML">
</datalist>
</body>
</html>
```

Now as you type `G` it will show _Go_ ;)

### Resources
- [tweet by Álvaro Trigo](https://twitter.com/IMAC2/status/1206913760696373253)

I learned about Open Graph protocol Read More 🔽

# I learned about Open Graph protocol

### What it does ?
- [Open Graph](http://ogp.me/) Makes your website into rich "graph" objects.
- Now, what I understand from it is that it provides us to add
  additional metadata to your website which makes it more **rich** on social media.
  For e.g you see the thumbnails of links in the Telegram - *courtesy of OpenGraph*

### How ?
Information is added into the `<head>` tags.
For e.g below is the metadata of one of my [blogs](https://bhupeshv.me/30-Seconds-of-C++/)

```html
<meta property="og:description" content="A collection of C++ STL features (functions/libraries) which can be learned in 30 seconds or less" />
<meta property="og:title" content="30 Seconds of C++" />
<meta property="og:url" content="/30-Seconds-of-C++/" />
<meta property="og:image" content="/images/blog5.png"/>
```

### Sidenotes
Socila Media platforms like Twitter, LinkedIn, Telegram heavily use this meta info to render links, display images etc.

Live Editing HTML Read More 🔽

# Live Editing HTML

Yes !, you can live edit webpages by adding the following in the `<html>` tag.

```html
<!DOCTYPE html>
<html contenteditable>
<head>
	<title>Yay! Live Editing</title>
</head>
<body>
	<p>Try Editing Tis</p>
</body>
</html>
```

Setting `contenteditable="true"` will make its content editable.

So what ?
Well you can use this HTML5 feature to make a motepad right into your browser.

```html
data:text/html, <html contenteditable <head ><title>Notepad</title></head><body style="background-color:black;color: white;"></body></html>
```

`async` & `defer` Attributes Read More 🔽

# `async` & `defer` Attributes

Usually javascript files interrupt the parsing of HTML document.
To prevent this 2 special attributes of the `<script>` elements are used.

### `async`

```js
<script async src="script.js">
```
- The async attribute is used to indicate to the browser that the script file can be executed asynchronously.
- Therefore the HTML parser does not need to pause and wait for the JS code to load, it is intead fetched in parallel.
- It is only available for externally located script files.

### `defer`

```js
<script defer src="script.js">
```
- The defer attribute tells the browser to only execute the script file once the HTML document has been fully parsed.
- The js file can be downloaded but it does not executes until the whole HTML is parsed.

## Usage

See [USAGE.md](https://github.com/Bhupesh-V/til/blob/master/USAGE.md) to know how I use this repository.

## Author

👤 **Bhupesh Varshney**

- Web : [bhupesh.codes](https://bhupesh-v.github.io)
- Twitter : [@bhupeshimself](https://twitter.com/bhupeshimself)
- DEV : [bhupesh](https://dev.to/bhupesh)

## ☺ Show your support

Support me by giving a ⭐ if this project helped you! or just [![Twitter URL](https://img.shields.io/twitter/url?style=social&url=https%3A%2F%2Fgithub.com%2FBhupesh-V%2Ftil%2F)](https://twitter.com/intent/tweet?url=https://github.com/Bhupesh-V/til&text=til%20via%20@bhupeshimself)

## 📝 License

Copyright © 2020 [Bhupesh Varshney](https://github.com/Bhupesh-V).

This project is [MIT](https://github.com/Bhupesh-V/til/blob/master/LICENSE) licensed.

## About

Original Idea/Work [thoughtbot/til](https://github.com/thoughtbot/til).

repository: caketi/til

repo_name: caketi/til


text:
---
title: Extension steamers berthed in the
tags:
  - Aug 1907
---

Extension steamers berthed in the Miami River: Biscayne, Wanderer, Satilla, Kennedy, Rough Rider and Babcock.

Newspapers: **Daily Miami Metropolis, The Miami Metropolis (daily), The Daily Metropolis or Miami Daily Metropolis**

Page: **1**, Section: **N/A**

license: MIT

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
title=Nextflow and the human microbiome: from data to insights
date=2019-05-28
type=col8
tags=nextflow,nfcamp,2019,workshop
status=published
~~~~~~

## Nextflow and human microbiome: from data to insights

### Francesco Strozzi
*Head of Data Science, Enterome Bioscience, France*

Using Nextflow at scale gives the possibility to extensively analyse complex datasets such as the human gut microbiome, and investigate microbial composition both at the taxonomical and functional level. This is a fundamental step towards a broader and deeper comprehension of the role the human microbiome has in diseases progression, prevention and treatment. Key examples will be presented to highlight the impact and the contribution Nextflow is providing in this field.

### Bio

Head of Data Science, leading a team of bioinformaticians and biostatisticians focused on quantitative and functional human microbiome analysis for drugs development and biomarkers discovery.

### Registration

To attend Nextflow Camp 2019 register at [this link](https://www.crg.eu/en/event/coursescrg-nextflow-2019).

repository: nextflow-io/website

gha_language: HTML

repo_name: nextflow-io/website


text:
# jsii-docgen

Generates markdown reference documentation for jsii modules.

## Usage

You can use this as a command line tool or as a library if you need more control.

Single module usage (from module root dir):

```shell
$ jsii-docgen
```

Will produce a file called `API.md` with the api reference for this module (without any dependencies).

To generate docs for an entire typesystem:

```shell
$ jsii-docgen [-o OUTDIR] JSII_FILE ...
```

Will generate API reference for all the types in the JSII files specified in the command line. Default `OUTDIR` is `dist`.

For example, the following command will generate markdown reference documentation for all jsii modules in your project:

```shell
$ jsii-docgen node_modules/**/.jsii
```

As a library:

```ts
import { renderPages } from 'jsii-docgen';
import * as reflect from 'jsii-reflect';

const ts = new reflect.TypeSystem();
await ts.loadFile('my/project/.jsii');

// you can customize how links are rendered
const ctx = {
  links: {
    renderLink: type => `/api/v${version}/${renderFileName(type)}`
  }
};

const pages = await renderPages(ts, ctx);

for (const page of pages) {
  console.log('FQN:', page.type.fqn);
  console.log('MARKDOWN:', page.markdown);
}
```

## Contributions

All contributions are welcome, just raise an issue or submit a PR. Add a test,
update readme. Do the right thing.

## License

[Apache 2.0](./LICENSE)

repository: jogold/jsii-docgen

repo_name: jogold/jsii-docgen


text:
ipycanvas

 Interactive Canvas in Jupyter

[![Documentation](http://readthedocs.org/projects/ipycanvas/badge/?version=latest)](https://ipycanvas.readthedocs.io/en/latest/?badge=latest)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/martinRenou/ipycanvas/stable?filepath=examples)
[![Build Status](https://travis-ci.org/martinRenou/ipycanvas.svg?branch=master)](https://travis-ci.org/martinRenou/ipycanvas)

ipycanvas is a lightweight, fast and stable library exposing the [browser's Canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API) to Python.
It allows you to draw simple primitives directly from Python like text, lines, polygons, arcs, images etc.

## Try it online!

You can try it online by clicking on this badge:

[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/martinRenou/ipycanvas/stable?filepath=examples)

## Documentation

You can read the documentation following this link: https://ipycanvas.readthedocs.io/en/latest/

## Examples

### Create John Conway's Game Of Life
![John Conway's Game Of Life](docs/source/images/ipycanvas_gameoflife.png)

### Draw Particles from IPython
![Particles](docs/source/images/ipycanvas_particles.png)

### Custom Sprites
![Sprites](docs/source/images/ipycanvas_sprites.png)

### Draw data directly from a NumPy array
![NumPy](docs/source/images/ipycanvas_binary.png)

### Create your own plotting library **fully** in Python
![Plotting](docs/source/images/ipycanvas_scatter.png)

## Installation

You can install using `pip`:

```bash
pip install ipycanvas
```

Or using `conda`:

```bash
conda install -c conda-forge ipycanvas
```

And if you use jupyterlab:

```bash
jupyter labextension install @jupyter-widgets/jupyterlab-manager ipycanvas
```

If you are using Jupyter Notebook 5.2 or earlier, you may also need to enable
the nbextension:
```bash
jupyter nbextension enable --py [--sys-prefix|--user|--system] ipycanvas
```

## Installation from sources

You can install using `pip`:

```bash
git clone https://github.com/martinRenou/ipycanvas
cd ipycanvas
pip install .
```

And if you use jupyterlab:

```bash
jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter labextension install .
```

And you use the classical Jupyter:

```bash
jupyter nbextension install --py --symlink --sys-prefix ipycanvas
jupyter nbextension enable --py --sys-prefix ipycanvas
```

repository: JeremiasE/ipycanvas

repo_name: JeremiasE/ipycanvas


text:
---
title: "Comparing Groups"
subtitle: "A interface for creating summary tables"
permalink: /compare-groups-package.html
layout: post
tags: ["phd", "general", "overview", "website"]
image: /img/compareGroups-gui-shot.jpg
---

Taking a raw dataset and modifying the data to be able to present simple summary statistics can be challenging in R because often researchers that are working with the data only need to write the code to understand the process they are expecting to see. However, often it is these statistics that will provide the hints and support needed from other collaborators.

There are now a series of packages that can do much of this relatively short code snippets. Here I layout some of these packages and some quick cheat code to get through this process quickly.

## A list of packages that my be helpful

```{r }
# arsenal
# qwraps2
# amisc
# table1
# tangram
# furniture
# table-one
# compareGroups
# htmltable
```

## `comparegroups` package

### FOr example:

```{r }
library(tidyverse)
library(gapminder)
data(gapminder)

median_gdp <- median(gapminder$gdpPercap)
gapminder %>%
  select(-country) %>%
  mutate(gdpPercap = ifelse(gdpPercap > median_gdp, "high", "low")) %>%
  mutate(gdpPercap = factor(gdpPercap)) %>%
  mutate(pop = pop / 1000000) -> gapminder

gapminder <- lapply(gapminder, function(x) x[sample(c(TRUE, NA),
    prob = c(0.9, 0.1),
    size = length(x),
    replace = TRUE
  )])
```

```1 Introduction
The compareGroups package (Subirana, Sanz, and Vila 2014) allows users to create tables displaying results of univariate analyses, stratified or not by categorical variable groupings.```

```Tables can easily be exported to CSV, LaTeX, HTML, PDF, Word or Excel, or inserted in R-markdown files to generate reports automatically.```

```This package can be used from the R prompt or from a user-friendly graphical user interface for non-R familiarized users.```

```The compareGroups package is available on CRAN repository. To load the package using the R prompt, enter:"```

```library(compareGroups)```

![image](/img/compareGroups-gui-shot.jpg)

## Tutorials

There is a very good vignette for this package [here]("https://cran.r-project.org/web/packages/compareGroups/vignettes/compareGroups_vignette.html#launch-the-wui-application").

I have developed this slightly in my notes as function used for quick descriptive statistics using R and a GUI. For now these notes are on this page. At some stage I plan to move these to there own repository.

## My notes

Here I will put examples of using this package as it may be helpful for future projects.

branch_name: refs/heads/main

gha_license_id: MIT


text:
---
layout: post
title: Interview Questions - What happens when you go to google.com in your browser? (Part I)
date:   2014-12-31
author: "Daniel Tsui"
tags:
- interviews
- common questiosn
---

This was written in an extreme blogging session.

At a high level: The client sends a request to a server (for an image, some text, etc), and gets a response. More commonly, the client might be a browser, like Chrome, and the server might be hosting a website, like google.com.

An example: You type google.com into your url bar, press enter, and Chrome sends a HTTP GET request to ‘http://www.google.com’. Google sends back an HTTP response, with some HTML and a HTTP status code of 200.

Notice that when you type ‘google.com’ and press enter, the text in the location bar changes to ‘https://www.google.com’.
This is a Uniform Resource Locator, or URL. Chrome needs this to send a request to the right location.
URL’s have a number of components, which I won’t get into detail regarding. The relevant ones for this URL are:

URI Scheme: http
Subdomain: www
and
Host: google.com

I mentioned earlier that Chrome was sending a GET request.

GET requests are used to request information (“i want something”)

Here are a few other commonly used methods:

POST, used to perform an action
PUT, used place a resource, or update one
DELETE, delete a resources

Note that POST and PUT might seem similar, especially when thinking of database operations.

I found this Stackoverflow post of value.
http://stackoverflow.com/questions/630453/put-vs-post-in-rest

Another concept is idempotence: PUT and DELETE requests are idempotent because repeated identical requests of those types won’t create further changes of state, past the first request.

Look out for future parts:

http status codes
public and secret key encryption
domain name resolution, resolvers, and dns servers
routing
and more


text:
# es6talk

Code examples from Patrick Hund's talk about ECMAScript 6, held at the eBay Classifieds Group TechCon in Montreal,
Canada in June 2015.

* You can find the talk notes to accompany these examples on [Workflowy](https://workflowy.com/s/bYXDNfjTGt)
* Slides are available on [SlideShare](http://de.slideshare.net/wiekatz/techcon-2015patrickhundes6)

## Installation

The ES6 code examples can be transpiled to JavaSript 5.1 code to run in today's browsers.

We use [Babel](https://babeljs.io/) for this, which is integrated in a [webpack](http://webpack.github.io/) build system.

You need to have Node.js and npm installed.

To install all required npm packages and transpile the ES6 to "old school" JavaScript:

    npm install

You can then open up one of the example HTML files in your browser:

* [Example 1 — Modules and Classes](01_modules_classes/index.html)
* [Example 2 — Arrow Functions and Spread Operators](02_arrow_spread/index.html)
* [Example 3 — Promises](03_promises/index.html)

If you want to fiddle around with the ES6 code in the examples, you can run a webpack dev server that automatically
updates the page with this command:

    npm start

You can then go to [localhost:8080](http://localhost:8080/) in your browser and navigate to one of the examples, or
call them directly with one of these links:

* [Example 1 — Modules and Classes](http://localhost:8080/01_modules_classes/)
* [Example 2 — Arrow Functions and Spread Operators](http://localhost:8080/02_arrow_spread/)
* [Example 3 — Promises](http://localhost:8080/03_promises/)

## Branches

The master of this Git repo contains just the basic skeleton with the webpack and Babel setup and HTML pages, but no
JavaScript code.

The code examples are on various branches which you can check out to see the refactoring steps from "old school" JavaScript
to ES6, which I presented at my talk:

* [before](https://github.com/pahund/es6talk/tree/before) — the JavaScript before refactoring
* [step1](https://github.com/pahund/es6talk/tree/step1) — refactoring step 1
* [step2](https://github.com/pahund/es6talk/tree/step2) — refactoring step 2
* [step3](https://github.com/pahund/es6talk/tree/step3) — refactoring step 3
* [step4](https://github.com/pahund/es6talk/tree/step4) — refactoring step 4
* [step5](https://github.com/pahund/es6talk/tree/step5) — refactoring step 5
* [after](https://github.com/pahund/es6talk/tree/after) — the final result

## Tools Used in the Code Examples

* [webpack](http://webpack.github.io/) module bundler — Copyright (C) 2012-2015 Tobias Koppers;
  [MIT License](https://github.com/webpack/webpack/blob/master/LICENSE)
* [Babel](https://babeljs.io/) JavaScript compiler — Copyright (C) 2014-2015 Sebastian McKenzie;
  [MIT License](https://github.com/babel/babel/blob/master/LICENSE)
* [npm](https://www.npmjs.com/) package manager — Copyright (c) npm, Inc. and Contributors. All rights reserved;
  [The Artistic License 2.0](https://www.npmjs.com/policies/npm-license)
* [jQuery](http://jquery.com/) JavaScript library — Copyright jQuery Foundation and other contributors;
  [MIT License](https://github.com/jquery/jquery/blob/master/LICENSE.txt)
* [Bootstrap](http://getbootstrap.com/) HTML/CSS/JS framework — Copyright (c) 2011-2015 Twitter, Inc;
  [MIT License](https://github.com/twbs/bootstrap/blob/master/LICENSE)

## Recommended Reading

Here's a short list of great resources for those who are interested in learning about ECMAScript 6:

* Nicholas C. Zachas: [Understanding ECMAScript 6](https://leanpub.com/understandinges6/)
* [Learn ES6](https://babeljs.io/docs/learn-es6/) on Babel.io
* Axel Rauschmayer's [JavaScript blog](http://www.2ality.com/)

Also, don't forget to [check out our eBay Technology Blog](http://technology.ebay.de/),
and follow me on Twitter: [@wiekatz](https://twitter.com/wiekatz/)

## License

The MIT License (MIT)

Copyright (c) 2015 mobile.de GmbH

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

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

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


text:
# instiki2git

A tool for exporting an Instiki installation to a git repository.

## Installation

Run the following in the source directory:
```shell
$ pip install .
```

## Configuration

Via command-line options.

## Usage

See:
```shell
$ instiki2git --help
```

## Details

### Revision ordering

Commits are ordered by database update time (as encoded by the field `updated_at` in the revisions table), with ties decided by revision id.
This is the only ordering that makes sense for a tool that runs repeatedly and whose overall output should not depend on when exactly it is run.
In contrast, revisions in instiki are ordered by the field `revised_at` (revision time).
For this reason, we record the revision time in each revision commit as the author time.

This has several consequences:

* We may miss updates of the same revision if are sent to the database within the same second.
  This can happen if two people save a page update using the previous author name at similar times.
  It can also happen if someone edits a page in quick succession.

* Revisions may be committed in a different order in the source backup repository than shown on the history page of Instiki.
  In particular, the pre-2015 revisions in the nLab database all have similar `updated_at` fields that are unrelated to the actual revision time.

### Metadata encoding

We store revision metadata in the git commit information.
Depending on where we store something, we use a percent encoding for reserved characters.

* The author name of a git commit has reserved characters `\0`, `\n`, `<`, `>`.
  We use it to store revision author names.

* Commit messages are lines of the form "<key>: <value>" with `\0` and `\n` reserved in key and value and additionally `:` reserved in the key.

### Compacting the backup repository

The script takes care of compacting the backup repository via `git gc --auto`.
Given many similar revisions, this can reduce storage by an order of magnitude.

### Page names may not be accurate

The page name recorded in a revision commit may not reflect the page name at the time the revision was made.
This is due to the design of Instiki.

See [this issue](https://github.com/ncatlab/instiki2git/issues/5).

## Tutorial

Create and move to an empty directory.
Initialize a git repository and make an initial commit:

```shell
$ git init
$ git commit --allow-empty -m 'Initial commit.'
```
Set up a default push remote for the default branch.
Run instiki2git in this directory:
``` shell
$ instiki2git -v --unix-socket [...] --web-id 1 --push --partition-sizes 1 1 1 1
```
This will record the Instiki revisions of the given web in the repository.

To update, just rerun the same instiki2git command.

There is an option `--html` for HTML instead of source backup.
Currently, you have to use different repositories for the two.

## Acknowledgment

This script was coded by Adeel and [Sajeel](https://sajeelk.github.io/) Khan.
It was improved by Felix Wellen.
It was rewritten by Christian Sattler.

gha_language: Python


text:
# Creating a Custom Repository

You should always strive to maintain the _Domain-Driven Design (DDD)_ and _Separation of Concerns_ by creating a custom repository in the **.EntityFrameworkCore** which you can then inject into the application or domain layers.

1. Create a repository interface in **.Core**
2. Create the repository implementation in **.EntityFrameworkCore** in Repositories
    1. Inherit from ```EfCoreRepositoryBase``` and your interface
    2. Inject ```IDbContextProvider``` and ```IActiveTransactionProvider``` into the constructor
    3. Create private fields to reference the injected objects
3. Add the custom functions for your repository
4. Use the custom repository in your domain service

Each step is explained in more detail below.

## Creating a Repository Interface

Create an interface in the **.Core** project which inherits from `IRepository`. The reason this is created in the **.Core** project is so it can accessed by the rest of the solution
```csharp
using Abp.Domain.Repositories;

namespace ExampleProject
{
  public interface IEntityRepository : IRepository<Entity>
  {
    Entity DoSomething();
  }
}
```

## Creating the Repository Implementation
In your **.EntityFrameworkCore** project create a public class that implements your new repository interface.

```csharp
public class EntityRepository
{

}
```

Inherit from `EfCoreRepositoryBase`

Below is the full listing:

```csharp
using System.Data.Common;
using Abp.Data;
using Abp.EntityFrameworkCore;
using Abp.EntityFrameworkCore.Repositories;
using Microsoft.EntityFrameworkCore;
using SeeSayDo.Content;

namespace ExampleProject.EntityFrameworkCore.Repositories
{
    public class EntityRepository : EfCoreRepositoryBase<ExampleProjectDbContext, Entity>, IEntityRepository
    {
        private readonly IDbContextProvider<ExampleProjectDbContext> contextProvider;
        private readonly IActiveTransactionProvider transactionProvider;

        public ContentPieceRepository(
            IDbContextProvider<SeeSayDoDbContext> dbContextProvider,
            IActiveTransactionProvider transactionProvider
            ) : base(dbContextProvider)
        {
            this.contextProvider = dbContextProvider;
            this.transactionProvider = transactionProvider;
        }
    }
}
```

## Adding functions to the custom repository

We still need to implement the function we defined in our interface that will call the stored procedure.

```csharp
public Entity DoSomething()
{
    var entity = new Entity();

    using (var context = contextProvider.GetDbContext())
    {
        var connection = context.Database.GetDbConnection();

        var command = connection.CreateCommand();
        command.CommandText = "sp_DoSomething";
        command.CommandType = System.Data.CommandType.StoredProcedure;
        command.Transaction = (DbTransaction)transactionProvider.GetActiveTransaction(new ActiveTransactionProviderArgs
            {
                {"ContextType", typeof(ExampleProjectDbContext) },
                {"MultiTenancySide", MultiTenancySide }
            });

        context.Database.OpenConnection();

        using (var reader = command.ExecuteReader())
        {
            entity.Id = (int)reader["Id"];
            ...
        }
    }

    return entity;
}
```

## Using the Custom Repository

To use your custom repository, inject the interface into your application or domain service via the constructor and call your custom function. Because you inherited IRepository, all the other repository features are also available so you don't need to inject a generic repository as well as your custom one.

```csharp
using System;
using Abp.Domain.Repositories;
using Abp.Domain.Services;

namespace ExampleProject.Entities
{
    public class EntityManager : DomainService
    {
        private readonly IEntityRepository customRepository;

        public EntityManager(
            IContentPieceRepository customRepository
            )
        {
            this.customRepository = customRepository;
        }

        public Entity DoSomething()
        {
            return contentRepository.DoSomething();
        }
    }
}
```

## Adding the Stored Procedure During Seeding
In the migration you can use `SQL()` to add a script.

## See Also
* [ASP\.NET Boilerplate Tutorials](README.md)
* [Adding Email Verification using SendGrid](emailverification.md)
* How to Update the Database

repository: zizizak/aspnetboilerplate-core-ng

repo_name: zizizak/aspnetboilerplate-core-ng


text:
### Project Overview

 Problem Statement

You have been hired by the University of Data Science to manage their students' records. Your job is to create the student management system for the university. Let's try to build the system using basic Python operations.

### Learnings from the project

 Why solve this project?

After completing this project, you will get to know how to solve basic Python problems. In this project, you will be applying the following concepts:

    Mathematical operations
    List operations
    Dictionary operations
    String indexing and formatting.

### Approach taken to solve the problem

 Prepare the student roster

Let's create a new register by combining data from two classes while making some modifications to the register.

### Challenges faced

 Kudos to the Math genius!

For the student who has got the highest marks in this subject, the school has decided to award a Scholarship. Let's check who performed best in mathematics from all the students who appeared for the test.

### Additional pointers

 Scholarship certificate

From the previous task, we know who is the 'Maths' topper in the class. You now have to print the name of the student on the certificate, but you will have to print his last name and then his first name.

repository: pseudoGal/ga-learner-dsmp-repo

gha_language: Jupyter Notebook

repo_name: pseudoGal/ga-learner-dsmp-repo


text:
You are given an **array of binary integers**and `k`, the **number of flips**allowed.

Write a function that returns the indices of zeroes of which, when flipped, return the **longest contiguous sequence of ones**.

### Examples ###
    zeroIndices([1, 0, 1, 1, 0, 0, 0, 1], 1) ➞ [1]

    zeroIndices([1, 0, 0, 0, 0, 1], 1) ➞ [1]

    zeroIndices([1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0], 3) ➞ [6, 7, 9]

    zeroIndices([1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0], 3) ➞ [7, 8, 9]

### Notes ###
If multiple combinations of indices tie for longest one sequence, return the indices which occur **first**(see examples #2, #3).


text:
# zipporah

The method of this toolkit is decribed in the paper "Zipporah: a Fast and Scalable Data Cleaning System
for Noisy Web-Crawled Parallel Corpora."

If you have question, feel free to email me at hainan.xv AT gmail Dot com. I left my JHU email in the paper however it seems to classify some of the query emails as spam.

### Step 1,
```
$> git clone https://github.com/hainan-xv/zipporah.git
$> cd zipporah
$> git checkout paper-version
$> ./make.sh
```

### Step 2,
Change the config file; an example is `configs/test`. First you need to change the following variables,
```
working=/your/working/directory/
ROOT=/your/path/to/zipporah/
moses=your/path/to/mosesdecoder/
srilm=your/path/to/srilm/   # for branch paper-version only
```

### Step 3,
Provide the location for your corpus. We need good/dev/bad-corpus variables set. The meaning of those corpora are,
- "bad" corpus refers to the data you want to filter on;
- "good" corpus refers to the "training data" described in the paper. We recommend that you use a large and clean corpus for this, e.g. Europarl
- "dev" corpus refers to the "dev data" in the paper. We recommend that you use a clean corpus for this, and a size of 2000-3000 parallel sentence pairs is sufficient.

Have either

```
raw_stem_bad=your/raw//data/that/you/want/to/clean
raw_stem_good=your/raw/train/data
raw_stem_dev=your/raw/dev/data
```
or
```
clean_stem_bad=your/tokenized/and/truecased/data/that/you/want/to/clean
clean_stem_good=your/tokenized/and/truecased/train/data
clean_stem_dev=your/tokenized/and/truecased/dev/data
```

The `*stem_good/*stem_bad` variables should be a prefix of text files. For example, if `clean_stem_dev` is `/home/user/newstest` and `input/output-lang` are `es/en`, then the system would look for file `/home/user/newstest.es` and `/home/user/newstest.en` and use them as the "dev data".

The word "clean" or "raw" would indicate whether the corpus is tokenized and truecased. If it's raw, then Zipporah would try to tokenize and truecase them; if "clean" is provided then Zipporah would start processing them directly.

### Step 4,
```
$> ./run.sh [config-file]
```

would run the data selection and generate a score file in
`$working/$experiment_id/step-4/bad/corpus.xz`

(experiment_id will be an integer starting from 0; if a directory n is already
there, then experiment_id will become n+1)

`./run.sh` supports more arguments
- `./run.sh config-file experiment-id` would force to use the experiment-id argument
- `./run.sh config-file experiment-id` stage would start at a specific stage

There are 4 stages in the system, see `scripts/[1234].sh`
- 1.sh processes good data and dev data
- 2.sh processes bad data
- 3.sh computes the features on all data
- 4.sh trains the logistic regression model and computes scores

Common issues:

1. The system assumes you have GridEngine installed and you are running the system on a grid. If not, you might get errors complaining about qsub not being installed. If that happens, you can change the "queue.pl" file to this file instead (`https://github.com/kaldi-asr/kaldi/blob/master/egs/wsj/s5/utils/parallel/run.pl`, just copy the content of this file and override the old queue.pl file and no other changes are needed. Thanks Kaldi developers for writing this wrapper), and then the system would run locally. If you need to make this change, you may also want to change all the number of jobs config to 1 to avoid overloading your machine.
2. You would need to pre-install Moses (`https://github.com/moses-smt/mosesdecoder`). We use a number of commands in Moses and you might need to change the paths if the system complains about */mosesdecoder/* commands, e.g. fast_align and kenlm.
3. Right now there seems to be a bug regarding providing trained truecasers. I prepared a fix at branch "fix-truecaser-bug" which I think should fix the issue but this has not been extensively tested. If you want to use your custom truecaser you can use that branch. I will try to merge it when it's fully tested. If you want Zipporah to train the truecaser automatically, you can use branch "paper-version", which is bug-free and is the version we used in the paper. The newer version, however, seems to perform slightly better than the paper-version.

repository: thanhleha-kit/zipporah

repo_name: thanhleha-kit/zipporah


text:
# Unreleased
[full changelog](http://github.com/sue445/dockerhub-slack-webhook/compare/1.0.1...main)

# 1.0.1
[full changelog](http://github.com/sue445/dockerhub-slack-webhook/compare/1.0.0...1.0.1)

* Upgrade to Ruby 3.2 :gem:
  * https://github.com/sue445/dockerhub-slack-webhook/pull/599
* [CVE-2023-36617] Upgrade to uri 0.12.2
  * https://github.com/sue445/dockerhub-slack-webhook/pull/628
* Upgrade dependencies

# 1.0.0
* Publish Docker image to GitHub Container Registry and GCP Artifact Registry
* Drop Heroku
  * https://github.com/sue445/dockerhub-slack-webhook/issues/574
* Add Sentry support
  * https://github.com/sue445/dockerhub-slack-webhook/pull/581
* Change default PUMA_PORT
  * https://github.com/sue445/dockerhub-slack-webhook/pull/577

gha_language: Ruby


text:
# 8.11. Sensitive storages

- [Create sensitive storage](#create-sensitive-storage)
- [Mounting sensitive storages](#mounting-sensitive-storages)
- [Main restrictions in sensitive runs](#main-restrictions-in-sensitive-runs)

By default, Cloud Pipeline platform allows performing upload/download operations for any authorized data storage.
But certain storages may contain sensitive data, which shall not be copied anywhere outside that storage.

For storing such data, special "sensitive" storages are suitable.
Sensitive data from that storages can be used for calculations or different other jobs, but this data cannot be copy/download to another regular storage/local machine/via the Internet etc. Viewing of the sensitive data is also restricted.

> **_Note_**: at the moment, only the Object storages could be used as "sensitive".

## Create sensitive storage

To create sensitive object storage:

1. Start create a new object storage:
    ![CP_ManageSensitiveStorages](attachments/SensitiveStorages_01.png)
2. In the appeared popup, specify desired storage path and set the "**Sensitive storage**" checkbox:
    ![CP_ManageSensitiveStorages](attachments/SensitiveStorages_02.png)
    Click the **Create** button to confirm
3. The new sensitive storage will appear:
    ![CP_ManageSensitiveStorages](attachments/SensitiveStorages_03.png)
> **_Note_**: to distinguish sensitive storages from regular ones in the library, the sensitive storages are marked by red icon ![CP_ManageSensitiveStorages](attachments/SensitiveStorages_04.png).
4. Via the GUI, the sensitive storage looks similar to the regular object storage, but there are some differences (even for admin/storage **_OWNER_**):
    ![CP_ManageSensitiveStorages](attachments/SensitiveStorages_05.png)
    - Download buttons for the storage files are hidden
    - **Share** / **Generate URL** button for the selected storage files is hidden
    - Preview of any files aren't available
    - Editing of any files isn't available

So via the GUI, files/folders in the sensitive storage can be created/renamed/removed (by **_OWNER_**/admin) but can't be downloaded/viewed or edited by any user.

## Mounting sensitive storages

User can configure the list of the storages that will be mounted to the container during the run initialization. This can be accomplished using the [**Limit mount** field](../06_Manage_Pipeline/6.1._Create_and_configure_pipeline.md#example-limit-mounted-storages) of the **Launch** form.

By default, sensitive storages aren't available to mount - only non-sensitive storages could be mounted, e.g.:
    ![CP_ManageSensitiveStorages](attachments/SensitiveStorages_06.png)

To change this restriction for a specific tool, admin or image owner shall:

1. Open the **Tool** page
2. At the **Tool settings** page, set the "**Allow sensitive storages**" checkbox:
    ![CP_ManageSensitiveStorages](attachments/SensitiveStorages_07.png)
3. If this checkbox is set for a tool, sensitive storages also can be selected for the mounting for a job running - in the storages list, they are marked by the special label ![CP_ManageSensitiveStorages](attachments/SensitiveStorages_09.png), e.g.:
    ![CP_ManageSensitiveStorages](attachments/SensitiveStorages_08.png)

If at least one sensitive storage is selected for the mounting before a job launching - such job becomes "_sensitive run_".
For sensitive runs, there are some restrictions - see the section [below](#main-restrictions-in-sensitive-runs).

> **_Note_**: by default, even if sensitive storages are allowed for a tool, only the all non-sensitive storages will be mounted to a job. Sensitive storages will be mounted to a job only if they were enforced in the "**Limit mounts**" field.

Before the launching a sensitive run, the additional warning is shown:
    ![CP_ManageSensitiveStorages](attachments/SensitiveStorages_10.png)

For the launched run, the fact that it relates to "sensitive runs" is shown by additional labels:

- at the **Runs** page:
    ![CP_ManageSensitiveStorages](attachments/SensitiveStorages_11.png)
- at the **Run logs** page:
    ![CP_ManageSensitiveStorages](attachments/SensitiveStorages_12.png)

## Main restrictions in sensitive runs

For _sensitive_ runs (runs with at least one mounted sensitive storage) all selected storages for the mounting (not only sensitive) are being mounted in **readonly** mode to exclude any copy/move operations between storages.

Files from the sensitive storages can be viewed **_inside_** the sensitive run and also copied into the inner instance disk, but not to any other storage.

Files from the sensitive storages can't be viewed **_outside_** the sensitive run or copied/moved anywhere (for example, when using not the web-terminal version of [`pipe`](../14_CLI/14._Command-line_interface.md) SSH).

There are following additional restrictions while using sensitive storages:

- [**FSBrowser**](../15_Interactive_services/15.3._Expose_node_filesystem.md):
    - **FSBrowser** isn't being installed for the sensitive runs
    - **FSBrowser** button isn't being displayed in the GUI for such jobs
    ![CP_ManageSensitiveStorages](attachments/SensitiveStorages_13.png)
- [**SSH-session**](../15_Interactive_services/15.2._Using_Terminal_access.md) _inside_ the sensitive run:
    - additional warning about restrictions is shown
    - `pipe storage ls` operation is available to list any mounted storage
    - `pipe storage cp` operation is available to download data only to the run's filesystem, even from the sensitive storage
    - `pipe storage mv/rm` operations aren't available for any mounted storage
    ![CP_ManageSensitiveStorages](attachments/SensitiveStorages_14.png)
    - `pipe storage mount -b` operation allows to mount any object storage including sensitive, but in a **readonly** mode
- [**SSH-session**](../14_CLI/14.1._Install_and_setup_CLI.md) _outside_ the sensitive run:
    - `pipe storage ls` operation is available to list any mounted storage
    - `pipe storage cp/mv/rm` operations aren't available if the source or destination is a sensitive storage
    ![CP_ManageSensitiveStorages](attachments/SensitiveStorages_15.png)
    - `pipe storage mount -b` operation doesn't allow to mount sensitive storages
- **Interactive endpoint GUI** - data transfer capabilities are also restricted for the following tools: [`RStudio`](../15_Interactive_services/15.1._Starting_an_Interactive_application.md), [`Jupyter (notebook/lab)`](../15_Interactive_services/15._Interactive_services.md#supported-services).
    The behavior with the interactive endpoints GUI is similar to SSH-session _inside_ the sensitive run - user can list/view files from any mounted storage and copy them into the inner run's filesystem, but move/remove operations for any mounted storage are forbidden.

repository: epam/cloud-pipeline

branch_name: refs/heads/develop

gha_language: Java

repo_name: epam/cloud-pipeline


text:
# Tinder Scarlet Lifecycle Android

This repository is an edited library from Scarlet's official repository while waiting for my [Pull request](https://github.com/Tinder/Scarlet/pull/71) to be approved.

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Platform](https://img.shields.io/badge/platform-android-green.svg)](http://developer.android.com/index.html)
[![](https://jitpack.io/v/hantrungkien/tinder-scarlet-lifecycle-android.svg)](https://jitpack.io/#hantrungkien/tinder-scarlet-lifecycle-android)

### Usage

```
val protocol = OkHttpWebSocket(
    okHttpClient,
    OkHttpWebSocket.SimpleRequestFactory(
        { Request.Builder().url("wss://ws-feed.gdax.com").build() },
        { ShutdownReason.GRACEFUL }
    )
)

/**
 * @param: application to detect connectivity change
 * @param: lifecycleOwner from Activity or Fragment to detect lifecycle
 */
val configuration = Scarlet.Configuration(
    lifecycle = AndroidLifecycle.ofLifecycleOwnerForeground(application, lifecycleOwner),
    messageAdapterFactories = listOf(MoshiMessageAdapter.Factory(moshi)),
    streamAdapterFactories = listOf(RxJava2StreamAdapterFactory())
)
val scarletInstance = Scarlet(protocol, configuration)
val gdaxService = scarletInstance.create<GdaxService>()
```

### Install:

**via JitPack (to get current code)**

project/build.gradle
````gradle
allprojects {
    repositories {
        maven { url "https://jitpack.io" }
    }
}
````
module/build.gradle
````gradle
implementation 'com.github.hantrungkien:tinder-scarlet-lifecycle-android:1.0.0'
````

### Copyright

~~~
Copyright (c) 2018, Match Group, LLC
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.
    * Neither the name of Match Group, LLC nor the names of its contributors
      may be used to endorse or promote products derived from this software
      without specific prior written permission.


text:
# omnibus_updater_windows-cookbook

This cookbook is intended to be a complement to the omnibus_updater cookbook and provide support for upgrading chef-client on Windows systems.

## Supported Platforms

TODO: List your supported platforms.

## Attributes

    Key
    Type
    Description
    Default

    <tt>['omnibus_updater_windows']['bacon']</tt>
    Boolean
    whether to include bacon
    <tt>true</tt>

## Usage

### omnibus_updater_windows::default

Include `omnibus_updater_windows` in your node's `run_list`:

```json
{
  "run_list": [
    "recipe[omnibus_updater_windows::default]"
  ]
}
```

## Contributing

1. Fork the repository on Github
2. Create a named feature branch (i.e. `add-new-recipe`)
3. Write your change
4. Write tests for your change (if applicable)
5. Run the tests, ensuring they all pass
6. Submit a Pull Request

## License and Authors

Author:: Biola University<EMAIL_ADDRESS>

repository: trinitronx/chef-cookbooks

repo_name: trinitronx/chef-cookbooks


text:
Exploring the "Big mtcars" dataset

This application allows you to build your own dataviz for #TidyTuesday, 2019-10-15.

Tidy Tuesday is a weekly social data project in R. Find more about this project on rfordatasci.com and on the GitHub repo.

This week dataset is a larger version of the well-known mtcars dataset. With this application, you'll be able to build your own {ggplot2} graph out of this dataset.

On each plot, once it's rendered, you'll be able to see the code used by clicking on the image. You can use it as a starting point for more customisation.

For a deeper understanding of the dataset, feel free to unfold the data dictionnary on the bottom of this page.

You can also jump to:

geom_point generator

 geom_hist generator

 geom_boxplot generator

 geom_bar generator

Click to display variable dictionnary.

 atvtype - type of alternative fuel or advanced technology vehicle

 barrels08 - annual petroleum consumption in barrels for fuelType1 (1)

 barrelsA08 - annual petroleum consumption in barrels for fuelType2 (1)

 charge120 - time to charge an electric vehicle in hours at 120 V

 charge240 - time to charge an electric vehicle in hours at 240 V

 city08 - city MPG for fuelType1 (2), (11)

 city08U - unrounded city MPG for fuelType1 (2), (3)

 cityA08 - city MPG for fuelType2 (2)

 cityA08U - unrounded city MPG for fuelType2 (2), (3)

 cityCD - city gasoline consumption (gallons/100 miles) in charge depleting mode (4)

 cityE - city electricity consumption in kw-hrs/100 miles

 cityUF - EPA city utility factor (share of electricity) for PHEV

 co2 - tailpipe CO2 in grams/mile for fuelType1 (5)

 co2A - tailpipe CO2 in grams/mile for fuelType2 (5)

 co2TailpipeAGpm - tailpipe CO2 in grams/mile for fuelType2 (5)

 co2TailpipeGpm- tailpipe CO2 in grams/mile for fuelType1 (5)

 comb08 - combined MPG for fuelType1 (2), (11)

 comb08U - unrounded combined MPG for fuelType1 (2), (3)

 combA08 - combined MPG for fuelType2 (2)

 combA08U - unrounded combined MPG for fuelType2 (2), (3)

 combE - combined electricity consumption in kw-hrs/100 miles

 combinedCD - combined gasoline consumption (gallons/100 miles) in charge depleting mode (4)

 combinedUF - EPA combined utility factor (share of electricity) for PHEV

 cylinders - engine cylinders

 displ - engine displacement in liters

 drive - drive axle type

 emissionsList

 engId - EPA model type index

 eng_dscr - engine descriptor; see http://www.fueleconomy.gov/feg/findacarhelp.shtml#engine

 evMotor - electric motor (kw-hrs)

 feScore - EPA Fuel Economy Score (-1 = Not available)

 fuelCost08 - annual fuel cost for fuelType1 ($) (7)

 fuelCostA08 - annual fuel cost for fuelType2 ($) (7)

 fuelType - fuel type with fuelType1 and fuelType2 (if applicable)

 fuelType1 - fuel type 1. For single fuel vehicles, this will be the only fuel. For dual fuel vehicles, this will be + the conventional fuel.

 fuelType2 - fuel type 2. For dual fuel vehicles, this will be the alternative fuel (e.g. E85, Electricity, CNG, + LPG). For single fuel vehicles, this field is not used

 ghgScore - EPA GHG score (-1 = Not available)

 ghgScoreA - EPA GHG score for dual fuel vehicle running on the alternative fuel (-1 = Not available)

 guzzler- if G or T, this vehicle is subject to the gas guzzler tax

 highway08 - highway MPG for fuelType1 (2), (11)

 highway08U - unrounded highway MPG for fuelType1 (2), (3)

 highwayA08 - highway MPG for fuelType2 (2)

 highwayA08U - unrounded highway MPG for fuelType2 (2),(3)

 highwayCD - highway gasoline consumption (gallons/100miles) in charge depleting mode (4)

 highwayE - highway electricity consumption in kw-hrs/100 miles

 highwayUF - EPA highway utility factor (share of electricity) for PHEV

 hlv - hatchback luggage volume (cubic feet) (8)

 hpv - hatchback passenger volume (cubic feet) (8)

 id - vehicle record id

 lv2 - 2 door luggage volume (cubic feet) (8)

 lv4 - 4 door luggage volume (cubic feet) (8)

 make - manufacturer (division)

 mfrCode - 3-character manufacturer code

 model - model name (carline)

 mpgData - has My MPG data; see yourMpgVehicle and yourMpgDriverVehicle

 phevBlended - if true, this vehicle operates on a blend of gasoline and electricity in charge depleting mode

 pv2 - 2-door passenger volume (cubic feet) (8)

 pv4 - 4-door passenger volume (cubic feet) (8)

 rangeA - EPA range for fuelType2

 rangeCityA - EPA city range for fuelType2

 rangeHwyA - EPA highway range for fuelType2

 trans_dscr - transmission descriptor; see http://www.fueleconomy.gov/feg/findacarhelp.shtml#trany

 trany - transmission

 UCity - unadjusted city MPG for fuelType1; see the description of the EPA test procedures

 UCityA - unadjusted city MPG for fuelType2; see the description of the EPA test procedures

 UHighway - unadjusted highway MPG for fuelType1; see the description of the EPA test procedures

 UHighwayA - unadjusted highway MPG for fuelType2; see the description of the EPA test procedures

 VClass - EPA vehicle size class

 year - model year

 youSaveSpend - you save/spend over 5 years compared to an average car ($). Savings are positive; a greater amount + spent yields a negative number. For dual fuel vehicles, this is the cost savings for gasoline

 sCharger - if S, this vehicle is supercharged

 tCharger - if T, this vehicle is turbocharged

 c240Dscr - electric vehicle charger description

 charge240b - time to charge an electric vehicle in hours at 240 V using the alternate charger

 c240bDscr - electric vehicle alternate charger description

 createdOn - date the vehicle record was created (ISO 8601 format)

 modifiedOn - date the vehicle record was last modified (ISO 8601 format)

 startStop - vehicle has start-stop technology (Y, N, or blank for older vehicles)

 phevCity - EPA composite gasoline-electricity city MPGe for plug-in hybrid vehicles

 phevHwy - EPA composite gasoline-electricity highway MPGe for plug-in hybrid vehicles

 phevComb - EPA composite gasoline-electricity combined city-highway MPGe for plug-in hybrid vehicles

gha_license_id: NOASSERTION


text:
#Developer Guide

##Source code structure

The package contains the following structures:
- docs Generate html docs through doxygen
- examples Examples using the library
- include The library source code
- tests Unit tests, test library implementation

When adding a new target platform, need to add <platform>.h to include/ and may need to modify makefiles so that the new platform can be tested and will run with existing examples.

##Run unit tests

Unit tests are in tests directory. The current unit test covers power_vsx4.h, generic4.h, generic8,h and sse4.h

Please download googletest framework first from https://code.google.com/p/googletest/, and unzip it into "tests/gtest-1.6.0" dirctory.
Or you can unzip it to where you want, and modify the "GTEST_DIR" value in tests/Makefile.

Then you can run the test
```bash
$ cd tests
$ make clean
$ make {vsx4|sse4|generic4|generic8}     # build/run unit tests for target SIMD ISA
```
The test app will test vsx4, generic4 and sse4 interfaces, and generate the report.

##Generate the documentation

We use doxygen to generate documentations. The input files for doxygen is under <gsimd_path>/docs/. To update the documentation, either modigy the *.txt files or doxygen annotations in the library source codes.

To publish new documentations, you need to go through the following steps:

1. Make sure you have doxygen installed

2. Checkout the gh-pages branch of your project to docs/gh-pages.github
```bash
$ add docs/gh-pages.github to .gitignore
$ cd docs
# create a branch gh-pages from the github web interface
# clone the project repo to docs/gh-pages.github
$ git clone -b gh-pages https://github.com/genericsimd/generic_simd.git gh-pages.github
$ cd gh-pages.github
# remove all trunk files from gh-pages branch
```

3. Generate new doxygen pages and copy into gh-pages.github
```bash
$ cd docs
$ make         # generate documentation into docs/html
$ make gitpub  # copy docs/html into docs/gh-pages.github
$ cd gh-pages.github
$ git add -A   # add everything under the directory
$ git commit -a # checkin new documentation to github
$ git push     # push to github
```
  Note: it may take 10 minutes before the new pages appear on http://genericsimd.github.io/generic_simd


text:
# React App

### Run the React application on its own with the command:
```
npm install
npm start
```

The React application will run on port 8080

repository: nathmsi/exam-react

repo_name: nathmsi/exam-react


text:
# Crystallized ![GitHub](https://img.shields.io/github/license/Hammer86gn/Crystallized) ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/Hammer86gn/Crystallized/CMake)

### About

Crystallized is an up and coming open source game engine licensed under Apache 2.0 which will currently only support OpenGL but many more in the future

### How to contribute
To contribute to Crystallized just fork this repository make your changes then submit a Pull Request

There are currently no rules in place for contributing except to make your contribution substantial, and that bigger Pull Requests link to an issue if possible.

repository: LocalGoddess/Crystallized

repo_name: LocalGoddess/Crystallized


text:
# piStat
Raspberry pi Thermostat

makes use of
https://github.com/jaques/sht21_python/blob/master/sht31.py
SHT31 library for the SHT31 i2C humidity and temperature sensor, choosen for accuracy

https://github.com/WiringPi/WiringPi-Python
Wiring pi is used to actuate the relay for the thermostat.

https://github.com/adafruit/Adafruit_Python_CharLCD
Controls the LCD

repository: aphotix/piStat

repo_name: aphotix/piStat


text:
# XOR

XOR code engine in pure Go

more than 10GB/S per core

## Introduction:

1. Use SIMD (SSE2 or AVX2) for speeding up
2. ...

## Installation
To get the package use the standard:
```bash
go get github.com/templexxx/xor
```

## Documentation

See the associated [GoDoc](http://godoc.org/github.com/templexxx/xor)

## Performance

Performance depends mainly on:

1. SIMD extension
2. unit size of worker
3. hardware ( CPU RAM etc)

Example of performance on my MacBook 2014-mid(i5-4278U 2.6GHz 2 physical cores). The 16MB per shards.
```
speed = ( shards * size ) / cost
```
| data_shards    | shard_size |speed (MB/S) |
|----------|----|-----|
| 2       |1KB|64127.95  |
|2|1400B|59657.55|
|2|16KB|35370.84|
| 2       | 16MB|12128.95 |
| 5       |1KB| 78837.33 |
|5|1400B|58054.89|
|5|16KB|50161.19|
|5| 16MB|12750.41|

repository: glycerine/goq

gha_language: Go

repo_name: glycerine/goq