text:
---
layout: post
title: "How Multimon helps me to be more productive"
date: 2014-06-04 12:02:54 +0200
comments: true
published: true
categories: [productivity]
---
{% img left /images/posts/multimon.jpg 150 %}
I have an external monitor connected to my Macbook when I'm at work. However,
managing that is a real pain, as I was dragging windows around the monitors
everytime I connected to it. Luckily, there's an application which takes the
pain away: [Multimon](http://multimonapp.com/).

<!-- more -->

Multimon has several options. The most noticeable is that it turns on a menu bar
on the external monitor. This saves a lot of mouse movements. And if you don't
like this, you can turn it off.

Additionally, Multimon has hotkeys enabled to move windows around your monitors.
This is a life saver. Quickly move windows around when you need them, and move
them out of the way when you're done with them.

But it gets even better: Multimon also remembers which monitor each window was on
and rearranges them when you connect to it. And this is the thing that boosts my
productivity the most.

repository: breyten/octopress

repo_name: breyten/octopress


text:
# Music-Player
Simple GUI Music player with controls

Supported os : Linux OS

 Simply its look like below image on your right center display

  ![PreviewImg](https://github.com/CyperSpyder/Music-Player/blob/main/Music_Player/PreviewImg.png?raw=true)

---

 Install requirement Libraries to compile and run this code

  Download and locate folder
  Download tkinter for GUI
  Open terminal than copy and paste below code in terminal

  ```
  pip install tk
  pip install -r requirements.txt
  ```
---

Change file as executable by changing their permission

  ```
  chmod +X music_player.py
  ```
  To start player
  ```
  ./music_player
  ```

Another method to run this file:

  ```
  python3 music_player.py
  ```

  Locate your music folder and enjoy music

  Customize yourself and Fork me...
  Thank you !

  ---

license: MIT

repository: surensam/Music-Player

branch_name: refs/heads/main

extension: md

license_type: permissive

repo_name: surensam/Music-Player


text:
# Recommendation-System-for-Ecommerce-websites
This recommendation system uses a dataset of productId of products bought by a particular customer and based on the dataset recommends similar product to another customer.
The principle used here is Item-Item collaborative filtering

This algorithm first finds the similarity score between two items. Based on this similarity score, it then picks out the most similar item and recommends products to the users which have liked or bought the product previously.

1. For predictions we need the similarity between the item u and v.  Here we make use of Cosine Similarity.
2. First we find the items bought by both the users and based on the productID and frequecy of each product, correlation between the Items is calculated.

3. The predictions can be calculated using the similarity values. This algorithm, first of all calculates the similarity between each item and then based on each similarity calculates the predictions. Users having higher correlation will tend to be similar.

![model working](https://s3-ap-south-1.amazonaws.com/av-blog-media/wp-content/uploads/2018/05/1skK2fqWiBF7weHU8SjuCzw-768x606.png)

branch_name: refs/heads/master


text:
BootLeaf
========

 - [Installation](#installation)
 - [Customisation](#customisation)
 - [Basemaps](#basemaps)
 - [Layers](#layers)
 - [Table of Contents](#table-of-contents)
 - [Identify](#identify)
 - [Query](#query)
 - [Custom code](#custom-code)
 - [Known issues](#issues)

### Introduction

This is an update to the excellent [Bootleaf](https://github.com/bmcbride/bootleaf) code written by [Bryan McBride](https://github.com/bmcbride), which incorporates the responsive framework [Bootstrap](http://getbootstrap.com) with the lightweight [Leaflet](http://leafletjs.com) mapping API.

This update decouples the application logic from the map contents, and so provides a framework for rapid creation of new maps by simply updating a configuration file.

![bootleaf screenshot](https://i.imgur.com/DZbDs86.png)

Support is provided for:
 - WMS tiled layers
 - WFS layers
 - GeoJSON layers
 - ArcGIS Server feature, dynamic and tiled layers
 - Clustering of WFS, GeoJSON and ArcGIS Server feature layers

Note - WMS and WFS layers have been tested in GeoServer only. [CORS](http://suite.opengeo.org/docs/latest/sysadmin/cors/index.html) and [jsonp](https://www.gaiaresources.com.au/json-with-geoserver-and-leaflet/) should be enabled on GeoServer for best results.

Additional functionality includes:
 - [Table of Contents](https://github.com/ismyrnow/Leaflet.groupedlayercontrol) with support for groups and radio buttons
 - Identify function for WMS and ArcGIS Dynamic layers
 - Query Widget, for finding features within ArcGIS Feature and Dynamic layers
 - Spatial Bookmarks
 - Address search using [OpenStreetMap](https://nominatim.openstreetmap.org/), Google or ArcGIS
 - Ability to share the map with current location and visible layers
 - Tooltips and info-windows
 - Simple labels within WFS layers

The application comprises:
 - `index.html` - defines the elements on the page, including the map, sidebar, navigation, buttons, etc. References all of the other files
 - `config.js` - configuration file, which personalises each map. Specifies the starting extent, basemap, controls, and layers
 - `style.css` - over-writes the default styles to personalise the map
 - `custom.js` - adds custom functionality to personalise the map
 - `src/...` - the directory containing the core Bootleaf functionality
 - `data` - stores any local GeoJSON datasets which are not hosted on a server

## [Installation](#installation)

Use these steps to create a map based on the current version of the Bootleaf template:

1. download the code from [here](https://github.com/iag-geo/bootleaf/archive/master.zip)
2. unzip the file into a temp directory
3. copy the _bootleaf_ directory into a suitable directory on your server
4. rename the *bootleaf* folder to the name of your app (*your_app*)
5. open your application via http://your_server/path/your_app and verify that it works correctly

**Deployment and upgrades**
- to deploy your app to another server, copy the *your_app* directory to the server. This will include both the Bootleaf code (in the _src_ directory) and your custom app as a stand-alone package
- in the future, to update your app to the latest version of the Bootleaf template, download the code again and replace the _src_ in your local version with the _src_ latest version (ensuring you don't over-write your custom config file)

## [Customisation](#customisation)

All configuration options for the map are controlled via the *config.js* file, so open this file in your code editor and go for it!

The format of this file is JSON, which uses key/value pairs holding parameters and their values, eg:

```
"title": "Bootleaf template map",
"start": {
	"center": [42, -85],
	"zoom": 5,
	"attributionControl": false,
	"zoomControl": false,
	"layers": []
}
```

When editing these values, ensure that the key *names* are quoted. *Textual values* should be quoted, but *numerical values and booleans* should not be quoted. Un-needed parameters may be commented out using /\* ... \*/ notation around the entire parameter.

#### Parameter explanations

- `title` : displayed in the header of the browser
- `start` : used to set the inital map extent, and other Leaflet [initiation parameters](http://leafletjs.com/reference-1.0.2.html#map-factory)
- `about` : displayed in the map's About panel
- `bing_key` : a license key to use [Bing Maps basemap tiles](https://msdn.microsoft.com/en-us/library/ff428642.aspx)
- `mapboxKey` : a license key to use [MapBox basemap tiles](https://www.mapbox.com/help/how-access-tokens-work/)
- `controls` : used to configure individual map controls. If a control is commented out, it will not be shown. Valid positions are *topleft*, *topright*, *bottomleft*, *bottomright*
	- `zoom` : specify the location of the zoom in/out buttons
	- `leafletGeocoder` : configure the [geocoder](https://github.com/perliedman/leaflet-control-geocoder)
		- `type`: `Google/OpenStreetMap/ArcGIS`
		- `suffix`: an optional keyword to filter each search. eg, use "Australia" to tell the geocoder to search within Australia only
	- `TOC` : configure the default [table of contents](https://github.com/ismyrnow/Leaflet.groupedlayercontrol) (see below for further configuration options)
	- `history` : display next/previous buttons on the map, to enable moving forward/back through the extent history
	- `bookmarks` : spatial bookmarks may be saved to the config file, or added via the UI. In the latter case they're accessible via cookies on the current user's machine. Follow the pattern of the sample bookmarks to create new instances
- `activeTool` : a tool may optionally be configured as active when the map loads. Current options are `identify`, `queryWidget` (see below for more info) and `coordinate` (which reports the coordinates at the location clicked on the map)
- `defaultIcon` : optionally, override the [default icon](http://leafletjs.com/reference-1.1.0.html#icon-default) which is a blue pin, for example to specify an alternate image, or to change the size and shape of the pin. This icon is used in the geocoding result display amongst other areas
- `projections` - an array of [proj4js](http://proj4js.org/) projection definitions, which are used when projecting coordinates from other reference systems onto the map. Determine each layer's projection, then look up the details at http://spatialreference.org/. Add each layer's WKID to the `projections` array in the format:

```
"projections": [
	{wkid: 'proj 4 projection parameters from spatialreference.org'},
	{4269: '+proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs '}
]
```
- `showIdentifyMarker` : `true/false` - when true, the location clicked on the map is shown in a popup. Default is true.
## [Basemaps](#basemaps)
Various basemaps may be included on the map, by listing the basemap IDs as shown below. The first basemap listed is the default.

`"basemaps" : ['esriStreets', 'MapboxLight', 'OpenStreetMap']`

[Esri basemaps](https://developers.arcgis.com/javascript/3/jsapi/esri.basemaps-amd.html):
 - `esriStreets`
 - `esriTopographic`
 - `esriImagery`
 - `esriShadedRelief`
 - `esriTerrain`
 - `esriGray`
 - `esriDarkGray`
 - `esriNationalGeographic`
 - `esriOceans`

[MapBox basemaps](https://www.mapbox.com/api-documentation/#maps)
- `MapboxStreets`
- `MapboxLight`
- `MapboxDark`
- `MapboxSatellite`
- `MapboxSatelliteStreets`
- `MapboxHighContrast`

(MapBox Basemaps require a valid `mapboxKey` parameter in the config file)

[Bing basemaps](https://developers.arcgis.com/javascript/3/jsapi/vetiledlayer-amd.html):
 - Aerial
 - AerialWithLabels
 - Road

(Bing and Mapbox basemaps require valid `bing_key` and `mapboxKey` parameters in the config file)

[Leaflet Tiled basemaps](http://leafletjs.com/reference-1.0.2.html#tilelayer):
 - `OpenStreetMap`

![basemaps screenshot](https://i.imgur.com/ja3Z9q1.png)

If no basemaps are listed in the config file, all basemaps will be available on the map.

## [Layers](#layers)

Support for various layer types is included in this Bootleaf update, including ArcGIS Server (feature, dynamic and tiled), WMS tiled and GeoJSON, with more types to be added in future.

To begin adding layers, find the `"layers": []` section of the config file, and add a new layer using the format:

```
{
	"id": "a unique ID for this layer",
	"name": "the name, which will appear in the Table of Contents",
	"type": "layer type (see 'Supported layer types' below)",
	"url": "layer URL"
}
```

### Supported layer types

- `agsFeatureLayer` : [ArcGIS Server Feature layer](https://developers.arcgis.com/javascript/3/jsapi/featurelayer-amd.html)
- `agsDynamicLayer` : [ArcGIS Server Dynamic layer](https://developers.arcgis.com/javascript/3/jsapi/arcgisdynamicmapservicelayer-amd.html)
- `agsTiledLayer` : [ArcGIS Server Tiled layer](https://developers.arcgis.com/javascript/3/jsapi/arcgistiledmapservicelayer-amd.html)
- `geoJSON` : [Leaflet GeoJSON](http://leafletjs.com/reference-1.0.2.html#geojson)
- `wmsTiledLayer` : [Leaflet WMS Tile layer](http://leafletjs.com/reference-1.0.2.html#tilelayer-wms)
- `tileLayer` : [tiled layers](http://leafletjs.com/reference-1.0.3.html#tilelayer) which follow the pattern 'http://{s}.somedomain.com/blabla/{z}/{x}/{y}{r}.png'
- `WFS` : [WFS](http://www.opengeospatial.org/standards/wfs) layers (Note: to date, testing has only been done on WFS as provided by GeoServer in GeoJSON format.)

#### Other layer options

- `visible` : `true/false`
- `opacity` : `0-1`
- `minZoom` : `1-19` - furthest zoom level the layer will be displayed on the map
- `maxZoom` : `1-19` - closest zoom level the layer will be displayed on the map
- `attribution` : `"text to appear in the attribution widget"`
- `layers` : `[1, 2, 3]` - applies to ArcGIS Dynamic layer, and specifies the visible layers
- `typeName` : applies to WFS layers, and specifies the GeoServer layer to draw
- `popup` : true/false` - applies to WFS and ArcGIS Feature layers, and determines whether to show a popup when clicking on the feature
- `where` : a [SQL clause](http://resources.arcgis.com/en/help/main/10.2/index.html#/SQL_reference_for_query_expressions_used_in_ArcGIS/00s500000033000000/) to limit the features returned. Applies to WFS, wmsTiledLayer and ArcGIS Feature layers. Note that when using a `where` clause with a GeoServer layer, and also using the Identify functionality, only simple `where` clauses are supported (eg `where`: `fieldName = 'value'`)
- `layerDefs` : a [query](https://esri.github.io/esri-leaflet/api-reference/layers/dynamic-map-layer.html) to limit the features returned, in the format `{3:"STATE_NAME='Kansas'", 2:"POP2007>25000"}`. Applies to ArcGIS Dynamic layers
- `viewParams` : a query to limit the features return from a WMS/WFS layer. This requires that the layer has been [appropriately configured as a SQL View](http://docs.geoserver.org/stable/en/user/data/database/sqlview.html) in GeoServer
- `cluster` : `true/false` - cluster point features. Applies to WFS, ArcGIS Feature and GeoJSON layers. Additional options are described on the [Leaflet cluster](https://github.com/Leaflet/Leaflet.markercluster) page
- `hidden` : `true/false` - when true, the layer will not be shown in the Table of Contents or on the map, but can still be used in the Query Widget. This can be useful to allow querying of a complex layer which can't easily be drawn on the map
- `showOnTop` : `true:false` - when true, this layer will be drawn on top of other layers. This can be used to ensure that points draw on top of polygons, etc. (Note that When multiple layers have this option set, there is the potential that they will overlap _each other_.)
- `geomField` - applies to GeoServer layers. The name of the geometry field
- `label`: `{"name": "field_name","minZoom": 10, maxZoom: 16}` - this option creates a simple text label layer based on the specified field name, with the label layer switching on/off based on the current map scale. Applies to WFS layers only

**Specifying and formatting fields**

There are various locations throughout Bootleaf (such as popups, Identify and Query) where it is useful to control which fields/attributes are shown, and how they are formatted. This is handled via the `outFields` parameter, which is an array of field objects in the format:

```
"outFields": [
	{"name": "NAME", "alias": "Name"},
	{"name": "POP", "alias": "Population", "thousands": true},
	{"name": "AREASQKM", "alias": "Area (sq km)", "decimals": 2},
	{"name": "si", "alias": "Sum Insured", "decimals": 0, "prefix": "$"},
	{"name": "startdate", "alias": "Start Date", "date": true},
	{"name": "OBJECTID", "hidden": true}
]
```

- `name` - the field name as returned by ArcGIS Server, GeoServer, etc
- `alias` - an optional alias to display in place of the actual field name
- `thousands` - for numeric fields, the option to display commas as a thousands indicator
- `decimals` - for numeric fields, the option to round values to a specified number of decimal places
- `prefix` - an optional prefix to add before the value (eg $)
- `date` - forces JavaScript-formatted dates (as returned by ArcGIS Server) to display as YYYY/MM/DD
- `hidden` - hides the value from being displayed, but uses it elsewhere (eg in the Download As CSV option)

The `outFields` parameter may be specified against the layer, and additionally against the `identify` and `queryWidget` - this can be useful in order to display different fields in different situations.

For ArcGIS Feature Layers, if this option is specified the layer's ID field must be included (eg, OBJECTID, OID, FID, etc).

- `tooltipField` : `'fieldName'` - for WFS and agsFeatureLayers, you can specify the name of a field to be displayed in a simple tooltip when the user hovers over the feature

**Styling options**
- `style` : style object in [Leaflet format](http://leafletjs.com/reference.html#path-options), which will over-write the default Leaflet styles. Applies to GeoJSON and ArcGIS Feature layers
- `icon` : specify a marker [icon](http://leafletjs.com/reference.html#icon) for GeoJSON and ArcGIS Feature layers
- `clusterIconClass` - over-write the standard cluster styles, and apply a given style to all cluster icons in this layer. Specify a `background-color` or other CSS properties for this class in order to style the cluster appropriately

_Note that only one of these styling options may be applied to a layer as they are mutually exclusive._

Other parameters (as described in the Supported Layer Types links above) may be added to the layer's configuration, and will be sent to the layer constructor.

## [Table of Contents](#table-of-contents)

The [table of contents](http://leafletjs.com/reference-1.0.2.html#control-layers-option) may optionally be used to allow users to switch layers on/off.

![Table of Contents screenshot](https://i.imgur.com/V9Ssnke.png)

Include `TOC` in the `controls` section to enable this option. By default the TOC lists all layers found on the map, but this may be configured by adding the `tocCategories` object, as in this example:

```
"tocCategories": [
	{
		"name": "Group name 1",
		"layers" : ["layerID1","layerID2"],
		"exclusive": true
	},
	{
		"name": "Group name 2",
		"layers": ["layerID3","layerID4"]
	}
],
"toggleAll": true
```

Create groups using the syntax `{"name": "X"}` and add layers to this group using the syntax `{"layers": [list of layer IDs]}`, where the layer IDs match the IDs set up in the Layer Configuration section below.

The `exclusive` flag applies radio buttons to layers within that group, such that only one layer may be visible at any time. This replaces the default checkbox functionality.

The `toggleAll` flag adds buttons to the top of the Table of Contents, allowing all layers to be toggled on/off quickly.

*Note: this Table of Contents widget does not have the ability to control the layer draw order, so the last layer checked on always draws on top of other layers. This will be improved upon in the future.*

## [Identify](#identify)

Identify functionality may currently be configured for WMS and ArcGIS Server Dynamic layers (other layer types may be supported in future).

![identify results screenshot](https://i.imgur.com/7bdIVIX.png)

To enable this, add the `identify` object as an option under a Dynamic or WMS layer:

```
{
	"id": "layerID",
	"type": "agsDynamicLayer",
	"identify": {
		"layerName": "the layer name in the ArcGIS Server REST API",
		"layerLabel": "the layer name to display in the Results dialog",
		"primaryField": "the field on which to report",
		"outFields": [
			{"name": "field_name", "alias": "Field Alias", "prefix": "$"},
			{"name": "field alias", "thousands": true, "decimals": 2}
		],
	},
	"maxAllowableOffset": 0.01
}
```

If `outFields` is not specified against the `identify` object, the layer's `outFields` will be used. See the `outFields` section above for more information on the field specification.

Note: If the ArcGIS Server REST API lists an alias against a field, this should be used in place of the field name. Eg in the case of [this layer](http://vmgeospatialdev.erga.aubootleaf.corp/arcgis/rest/services/admin_boundaries/EmbargoRegions_BOM_201506/MapServer/1) the *BNAME* field has an alias, so (somewhat confusingly) the *alias* should actually be specified in the `name` field:

*BNAME ( type: esriFieldTypeString , alias: BOM river region name)*

When the Identify tool is activated under the > Tools menu, and the layer is visible, clicking on the map will return the value of the `primaryField` at the location clicked. The results for all identify-able layers are shown in the pull-out sidebar.

*Note: the Identify tool is only enabled if there are visible, identifiable layers on the map.*

## [Query](#query)

The query widget allows users to search for features within a layer, and is currently supported for ArcGIS Server Feature & Dynamic layers, and WMS/WFS layers.

![query widget screenshot](https://i.imgur.com/sElCdJp.png)

To enable this, add the `queryWidget` object as an option under an ArcGIS Dynamic or Feature layer:

```
"queryWidget": {
	"layerIndex": 0,
	"maxAllowableOffset": 0.001,
	"queries" : [
		{"name": "NAME", "alias": "Name"},
		{"name": "POP", "alias": "Population", "type": "numeric"}
	],
	"outFields": [
		{"name": "NAME", "alias": "Name"},
		{"name": "POP", "alias": "Population", "thousands": true},
		{"name": "AREASQKM", "alias": "Area (sq km)", "decimals": 2},
		{"name": "OBJECTID", "hidden": true}
	]
}
```

#### Query Widget Parameters

- `layerIndex` - the layer's index according to its REST URL. Applies to ArcGIS Dynamic layers only
- `maxAllowableOffset` - this parameter allows the query results to be returned faster, by generalising the output geometry by the specified amount. The units are whatever units the dataset is stored in (eg decimal degrees, metres, etc). This applies to ArcGIS layers only
- `queries` - an array of query objects, consisting of:
    - `name` - the name of the field to query
    - `alias` - an optional alias to display in the widget
	- `type` - defaults to text, or use `numeric` to allow the correct syntax for numerical fields. Other field types may be added in future.
- `outFields` - the list of field objectss to be returned in the query results section. If `outFields` is not specified against the `queryWidget` object, the layer's `outFields` will be used. See the `outFields` section above for more information on the field specification. (TODO - this isn't hooked up yet)

Use the Within Current Map Extent or Within Polygon options to restrict the query to the specified extent. Use the Download As CSV option to download the results for processing in Excel.

If the query layer uses a projection other than lat/long, the layer's coordinate system must be added to the config file's `projections` parameter (see above).

*Note: the Query Tool is only enabled if there are queryable layers on the map.*

## [Custom code](#custom-code)
The file custom.js can be used to personalise the map by writing additional functionality. This file contains 2 functions, `beforeMapLoads()` and `afterMapLoads()`, which allow you to perform customisations as required.

The sample file includes code to demonstrate how to use a user-defined query string to filter a layer on-the-fly:

![Custom code screenshot](https://i.imgur.com/6YLfiHz.png)

## [Known issues and other problems](#issues)

- the `exclusive` option in the Table of Contents doesn't always work well when the map first opens - it may be out of sync with what's displayed on the map. The workaround is to have all layers switched off by default when they're inside an exclusive TOC group. Once a layer has been checked on in the TOC, the behaviour reverts to normal.
- related to the above, the Identify tool may not work against the correct layers if the Identify tool is active when the map loads with exclusive TOC groups. The workaround is to not have the Identify tool active when the map loads, when using an exclusive TOC group. Once the Identify tool is enabled using the > Tools > Identify option, the behaviour reverts to normal.

Contact [Steve](https://github.com/slead) if you encounter any problems, and/or log bugs using the [Issues](https://github.com/bootleafcl/geo_web/issues) link on GitHub.


text:
# Transferlearning_TF_NLP
    Used pre-trained NLP text embedding models from TensorFlow Hub
    Performed transfer learning to fine-tune models on real-world text data
    Visualized model performance metrics with TensorBoard
The machine learning model is trained on text based data, to classify questions as offensive or accepted in the quora community(Ex.)


text:
---
id: lua_reference
name: Lua Reference
title: Lua Reference
tags:
    - Reference
---

# Lua Primer

## Overview

Core uses **Lua**, a lightweight and flexible programming language to accomplish
scripting in the engine. It is a [dynamically
typed](https://en.wikipedia.org/wiki/Type_system#Combining_static_and_dynamic_type_checking)
language, has no inbuilt conception of classes, and has minimal to no data
structures present in the base language. As of late May 2019, we are using Lua version **5.3.4**.

The next steps depend on your level of previous programming experience.

### Beginner

After you're done reading this primer, check out this [tutorial](lua_basics_lightbulb.md), and review the [official](https://www.lua.org/pil/contents.html) docs after.

!!! warning "Programming In Lua (official link) is based on Lua 5.0 and missing additions of later version!"

### Intermediate

Skim through the beginner content, then try our [Manticoin Game](lua_basics_manticoin.md) tutorial.

### Advanced

Check out this [primer](https://learnxinyminutes.com/docs/lua/), or this [reference-sheet](http://lua-users.org/files/wiki_insecure/users/thomasl/luarefv51.pdf) for tips on syntax. Use the
official [reference](http://www.lua.org/manual/5.3/) as needed, then make yourself familiar with the [Core API](core_api.md) and take a look at our [style guide](lua_style_guide.md) and [Editor extensions](extensions.md).

#### Coming from other platforms

Other platforms also have good sources of documentation for Lua. Check out our "Coming to Core from Other Platforms" section for a few hints on what's different in **Core**.

## Basics

While there are already a ton of good Lua tutorials out there, we're still going to teach you the most basic things right here.

```lua
-- Two dashes start a one-line comment.

--[[
     Adding two ['s and ]'s makes it a
     multi-line comment.
--]]
```

## Variables and Flow Control

```lua
num = 42  -- All numbers are doubles.
-- Don't freak out, 64-bit doubles have 52 bits for
-- storing exact int values; machine precision is
-- not a problem for ints that need < 52 bits.

s = 'walternate'  -- Immutable strings like Python.
t = "double-quotes are also fine"
u = [[ Double brackets
       start and end
       multi-line strings.]]
t = nil  -- Undefines t; Lua has garbage collection.

-- Blocks are denoted with keywords like do/end:
while num < 50 do
  num = num + 1  -- No ++ or += type operators.
end

-- If clauses:
if num > 40 then
  print("over 40")
elseif s ~= "walternate" then  -- ~= is not equals.
  -- Equality check is == like Python; ok for strs.
  io.write("not over 40\n")  -- Defaults to stdout.
else
  -- Variables are global by default.
  thisIsGlobal = 5  -- Camel case is common.

  -- How to make a variable local:
  local line = io.read()  -- Reads next stdin line.

  -- String concatenation uses the .. operator:
  print("Winter is coming, " .. line)
end

-- Undefined variables return nil.
-- This is not an error:
foo = anUnknownVariable  -- Now foo = nil.

aBoolValue = false

-- Only nil and false are falsy; 0 and "" are true!
if not aBoolValue then print("twas false") end

-- "or" and "and" are short-circuited.
-- This is similar to the a?b:c operator in C/js:
ans = aBoolValue and "yes" or "no"  --> "no"

karlSum = 0
for i = 1, 100 do  -- The range includes both ends.
  karlSum = karlSum + i
end

-- The range is: begin, end[, step], use -1 as the range to count down

fredSum = 0
for j = 100, 1, -1 do
  fredSum = fredSum + j
end

-- Another loop construct:
repeat
  print("the way of the future")
  num = num - 1
until num == 0
```

## Functions

```lua
function Fib(n)
  if n < 2 then return 1 end
  return Fib(n - 2) + Fib(n - 1)
end

-- Closures and anonymous functions are ok:

function Adder(x)
  -- The returned function is created when Adder is
  -- called, and remembers the value of x:
  return function(y) return x + y end
end

a1 = Adder(9)
a2 = Adder(36)
print(a1(16))  --> "25"
print(a2(64))  --> "100"

-- Returns, func calls, and assignments all work
-- with lists that may be mismatched in length.
-- Unmatched receivers are nil.
-- Unmatched senders are discarded.

x, y, z = 1, 2, 3, 4

-- Now x = 1, y = 2, z = 3, and 4 is thrown away.

function Bar(a, b, c)
  print(a, b, c)
  return 4, 8, 15, 16, 23, 42
end

x, y = Bar("zaphod")  --> "zaphod  nil nil"
-- Now x = 4, y = 8, values 15..42 are discarded.

-- Functions are first-class, may be local/global.
-- These are the same:

function F(x)
  return x * x
end

F = function(x)
  return x * x
end

-- And so are these:

local function G(x)
  return math.sin(x) -- Trigonometry funcs work in radians, by the way.
end

local G
G = function(x)
  return math.sin(x)
end
-- the "local G" declaration makes g-self-references ok.
```

## Tables

```lua

-- Tables = Lua's only compound data structure;
--          they are associative arrays.
-- Similar to php arrays or js objects, they are
-- hash-lookup dicts that can also be used as lists.

-- Using tables as dictionaries / maps:

-- Dict literals have string keys by default:

t = {key1 = 'value1', key2 = false}

-- String keys can use js-like dot notation:

print(t.key1)  --> "value1"
t.newKey = {}  -- Adds a new key/value pair.
t.key2 = nil   -- Removes key2 from the table.

-- Literal notation for any (non-nil) value as key:

u = {["@!#"] = "qbert", [{}] = 1729, [6.28] = "tau"}
print(u[6.28])  --> "tau"

-- Key matching is basically by value for numbers
-- and strings, but by identity for tables.

a = u["@!#"]  -- Now a = "qbert".
b = u[{}]     -- We might expect 1729, but it's nil:

-- b = nil since the lookup fails. It fails
-- because the key we used is not the same object
-- as the one used to store the original value. So
-- strings & numbers are more portable keys.

-- A one-table-param function call needs no parens:

function H(x)
  print(x.key1)
end

h{key1 = "Sonmi~451"}  --> "Sonmi~451"

-- There are two types of table iterators in Lua
-- pairs() returns key-value pairs and is mostly used for associative tables.
-- Attention: Key order is unspecified.

u = {}
u[1] = "a" -- Attention: Indices start at 1 in Lua!
u[3] = "b"
u[2] = "c"
u[4] = "d"
u["hello"] = "world"

for key, val in pairs(u) do
  print(key, val)
end

-- will print:
-- 1  a
-- 2  c
-- 3  b
-- 4  d
-- hello  world

-- ipairs() returns index-value pairs and is used for numeric tables.
-- Non numeric keys in an array are ignored, while the index order is in numeric order.
-- When you create tables without keys, ipairs behaves as a numeric array and therefore the same as pairs.
-- Attention: ipairs stops when it first encounters a gap.

for index, val in ipairs(u) do
  print(index, val)
end

-- will print:
-- 1  a
-- 2  c
-- 3  b
-- 4  d

-- _G is a special table of all globals.
print(_G["_G"] == _G)  --> "true"

-- Using tables as lists / arrays:

-- List literals implicitly set up int keys:
v = {"value1", "value2", 1.21, "gigawatts"}

for i = 1, #v do  -- #v is the size of v for lists.
  print(v[i])
end

-- A 'list' is not a real type. v is just a table
-- with consecutive integer keys, treated as a list.
```

### Metatables and Metamethods

```lua
-- A table can have a metatable that gives the table
-- operator-overloadish behavior. Later we'll see
-- how metatables support js-prototypey behavior.

f1 = {a = 1, b = 2}  -- Represents the fraction a/b.
f2 = {a = 2, b = 3}

-- This would fail:
-- s = f1 + f2

metafraction = {}
function metafraction.__add(f1, f2)
  sum = {}
  sum.b = f1.b * f2.b
  sum.a = f1.a * f2.b + f2.a * f1.b
  return sum
end

setmetatable(f1, metafraction)
setmetatable(f2, metafraction)

s = f1 + f2  -- call __add(f1, f2) on f1's metatable

-- f1, f2 have no key for their metatable, unlike
-- prototypes in js, so you must retrieve it as in
-- getmetatable(f1). The metatable is a normal table
-- with keys that Lua knows about, like __add.

-- But the next line fails since s has no metatable:
-- t = s + s
-- Class-like patterns given below would fix this.

-- An __index on a metatable overloads dot lookups:

defaultFavs = {animal = "gru", food = "donuts"}
myFavs = {food = "pizza"}
setmetatable(myFavs, {__index = defaultFavs})
eatenBy = myFavs.animal  -- works! thanks, metatable

-- Direct table lookups that fail will retry using
-- the metatable's __index value, and this recurses.

-- An __index value can also be a function(tbl, key)
-- for more customized lookups.

-- Values of __index,add, .. are called metamethods.
-- Full list. Here a is a table with the metamethod.

-- __add(a, b)                     for a + b
-- __sub(a, b)                     for a - b
-- __mul(a, b)                     for a * b
-- __div(a, b)                     for a / b
-- __mod(a, b)                     for a % b
-- __pow(a, b)                     for a ^ b
-- __unm(a)                        for -a
-- __concat(a, b)                  for a .. b
-- __len(a)                        for #a
-- __eq(a, b)                      for a == b
-- __lt(a, b)                      for a < b
-- __le(a, b)                      for a <= b
-- __index(a, b)  <fn or a table>  for a.b
-- __newindex(a, b, c)             for a.b = c
-- __call(a, ...)                  for a(...)
```

### Class-like Tables and Inheritance

```lua
-- Classes aren't built in but there are different ways
-- to make them using tables and metatables.

Dog = {}                                   -- 1.

function Dog:New()                         -- 2.
  newObj = {sound = "woof"}                -- 3.
  self.__index = self                      -- 4.
  return setmetatable(newObj, self)        -- 5.
end

function Dog:MakeSound()                   -- 6.
  print("I say " .. self.sound)
end

mrDog = Dog:New()                          -- 7.
mrDog:MakeSound()  --> "I say woof"        -- 8.

-- 1. Dog acts like a class; it's really a table.
-- 2. function tablename:fn(...) is the same as
--    function tablename.fn(self, ...)
--    The : just adds a first arg called self.
--    Read 7 & 8 below for how self gets its value.
-- 3. newObj will be an instance of class Dog.
-- 4. self = the class being instantiated. Often
--    self = Dog, but inheritance can change it.
--    newObj gets self's functions when we set both
--    newObj's metatable and self's __index to self.
-- 5. Reminder: setmetatable returns its first arg.
-- 6. The : works as in 2, but this time we expect
--    self to be an instance instead of a class.
-- 7. Same as Dog.New(Dog), so self = Dog in New().
-- 8. Same as mrDog.makeSound(mrDog); self = mrDog.

----------------------------------------------------

-- Inheritance example:

LoudDog = Dog:New()                           -- 1.

function LoudDog:MakeSound()
  s = self.sound .. " "                       -- 2.
  print(s .. s .. s)
end

seymour = LoudDog:New()                       -- 3.
seymour:MakeSound()  --> "woof woof woof"     -- 4.

-- 1. LoudDog gets Dog's methods and variables.
-- 2. self has a 'sound' key from New(), see 3.
-- 3. Same as LoudDog.New(LoudDog), and converted to
--    Dog.New(LoudDog) as LoudDog has no 'new' key,
--    but does have __index = Dog on its metatable.
--    Result: seymour's metatable is LoudDog, and
--    LoudDog.__index = LoudDog. So seymour.key will
--    = seymour.key, LoudDog.key, Dog.key, whichever
--    table is the first with the given key.
-- 4. The 'makeSound' key is found in LoudDog; this
--    is the same as LoudDog.makeSound(seymour).

-- If needed, a subclass's New() is like the base's:
function LoudDog:New()
  newObj = {}
  -- set up newObj
  self.__index = self
  return setmetatable(newObj, self)
end
```

## Modules

Lua in Core does not support `dofile()` or `loadfile`. For `require()`, our implementation differs slightly from vanilla Lua;
Instead of giving it a script or file name, you give it the script ID, so you'll want a custom parameter that's an asset reference pointing at the script you want to `require()`.

If you're still really hungry for more info, more primers can be found here:

* [LuaTut](http://luatut.com/crash_course.html)
* [WingDB](http://www.wingdb.com/docs/pages/wg_lua_primer.htm)
* [Geeks3D](https://www.geeks3d.com/20130516/lua-primer-for-the-impatient/)
* [TylerNeylon](http://tylerneylon.com/a/learn-lua/)

repository: steveulrich/platform-documentation

branch_name: refs/heads/development

gha_license_id: MIT

repo_name: steveulrich/platform-documentation


text:
# nodejs-app
Simple NodeJS app

## Getting Started
This App it's a little help for you manage login in NodeJS. We are using passport authenticate to facebook and google auth and create are on
models for local users. We also aproach MongoDB or SQL DB's, and the architeture MVC.
Help you using Express, express-session, bodyparser, routes and some others initial things.

### Prerequisites
Assuming you have already installed NPM and have a simple knowledge with JS and NodeJS it's just follow the steps below

### Installing
On your directory:
```
git clone https://github.com/gabrielboian/nodejs-app.git
```

after cloning the repo:

Entry on folder and type:
```
npm install
```

### Running
After all steps above you have to choose between MYSQL or MongoDB, after that you have to run:

if mongodb:
```
npm install mongoose
```

if mysql:
```
npm install sequelize
```
```
npm install sequelize-cli
```

Open the project on your prefered editor and ready app.js to understand how connect your database's choice
And then open our models and delete or comment the code who don't matches with your choice

When you are done just run:
```
npm start
```

## Author

* **Gabriel Boian** - [GabrielBoian](https://github.com/gabrielboian)

## License

This project is licensed under the MIT License

repository: gabrielboian/nodejs-app

gha_language: JavaScript

repo_name: gabrielboian/nodejs-app


text:
# Udacity Nanodegree - Data Structures & Algorithms - Advanced Algorithms

This is the Advanced Algorithms chapter project submitted during the Udacity Data Structures & Algorithms Nanodegree course.

### Project Text & Purpose

"In this project, you will build a route-planning algorithm like the one used in Google Maps to calculate the shortest path between two points on a map."

The project require the implementation of the [A* algorithm](https://en.wikipedia.org/wiki/A*_search_algorithm) to find best route from a node A to a node B in a map.

## Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

### Requisites

To run python scripts is necessary have installed Python 3 in your environment. On local system i've used Python 3.6 and 3.7 to develop the different projects.
This project has been developed on the [Jupyter Notebook](https://jupyter.org/) with python 3

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details


text:
# django_url_shorter
a django url service for shortening a url and also counting its clicks

# Objective
A url shortening service made in django. User can enter in the url and press OK, a new
shortened url will be returned to him. Whenever the shortened url is used, we are going to
increment our click counts.

# Django Models
At first we have just one field that is for the url, which can be a CharField but django now
supports URLField() which also has a max_length attribute of default 200.

```
url = models.URLField(max_length=220)
```

Then we expand our models to include a shortcode or the shortened url will be stored in
here, we limit this field to a max of 15 chars.

```
shortcode = models.URLField(max_length=15)
```

*NOTE:* models.URLField is new in django2 and is a CharField for a URL, validated by
URLValidator.

Then we have our timestamp and updated fields that keep track of the time when this model
object was created and updated, these both fields use DateTimeField which has some
attributes for automatically handling saving of current date and time.

```
DateTimeField(auto_now=True)
# auto_now=True means this field will have the date edited and saved whenever the object is
edited or updated

DateTimeField(auto_now_add=true)
# auto_now_add=True means that the date of creating the object will be saved here.
```

# Django shell
```
python manage.py shell
```

Running shell in django project and executing some model specific command will give you all
information about your django apps, database, fields, etc.

You can even create model objects from shell using the model API through the shell.
You just need to import your model from your app,

```
from shortener.models import KirrURL
KirrURL.objects.all()
KirrURL.objects.create(
	url='https://google.com',
	shortcode='http://go.gl')
```

The above command will actually create an KirrURL model object with the following values
But the flaw here is that you can pass in empty values and the shell won't raise any errors,
whereas if you do the same in the admin site, you will get many errors,

```
obj = KirrURL()
obj.save()
obj1 = KirrURL.objects.create()
obj1.url = 'https://udacity.com'
```

Try this and shell does not raise any errors.

```
obj3, created = KirrURL.objects.get_or_create(url='https://joincfe.com')
```

objects.get_or_create either gets the object if it exists by checking the field value or it
creates one, you can check this by printing the values of each variable

```
print(obj3)			# https://joincfe.com
print(created)		# True
```

If the objects does not exist and it has been created now then created should be True

Or you can just use one variable and shell will print the values in a tuple

```
obj5 = KirrURL.objects.get_or_create(url='https://youtube.com')
print(obj5)

>>> ('https://youtube.com', True)		# url value and created or not boolean

obj6 = KirrURL.objects.get_or_create(url='https://youtube.com')
>>> ('https://youtube.com', False)		# False says this object existed and not created now
```

# Overiding save method
In order to create a shortcode automatically whenever we create a new url object we are
going to overide the default save method in our KirrURL model.

Remember how we used the save method with the object in the django shell

```
...
obj.save()
```

Now for overiding it we need to define the save method in our model class ourselves like so

```
...
	def save(self, *args, **kwargs:
		super(KirrURL, self).save(*args, **kwargs)

```

The moment we define the save method in our class, it doesn't matter if we have done
modified it or not, we have overided the save method and before us calling the super method
we can do whatever custom operation we want our save method to run before saving the model,

```
...
	def save(self, *args, **kwargs:
		print('saving our custom method...')
		super(KirrURL, self).save(*args, **kwargs)
```

Now if we try to save our object, it will print the line everytime.

# Random URL generator
Function code_generator creates a random code from all the alphabets using the random
module in python and setting the range to 6 letters code.

```
def code_generator(size=6, chars='qwertyuioplkjhgfdsazxcvbnm'):
	return ''.join(random.choice(chars) for _ in range(size))
```

We have used python generators to create a random, this is a very basic function which is
not very powerful, but we will upgrade to a better url generator

```
import string

def code_generator(size=6, chars=string.ascii_lowercase + string.digits + string.ascii_uppercase):
	return ''.join(random.choice(chars) for _ in range(size))
```

A modern approach in python for getting all the ascii letters and digits will be to use
string module.

# Custom model manager

Django allows all custom support that is we can change many default things with our models
in django, here we have put all our function in a seperate utils.py file and imported them
in our models.

KirrModelManager is a custom model manager which is through our class inheritance by the
models.Manager class

```
class KirrModelManager(models.Manager):
	def all():
		...
```

Overiding all method in here and telling our KirrURL model to use this manager instead of
the default one will give us access to custom model manager,

```
class KirrModelManagar(models.Manager):
	def all(self, *args, **kwargs):
		queryset = super(KirrModelManagar, self).all(*args, **kwargs)
		qs = queryset.filter(active=True)
		return qs

class KirrURL(models.Model):
	...
	objects = KirrModelManagar()
	...
```

Don't forget to define our Model Manager in the model by replacing it with objects, remeber
we use

```
model.*objects*.all()
```

What we have done here is very simple, we just call our super class to give us the all()
method that we use on model.objects.all() and we return all method with a filter, we filter
out all objects who have active field True, this means the command,

```
*django shell*
from shortener.models import KirrURL
KirrURL.objects.all().count()
KirrURL.objects.filter(active=False).count()
```

The custom model manager now has a new function that we can use directly with our objects
like so,

```
class KirrModelManagar(models.Manager):
	...
	def refresh_shortcodes(self):
			qs = KirrURL.objects.filter(id__gte=1)
			new_codes = 0
			for q in qs:
				q.shortcode = 'http://' + str(create_shortcode(q)) + '.co'
				print(q.shortcode)
				q.save()
				new_codes += 1
			return f"New codes made: {new_codes}"
```

```
KirrURL.objects.refresh_shortcodes()
```

Since we have our custom all() method with objects which does not return those objects with
active = False so we cannot use all method to access all the objects of our model so another
workaround will be to use the filter method and a attribute like

```
queryset = KirrURL.objects.filter(id__gte=1)
```

What above command says is to filter our all objects who have their 'id' (auto generated
field produced by django) __gte means greater than or equal to 1 which will cover all the
objects since every id will be greater than or equal to 1.

# Django-admin commands
*Source*: [django-admin commands](https://docs.djangoproject.com/en/2.1/howto/custom-management-commands/)
We don't need arguments and neither their handling, we just need to call our refresh_
shortcodes() from the handle function.

```
from shortener.models import KirrURL

	...
	def handle(self, *args, **options):
	        return KirrURL.objects.refresh_shortcodes()
```

*Run the refreshcodes command directly from root folder using manage.py file,*

```
python manage.py refreshcodes
```

**Using Arguments in Django-Admin commands**

**shortener/management/commands/refreshcodes.py**
```
	...
	def add_arguments(self, parser):
	        parser.add_argument('number', type=int)
```

**shortener/models.py**
```
	...
	def refresh_shortcodes(self, items):
		print(items)
		...
```

Model manager also has an property .order_by() which takes in the fields of the models.
This method orders the objects on the basis of the field, we can order by in decreasing order
by putting a '-' before our field name and pass in to order_by()

```
qs = KirrURL.objects.filter(id__gte=1).order_by('-id')
qs = KirrURL.objects.filter(id__gte=1).count()
```

.count() returns the number of objects returned from the query and order_by orders the
returned objects in decreasing order of id's of objects

# Views and Urls
There are two ways in which we can make our views > *function based views and class based
views*, class based views need a model upon which they can display the page but we can
also use get method to just return what we want. After creating views, each view needs a url
for us to locate and look at the particular view, just import the view in urls.py file and
create a view using the function or class, class based views needs a .as_view() method
since they are not simple functions.

**class-based view**
```
from django.http import HttpResponse
from django.views import View

class KirrRedirectView(View):
	def get(self, request, *args, **kwargs):
		return HttpResponse("<h1>Kirr Url Shortener Again</h1>")
```

**NOTE:** Class based views need a model upon which they are based but here for starters we
are just using the get method in View class to return our response on webpage.

```
def kirr_redirect_view(request, *args, **kwargs):
	return HttpResponse('<h1>Kirr Url Shortener</h1>')
```

**NOTE:** Don't forget to return from our views or the view won't work.

# Using Setting Variable
A more robust way for getting a specified value and using it in our code is to define
important and usable variables in our project settings.py file and then importing and using
those variables in other files.

**kirr/settings.py**
```
...
SHORTCODE_MAX = 15
SHORTCODE_MIN = 5
...
```

Our functions in models.py has max_length attribute in shortcode field so we can specify a
value from settings file to use in our max_length

**shortener/models.py**
```
from django.conf import settings

SHORTCODE_MAX = getattr(settings, "SHORTCODE_MAX", 15)

class KirrURL(models.Model):
	...
	shortcode = models.URLField(max_length=SHORTCODE_MAX, unique=True, blank=True)
	...
```

Notice the getattr function, this function is very useful in these cases, if the getattr
methods find the variable SHORTCODE_MAX in settings (which we import at top) then it will
assign SHORTCODE_MAX the value but if it doesn't then it will return 15 which is a default
value.

**shortener/utils.py**
```
from django.conf import settings

SHORTCODE_MIN = getattr(settings, "SHORTCODE_MIN", 5)

def create_shortcode(instance, size=SHORTCODE_MIN):
	...
```

Similarly we can import and use the variable in utils.py file

*WHAT WE DID ABOVE IS FOR THOSE CASES WHEN WE REUSE OUR APP IN SOME OTHER PROJECTS*

# Get object or 404
```
from django.shortcuts import render, get_object_or_404

def kirr_redirect_view(request, shortcode=None, *args, **kwargs):
	object = get_object_or_404(KirrURL, shortcode=shortcode)
	return HttpResponseRedirect(obj_url)
```

The simplest and two line solution for redirecting from our shortcoded url to the actual
url is using the get_object_or_404 method which will just get the object from the model
we provided and the parameter which here is the shortcode, if we get the object we return
Response Redirect to the actual url associated with the object

Then for testing purposes on our local computer we use the hosts of our WINDOWS which is
located at *C:\WINDOWS\system32\drivers\etc* and set our localhost to any custom domain

```
<IP_ADDRESS> 			djgo.com
<IP_ADDRESS> 			www.djgo.com
```

One important thing left is to add our custom domain in allowed hosts of our project
settings...

**kirr/settings.py**
```
ALLOWED_HOSTS = ['djgo.com', '<IP_ADDRESS>', 'www.djgo.com']
```

Now accessing the url with our custom domain like *http://djgo.com:8000/func-view/asdgsd/*
This will redirect to the specified url of the object or return a 404 page

# Django-hosts
SOURCE: [django-hosts](https://django-hosts.readthedocs.io/en/latest/)

We are going to use django-hosts package for our project, just visit the link above
and follow the instructions there to install hosts and include in our project.

We need to set DEFAULT_HOST equal to the hosts pattern that we refer as the default
pattern

SOURCE: [udemy lecture](https://www.udemy.com/try-django-1-10/learn/v4/t/lecture/5922406?start=465)

Basically what we did with django-hosts is that we made our website more advanced, you see
the websites with www.name.domain and this gets redirected to whatever the SSL the website
uses for e.g *http://* or *https://*, we did the same with the help of hosts, we made
our website work even if the user enter in the browser > *www.djgo.com*, our website
will show the webpage, we also gave some custom urls to our website like the blog.djgo.com
which will render the same view from ROOT_URLCONFS which our *kirr/urls.py*

**On adding a host for our blog in hosts.py and the root urls as well as adding
blog.djgo.com to our ALLOWED_HOSTS and hosts file in drivers\etc we have a new url ready
which will be blog.djgo.com:8000/shortcode/ which will show the view.**

**hostsconf/views.py** simply takes in the path from the url if exists and then redirects
it to the default url with or without path attached at end.

# Django Templates
**kirr/settings.py**

```
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        ...
```

When we look at this section inside our settings.py file, it has this 'DIRS' value of
an empty list, this setting is for the root templates folder for all our apps and project.

Either we can set this folder by creating a folder in our root project directory where
manage.py file is located or we can just create templates folder inside each of our apps
where we want to render html files.

**Project directory tree** will look like this for root templates folder and we have to
tell our settings to look for templates in here
```
+ kirr
+ shortener
+ templates
	+ shortener
		- home.html
- .gitignore
- db.sqlite3
- manage.py
- README.md
```

kirr/settings.py
```
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')],
        'APP_DIRS': True,
        ...
```

**If you choose to reuse the app then in that case we need to create templates for the app
inside the app folder itself and in that case we don't need to specify the templates
folder location in settings file for our project**

**Project directory tree** will look like this for templates inside the app itself
```
+ kirr
+ shortener
	+ templates
		+ shortener
			- home.html
+ templates
	+ shortener
		- home.html
- .gitignore
- db.sqlite3
- manage.py
- README.md
```

Now to use the templates using the render method in our views we will just use the path
in both the cases whether we want root or app templates

shortener/views.py
```
...
	return render(request, 'shortener/home.html', {})
...
```

# Django Forms
In our views we have the HomeView which has the method for handling the GET request
through the get method, we import our form and pass it in to our context for get method

For handling POST requests we need a similar logic but we need to get the data that users
POSTED from the form, so for that the View class from django.views has a post method
just like the get method.

**shortener/views.py**
```
class HomeView(View):
	...
	def post(self, request, *args, **kwargs):
		form = ShortenURLForm(request.POST)
		context = {
			'form': form
		}

		if form.is_valid():
			print(form.cleaned_data)
		return render(request, 'shortener/home.html', context)
```

In our get method we check if the POST request with form has the valid data and not some
malicious, harmful, server-destroying data using the logic in if clause, *form.is_valid()*
, if yes we print the cleaned_data from form and return the same page with the same form and
data.

Inside our forms.py we have a more secure method that does those cleaning up and is_valid
process using the form validation for the seperate field, forms.Form has clean method
which we call upon using *super().clean()*, and store that cleaned data in *cleaned_data*

*clean* is form validation method and cleaned_url is field validation method which checks
if the data in field is cleaned, we simply store url from *cleaned_data* from our other
method in *url* and return it.

**shortener/forms.py**
```
class ShortenURLForm(forms.Form):
	url = forms.URLField()

	def clean(self):
		cleaned_data = super().clean()
		url = cleaned_data['url']
		print(url)

	def cleaned_url(self):
		url = self.cleaned_data['url']
		print(url)
		return url
```

The above validation functions are not very safe so we use the in-built validatiors
from django.core.validators and raise error for validation from django.core.exceptions

```
from django.core.validators import URLValidator
from django.core.exceptions import ValidationError

def validate_url(value):
	url_validator = URLValidator()
	try:
		url_validator(url)
	except Exception as e:
		raise ValidationError(e)
	return value

class ShortenURLForm(forms.Form):
	url = forms.URLField(validators=[validate_url])
```

Once we create a validator we can specify this custom validator for our field by inserting
this function in the validators list of our field

**NOTE:**Since forms in django2 has URLField that has validation from URLValidators
we don't need to write this extra code but we can have any other validator like checking i
if the url entered has a .com domain or not.

This is rather very simple logic but we create a separate file for our validators and then
import our validator in the forms file

**shortener/validators.py**
```
def validate_com_url(value):
	if 'com' not in value:
		raise ValidationError("Entered URL is not a valid .com url")
	return value
```

We use the same validator inside our model url field also using the same attribute

```
from .validators import validate_com_url

class KirrURL(models.Model):
	url = models.URLField(max_length=220, validators=[validate_com_url])
	...
```

Next time you try to save a model object with url field not having a .com in it then
it will raise errors. We actually will remove this validator since we want our shortener for
all domain types.

In our models we are going to create a method for getting the shortened url for the object
and use the method in the template with our object, we first used the reverse method that
django.urls provied which takes in the view name from our urls and optionally any arguments,
we have shortcode argument with our shortcode-view here so we pass in the kwargs with our
shortcode.

**kirr/views.py**
```
from django.urls import reverse

class KirrURL(models.Model):
	...

	def get_short_url(self):
		shortcode = self.shortcode
		url_path = reverse('shortcode-view', kwargs={'shortcode': shortcode})
		return url_path
```

The django.urls reverse method is nice but since we are using django_hosts for our hosts
so we are going to use the reverse method from django_hosts.

```
from django_hosts import reverse

class KirrURL(models.Model):
...
	def get_short_url(self):
		shortcode = self.shortcode
		url_path = reverse(
			'shortcode-view',
			kwargs={'shortcode': shortcode},
			host='www',
			scheme='http',
			port='8000'
		)
		return url_path
```

The above method uses reverse method from django_hosts which works the same but gives more
robust way, it adds scheme, port, host for our url and rest is same as django reverse.

For using our method in template we just call our method without any brackets

**NOTE:** Any method is called in template using template tags withour the brackets unlike in
our python code.

```
{{ obj.get_short_url }}
```

This is much more simpler than the previous one

# Click Analysis
After creating the shorten url that works we need to be able to track the clicks for each
shortened url and have it stored the count on every click, so for this we decide to create
a separate app named analytics.

```
python manage.py startapp anayltics
```

We are only going to use the models.py for this particular app since we got all our views
ready in shortener app, we need a OneToOneField to store the KirrURL object and a interger
field for storing the count of the clicks, optionally we can use the timestamp and updated
from the KirrURL model which automatically gets saved.

```
from shortener.models import KirrURL

class ClickAnalytic(models.Model):
	kirr_url = models.OneToOneField(KirrURL, on_delete=models.CASCADE)
	count = models.IntegerField(default=0)
	updated = models.DateTimeField(auto_now=True)
	timestamp = models.DateTimeField(auto_now_add=True)

	def __str__(self):
		return f"{self.count}"
```

__str__() method gives us a way to print our object and show the count. Now We need a
method for creating the object once our shortened url is clicked and also increment
the count (set 0 as default) by one on each click, we create a method in the model manager
of the model and name it click_analyse, which takes in a instance of the KirrURL object
and does some checking, tries to get or create ClickAnalytic object with the instance
as the kirrURL, increment count, save the object and return it.

**NOTE:** We create model manager using the class models.Manager and after creating manager
we need to define it as our custom in the model by manager to our model objects.

```
class ClickAnalyticManager(models.Manager):
	def click_analyse(self, instance):
		print(f'INSTANCE: {instance}')
		if isinstance(instance, KirrURL):
			try:
				obj, created = self.get_or_create(kirr_url=instance)
				obj.count += 1
				obj.save()
				return obj.count
			except Exception as e:
				print(e)

		return None

class ClickAnalytic(models.Model):
	...
	objects = ClickAnalyticManager()
```

*We are able to use get_or_create with self because we call manager and store it in objects
variable which gives it that functionality*

# Calling click_analyse
The only thing left is to call our method from shortener redirect view which is very simple

```
class KirrRedirectView(View):
	def get(self, request, shortcode=None, *args, **kwargs):
		object = get_object_or_404(KirrURL, shortcode=shortcode)
		obj_url = object.url
		ClickAnalytic.objects.click_analyse(object)
		return HttpResponseRedirect(obj_url)
```

We pass in the object(instance) to our method which does all the work, but remember *object
and count will only be created when the shortened url is clicked*

# Deploying with [heroku](https://www.heroku.com)
You can visit the site and follow their awesome docs to install and get started with heroku
deployment with django. To check heroku is installed and running run

```
> heroku

CLI to interact with Heroku

VERSION
  heroku/7.7.4 win32-x64 node-v10.6.0

USAGE
  $ heroku [COMMAND]

COMMANDS
  access          manage user access to apps
  addons          tools and services for developing, extending, and operating your
                  app
  apps            manage apps on Heroku
  auth            check 2fa status
  authorizations  OAuth authorizations
  .....
```

Running heroku in the command prompt should give you the heroku version, node version and
list of all commands

To get all the apps you have on heroku run

```
heroku apps --all
```

To get all the addons on heroku

```
heroku addons
```

We need to configure our project before deploying it on heroku, you can look at the whole
process of configuration for deploying our django app on heroku on [heroku documentation](
https://devcenter.heroku.com/categories/working-with-django)

We need requirements.txt file in which all our project dependencies will be reflected and
there are some heroku deployment dependencies which you can look at in our
requirements.txt file, we created everything in virtualenv so we just need to do

```
pip freeze > requirements.txt
git add requirements.txt
git commit -m "create requirements file for our project"
```

**requirements.txt**

```
Django==2.0.7
django-hosts==3.0
django-widget-tweaks==1.4.2
psycopg2==2.7.5
pytz==2018.5
dj-database-url==0.5.0
gunicorn==19.9.0
whitenoise==3.3.1
django-heroku==0.3.1
```

The file for our project should look like this, here whitenoise, gunicorn, dj-database-url,
psycopg2, django-heroku are the requirements for heroku, rest are our kirr project
requirements.


text:
# port-scanner
A simple port scanning utility using Scapy.

## Features
 - ICMP, TCP SYN, and UDP scan support
 - Multiple host scanning
 - Multiple port selection
 - Friendly port names
 - Input file for hostnames
 - Basic HTML Report

## Usage
An example:

    ./scanner.py -S 80,443 www.google.com,<IP_ADDRESS> -o report.html

This runs a TCP SYN scan on ports 80 and 443 on `www.google.com` and `<IP_ADDRESS>`.
A simple HTML report will be written to `report.html`.

Run `./scanner.py --help` for detailed usage.
You may need to run `pip3 install -r requirements.txt` first.

Examples of valid host specifications:
`www.google.com`, `<IP_ADDRESS>/23`, `<IP_ADDRESS>-254`.
Multiple specifications can be provided, separated by commas.

Port ranges like `10-23`, as well as multiple ports, `80,443` are supported.
In addition, "friendly" port names can be provided as well:
`http,https,ftp`.

repository: kupiakos/port-scanner

repo_name: kupiakos/port-scanner


text:
## 1.3.0 / 2023-03-23

### Major changes

Now `--stats.timeout` is deprecated and takes no effect. The exporter now honors `X-Prometheus-Scrape-Timeout-Seconds` header
from Prometheus to determine the timeout. If the header is not set, the exporter will use the default timeout value of 120 seconds.

### Changes

* chore: Update readme about web.config file by @timonwong in https://github.com/timonwong/uwsgi_exporter/pull/65
* feat: Add support to multi-targets by @timonwong in https://github.com/timonwong/uwsgi_exporter/pull/66
* docs: add missing changelog by @timonwong in https://github.com/timonwong/uwsgi_exporter/pull/67
* chore: fail scrape if stats reader cannot be created by @timonwong in https://github.com/timonwong/uwsgi_exporter/pull/69
* feat: reduce sockets in TIME-WAIT state by @timonwong in https://github.com/timonwong/uwsgi_exporter/pull/70

## 1.2.0 / 2023-03-22

* build(deps): Bump github.com/prometheus/client_golang from 1.12.1 to 1.13.0 by @dependabot in https://github.com/timonwong/uwsgi_exporter/pull/47
* build(deps): Bump github.com/prometheus/common from 0.34.0 to 0.37.0 by @dependabot in https://github.com/timonwong/uwsgi_exporter/pull/46
* chore: bump github.com/prometheus/client_model from 0.2.0 to 0.3.0 by @dependabot in https://github.com/timonwong/uwsgi_exporter/pull/49
* Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 by @dependabot in https://github.com/timonwong/uwsgi_exporter/pull/50
* feat: allow disable timeout by @timonwong in https://github.com/timonwong/uwsgi_exporter/pull/61
* feat: Add support for "idle" and "cheap" status by @timonwong in https://github.com/timonwong/uwsgi_exporter/pull/62
* ci: fix build by @timonwong in https://github.com/timonwong/uwsgi_exporter/pull/63
* chore: Use exporter toolkit by @timonwong in https://github.com/timonwong/uwsgi_exporter/pull/64

## 1.1.0 / 2022-08-11

* No other changes, just go version bump.

## 1.0.0 / 2019-12-18

*[CHANGE] Change default value `--collect.cores` to `false` #35

gha_language: Go


text:
# Repository & Commit Explorer for GitHub

Author: Elizabeth Lee<EMAIL_ADDRESS>
## Prerequisite

Ensure you have the recent version of Node.js & NPM installed.

Ensure you have the recent version of [Node.js & NPM](https://nodejs.org/en/download/) installed.

### Recommended

Also, install `yarn` by running

```
npm i -g yarn
```

## Getting Started

Initialize your workspace by running:

```
yarn
```

This app to helps manage movie nominations for the upcoming movies.

## The App

The webpage can search OMDB for movies, and allow the user to save their favourite films they feel should be up for nomination. When they've selected 5 nominees they should be notified they're finished.

The simple to use interface that makes it easy to:
* Search OMDB and display the results (movies only)
* * Add a movie from the search results to our nomination list
* View the list of films already nominated
* Remove a nominee from the nomination list

### Technical requirements

1. Search results should come from OMDB's API (free API key: http://www.omdbapi.com/apikey.aspx).
2. Each search result should list at least its title, year of release and a button to nominate that film.
3. Updates to the search terms should update the result list
4. Movies in search results can be added and removed from the nomination list.
5. If a search result has already been nominated, disable its nominate button.
6. Display a banner when the user has 5 nominations.

## Deployed Application ##

https://dlekwjd347.github.io/Shoppies-Shopify-Challenge/

![alt text](https://github.com/dlekwjd347/Shoppies-Shopify-Challenge/blob/main/public/shopifydemo.gif)


text:
# Raspi-Rollo
Raspberry PI controll of 433MHz roller shutters from Acomax, Rohrmotor24 & Alusel

Webfrontend Python based with a rcswitch-pi c++ backend for sending the codes.
Arduino sketch for finding the codes from your remote. Thanks to IngTimo from Udo's Blog http://physudo.blogspot.de/2013/08/home-automation-mit-dem-arduino-und-433_17.html

You need
- RaspberryPi with Raspian and wiringPi installed
- Python installed with flask (pip install flask)
- 433 MHz sender and receiver
- Arduino Nano or other for reading your remote

repository: marcellanz/Raspi-Rollo

repo_name: marcellanz/Raspi-Rollo


text:
# dreport

dreport is a shell script that uses plugin shell scripts to collect debug
information about the system and package it into a tar.xz archive file.

The phosphor-dump-manager application will automatically run dreport in certain
failure cases, and it can also be run manually by running `dreport` or
`dreport -v`.

## Dump Types

The dump types are defined in [sample.conf](sample.conf):

- core: Triggered by an application core dump
- user: The type when manually called, such as from running `dreport`.
- elog: Triggered when there are specific phosphor-logging event logs.
- checkstop: Triggered on a specific type of host crash.
- ramoops: Triggered when there is a kernel panic.

## Plugins

The plugins are the shell scripts in the [plugins.d](plugins.d) subdirectory.
They can call [provided functions](include.d/functions) to add data to the dump
archive. Each plugin needs a comment line like the following to specify which
dump types should trigger it:

```bash
# config A B
```

- 'A' is a sequence of the dump types from the mapping defined in
  [sample.conf](sample.conf).
- 'B' is a priority determines the order the plugins run in.

For example, the `bmcstate` plugin has:

```bash
# config: 12345 5
```

It will run on dump types 1 (core), 2 (user), 3 (checkstop), 4 (checkstop), and
5 (ramooops) with a priority of 5.

During the bitbake build, the script will be linked into a directory based on
the dump type, with the priority built into the name:

```bash
/usr/share/dreport.d# find /usr/share/dreport.d/ -name *bmcstate
/usr/share/dreport.d/plugins.d/bmcstate
/usr/share/dreport.d/pl_user.d/E5bmcstate
/usr/share/dreport.d/pl_checkstop.d/E5bmcstate
/usr/share/dreport.d/pl_elog.d/E5bmcstate
/usr/share/dreport.d/pl_core.d/E5bmcstate
```

repository: openbmc/phosphor-debug-collector

repo_name: openbmc/phosphor-debug-collector


text:
Build CoreCLR on Windows
========================

These instructions will lead you through building CoreCLR and running a "Hello World" demo on Windows.

Environment
===========

You must install several components to build the CoreCLR and CoreFX repos. These instructions were tested on Windows 7+.

Visual Studio
-------------

Visual Studio must be installed. Supported versions:

- [Visual Studio 2015](https://www.visualstudio.com/downloads/visual-studio-2015-downloads-vs) (Community, Professional, Enterprise)

To debug managed code, ensure you have installed atleast [Visual Studio 2015 Update 3](https://www.visualstudio.com/en-us/news/releasenotes/vs2015-update3-vs).

Make sure that you install "VC++ Tools". By default, they will not be installed.

To build for Arm32, you need to have [Windows SDK for Windows 10](https://developer.microsoft.com/en-us/windows/downloads) installed.

Visual Studio Express is not supported.

CMake
-----

The CoreCLR repo build has been validated using CMake 3.5.2.

- Install [CMake](http://www.cmake.org/download) for Windows.
- Add it to the PATH environment variable.

Python
---------
Python is used in the build system. We are currently using python 2.7.9, although
any recent (2.4+) version of Python should work, including Python 3.
- Install [Python](https://www.python.org/downloads/) for Windows.
- Add it to the PATH environment variable.

PowerShell
----------
PowerShell is used in the build system. Ensure that it is accessible via the PATH environment variable. Typically this is %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\.

Powershell version must be 3.0 or higher. This should be the case for Windows 8 and later builds.
- Windows 7 SP1 can install Powershell version 4 [here](https://www.microsoft.com/en-us/download/details.aspx?id=40855).

Git Setup
---------

Clone the CoreCLR and CoreFX repositories (either upstream or a fork).

```bat
C:\git>git clone https://github.com/dotnet/coreclr
C:\git>git clone https://github.com/dotnet/corefx
```

This guide assumes that you've cloned the CoreCLR and CoreFX repositories into C:\git using the default repo names. If your setup is different, you'll need to pay attention to the commands you run. The guide will always show you the current directory.

The repository is configured to allow Git to make the right decision about handling CRLF. Specifically, if you are working on **Windows**, please ensure that **core.autocrlf** is set to **true**. On **non-Windows** platforms, please set it to **input**.

Demo directory
--------------

In order to keep everything tidy, create a new directory for the files that you will build or acquire.

```bat
c:\git>mkdir \coreclr-demo\runtime
c:\git>mkdir \coreclr-demo\ref
```

Build the Runtime
=================

To build CoreCLR, run `build.cmd` from the root of the coreclr repository. This will do a x64/Debug build of CoreCLR, its native components, mscorlib.dll, and the tests.

	C:\git\coreclr>build -rebuild

	[Lots of build spew]

	Repo successfully built.

	Product binaries are available at C:\git\coreclr\bin\Product\Windows_NT.x64.debug
	Test binaries are available at C:\git\coreclr\bin\tests\Windows_NT.x64.debug

**Note:** To avoid building the tests, pass the 'skiptestbuild' option to build.

**build -?** will list supported parameters.

Check the build output.

- Product binaries will be dropped in `bin\Product\<OS>.<arch>.<flavor>` folder.
- A NuGet package, Microsoft.Dotnet.CoreCLR, will be created under `bin\Product\<OS>.<arch>.<flavor>\.nuget` folder.
- Test binaries will be dropped under `bin\Tests\<OS>.<arch>.<flavor>` folder

You will see several files. The interesting ones are:

- `corerun`: The command line host. This program loads and starts the CoreCLR runtime and passes the managed program you want to run to it.
- `coreclr.dll`:  The CoreCLR runtime itself.
- `mscorlib.dll`: The core managed library for CoreCLR, which contains all of the fundamental data types and functionality.

Copy these files into the demo directory.

```bat
C:\git\coreclr>copy bin\Product\Windows_NT.x64.debug\clrjit.dll \coreclr-demo\runtime
C:\git\coreclr>copy bin\Product\Windows_NT.x64.debug\CoreRun.exe \coreclr-demo\runtime
C:\git\coreclr>copy bin\Product\Windows_NT.x64.debug\coreclr.dll \coreclr-demo\runtime
C:\git\coreclr>copy bin\Product\Windows_NT.x64.debug\mscorlib.dll \coreclr-demo\runtime
C:\git\coreclr>copy bin\Product\Windows_NT.x64.debug\System.Private.CoreLib.dll \coreclr-demo\runtime
```

Build the Framework
===================

Build the framework out of the corefx directory.

	c:\git\corefx>build.cmd

	[Lots of build spew]

    0 Warning(s)
    0 Error(s)
	Time Elapsed 00:03:14.53
	Build Exit Code = 0

It's also possible to add -rebuild to build.cmd to force it to delete the previously built assemblies.

For the purposes of this demo, you need to copy a few required assemblies to the demo folder.

```bat
C:\git\corefx>copy bin\Windows_NT.AnyCPU.Debug\System.Console\System.Console.dll \coreclr-demo\runtime
C:\git\corefx>copy bin\Windows_NT.AnyCPU.Debug\System.Diagnostics.Debug\System.Diagnostics.Debug.dll \coreclr-demo\runtime
C:\git\corefx>copy bin\AnyOS.AnyCPU.Debug\System.IO\System.IO.dll \coreclr-demo\runtime
C:\git\corefx>copy bin\AnyOS.AnyCPU.Debug\System.IO.FileSystem.Primitives\System.IO.FileSystem.Primitives.dll \coreclr-demo\runtime
C:\git\corefx>copy bin\AnyOS.AnyCPU.Debug\System.Runtime\System.Runtime.dll \coreclr-demo\runtime
C:\git\corefx>copy bin\AnyOS.AnyCPU.Debug\System.Runtime.InteropServices\System.Runtime.InteropServices.dll \coreclr-demo\runtime
C:\git\corefx>copy bin\AnyOS.AnyCPU.Debug\System.Text.Encoding\System.Text.Encoding.dll \coreclr-demo\runtime
C:\git\corefx>copy bin\AnyOS.AnyCPU.Debug\System.Text.Encoding.Extensions\System.Text.Encoding.Extensions.dll \coreclr-demo\runtime
C:\git\corefx>copy bin\AnyOS.AnyCPU.Debug\System.Threading\System.Threading.dll \coreclr-demo\runtime
C:\git\corefx>copy bin\AnyOS.AnyCPU.Debug\System.Threading.Tasks\System.Threading.Tasks.dll \coreclr-demo\runtime
```

You also need to copy reference assemblies, which will be used during compilation.

```bat
C:\git\corefx>copy bin\ref\System.Runtime\<IP_ADDRESS>\System.Runtime.dll \coreclr-demo\ref
C:\git\corefx>copy bin\ref\System.Console\<IP_ADDRESS>\System.Console.dll \coreclr-demo\ref
```

Compile the Demo
================

Now you need a Hello World application to run. You can write your own, if you'd like. Here's a very simple one:

```C#
using System;

public class Program
{
    public static void Main()
    {
        Console.WriteLine("Hello, Windows");
        Console.WriteLine("Love from CoreCLR.");
    }
}
```

Personally, I'm partial to the one on corefxlab which will print a picture for you. Download the [corefxlab demo](https://raw.githubusercontent.com/dotnet/corefxlab/master/demos/CoreClrConsoleApplications/HelloWorld/HelloWorld.cs) to `\coreclr-demo`.

Then you just need to build it, with csc, the .NET Framework C# compiler. It may be easier to do this step within the "Developer Command Prompt for VS2015", if csc is not in your path. Because you need to compile the app against the .NET Core surface area, you need to pass references to the contract assemblies you restored using NuGet:

```bat
csc /nostdlib /noconfig /r:ref\System.Runtime.dll /r:ref\System.Console.dll /out:runtime\hello.exe hello.cs
```

Run the demo
============

You're ready to run Hello World! To do that, run corerun, passing the path to the managed exe, plus any arguments. In this case, no arguments are necessary.

```bat
C:\coreclr-demo>cd runtime
C:\coreclr-demo\runtime>CoreRun.exe hello.exe
```

If `CoreRun.exe` fails for some reason, you will see an empty output. To diagnose the issue, you can use `/v` to switch verbose mode on: `CoreRun.exe /v hello.exe`.

Over time, this process will get easier. Thanks for trying out CoreCLR. Feel free to try a more interesting demo.

repository: cybernetics/coreclr

repo_name: cybernetics/coreclr


text:
---
abstract: ' Constraint satisfaction problems (CSPs) and data stream models are two powerful abstractions to capture a wide variety of problems arising in different domains of computer science. Developments in the two communities have mostly occurred independently and with little interaction between them. In this work, we seek to investigate whether bridging the seeming communication gap between the two communities may pave the way to richer fundamental insights. To this end, we focus on two foundational problems: model counting for CSPs and computation of zeroth frequency moments (F0) for data streams.'
authors:
- A. Pavan
- N. V. Vinodchandran
- Arnab Bhattacharyya
- Kuldeep S. Meel
date: 2022-06-01 00:00:00
highlight: true
image_preview: ''
math: true
publication: In *SIGMOD Record*
publication_types:
- '1'
selected: true
title: 'Model Counting Meets Distinct Elements in a Data Stream'
url_pdf: https://doi.org/10.1145/3542700.3542721
---

repository: meelgroup/meelgroup-website

gha_language: TeX

repo_name: meelgroup/meelgroup-website


text:
# Useful List

An incompleate list of things I've found useful also basically a notepad to keep track of links.

## C++

### Tools

- [openFrameworks](https://github.com/openframeworks/openFrameworks) - [site](https://openframeworks.cc/) - [docs](https://openframeworks.cc/documentation/)
  - [ofBook](https://openframeworks.cc/ofBook/chapters/foreword.html) an free online book
  - [Forum](https://forum.openframeworks.cc/)
  - [Lewis Lepton's YouTube Tutorial Series](https://www.youtube.com/playlist?list=PL4neAtv21WOlqpDzGqbGM_WN2hc5ZaVv7)
  - [Lewis Lepton's Old 2015 YouTube Tutorial Series](https://www.youtube.com/playlist?list=PL4neAtv21WOmrV8z9rSzL20QpdLU1zJLr)
- [Cinder](https://github.com/cinder/Cinder) - [site](https://www.libcinder.org/) - [docs](https://libcinder.org/docs/)

### Learning

- [The Cherno C++ YouTube Series](https://www.youtube.com/playlist?list=PLlrATfBNZ98dudnM48yfGUldqGD0S4FFb)

## JavaScript / TypeScript

- [p5.js](https://github.com/processing/p5.js) - [site](https://p5js.org/) - [docs](https://p5js.org/reference/)
- [CCapture.js](https://github.com/spite/ccapture.js/)

### Tutorials

- [Creating videos from Processing's p5.js with CCapture.js and ffmpeg](https://peterbeshai.com/blog/2018-10-28-p5js-ccapture/)

## Command Line Tools

- [ffmpeg](https://ffmpeg.org/) almost all things video
- [ImageMagick](https://imagemagick.org/) aka convert - Great for making gifs out of image sequences.

## Misc Tools

- [Strike](https://strike.amorphic.space/) a 1 bit browser based paint program. | [Video about it](https://youtu.be/IotoOMkC_Ic)

## Hardware

- Midi Controllers
  - Novation Launch Control (discontinued)
    - [ofxLaunchControllers](https://github.com/npisanti/ofxLaunchControllers) by Nicola Pisanti
- Kinect
  - Kinect V1
  - Kinect V2
- [Leap Motion](https://www.ultraleap.com/product/leap-motion-controller/)
  - [Leap Motion Processing](https://github.com/nok/leap-motion-processing)
- [AxiDraw](https://www.axidraw.com/)

## Projects

### Collaboration

- [Processing Day Community Clouds](https://github.com/CodingTrain/CommunityClouds) by The Coding Train / Daniel Shiffman

### Teaching

- [Peer-to-Peer Folder Poetry](https://github.com/melaniehoff/Peer-to-Peer-Folder-Poetry) by Melanie Hoff
- [Recreating The Past 2020](https://github.com/ofZach/RTP_SFPC_SUMMER20) by Zach Lieberman

### Non-Computing Computing

- [Weird Faces](https://www.mokafolio.de/works/Weird-Faces) by Matthias Dörfelt

### Textiles

- [Fragmented Memory](https://phillipstearns.wordpress.com/fragmented-memory/) by Phillip Stearns

## Articles

- [What Screens Want](https://frankchimero.com/blog/2013/what-screens-want/) by Frank Chimero

### Accessibility & Coding

- [Dyslexia and Coding](https://datacarpentry.org/blog/2017/09/coding-and-dyslexia) by Joanna Leng
- [Embracing Dyslexia As A Software Engineer](https://medium.com/helpful-human/embracing-dyslexia-as-a-software-engineer-86419a94bd94) by Josh Brunner
- [The Dyslexic Programmer](https://blog.bethcodes.com/the-dyslexic-programmer) by Beth Andres-Beck

## To Read

Stuff I indend on reading but am unlikely to do in any timely fasion.

- [Beautifully Animate Points with WebGL and regl](https://peterbeshai.com/blog/2017-05-26-beautifully-animate-points-with-webgl-and-regl/)
- [New-Media Artists are the Unpaid R&D of Ad Agencies](http://www.flong.com/blog/2012/new-media-artists-are-the-unpaid-research-division-of-ad-agencies/) by Golan Levin

## Interesting Stuff
- https://getrad.co/

## 2.5D Animation

- [Blender](https://www.blender.org/) Grease Pencil
- [Doodle Studio 95](https://fernandoramallo.itch.io/doodle-studio-95) by Fernando Ramallo

### Tutorials

- [Blender 2D/3D for beginners, drawing and animating with greasepencil](https://www.youtube.com/watch?v=c57qq2nE3B0) by Dedouze

## Adobe Suite

### Illustrator Scripts

- [MultiExporter](https://gist.github.com/TomByrne/7816376) by Matthew Ericson & Tom Byrne

license: Unlicense

repository: shiffman/delete-this

repo_name: shiffman/delete-this


text:
# steamworks-lockstep
Gamemaker sample project that combines SteamWorks with Lockstep

This project fuses together the excellent [Steamworks.gml](https://github.com/YellowAfterlife/steamworks.gml) with [Lockstep](https://meseta.itch.io/lockstep) to achieve online multiplayer that runs perfectly in sync.
It's well suited to games that can tolerate higher latency such as strategy games.

You will need the [Steamworks SDK](https://partner.steamgames.com/doc/sdk) installed in order to run.
This is alpha status so expect some bugs.

Attributions
* Steamworks.gml by YellowAfterlife
* Lockstep by Meseta
* Input-Dog by Messhof

repository: adamjimenez/steamworks-lockstep

repo_name: adamjimenez/steamworks-lockstep


text:
# [DEPRECATED] nginx-uwsgi-django-react
A multi container setup for a nginx-uwsgi-django deployment
*This repositiory is not actively developed anymore*

### Requirements
- Docker and Docker Compose
  - *`Docker version 18.05.0-ce` was used in building this repository*
  - *After being installed, Docker might require root privileges to run*
- Python3 and pip3
  - *Some distributions don't bundle pip3 with their python3 so ensure you have it by running `pip3 --version`*
- npm
- git

### How to deploy your application
  While it's not required for this repository, it's recommended to create a virtual environment so packages installed from here don't interfere with your system packages. That, and installing npm, pip, git and modifying system configuration so Docker does not run as root (as is good practice) are out of the scope of this exercise, so I won't go into how to do any of that.

Clone this repository to your desired work directory on your machine with
```
git clone https://github.com/sudomann/nginx-uwsgi-django-react.git
```
Then move into the right directory
```
cd nginx-uwsgi-django-react/app/djangoproject
```

### Integrating React, Webpack, and Django
We won't be directly writing webpack configuration ourselves though, we will use `create-react-app` to generate the project boilerplate with all the configurations in it. Think of `create-react-app` as `django-admin startproject` command you used to initialize you django project.

For this, first we will install `create-react-app` sytem-wide using `npm`. Because we are installing system-wide, we will need superuser permissions.
```
sudo npm install -g create-react-app
```

Now we create a react application and then `eject` so we can edit the config files.
If you want, you can name your react project something else other than `frontend`, but wherever you see `frontend` from now on, you'll have to replace it with whatever name you chose
```
create-react-app frontend
cd frontend
npm run eject
```
Now check to confirm the following file structure is in place:
```
.
├── config
│   ├── env.js
│   ├── jest
│   │   ├── cssTransform.js
│   │   └── fileTransform.js
│   ├── paths.js
│   ├── polyfills.js
│   ├── webpack.config.dev.js
│   ├── webpack.config.prod.js
│   └── webpackDevServer.config.js
├── package.json
├── public
│   ├── favicon.ico
│   ├── index.html
│   └── manifest.json
├── README.md
├── scripts
│   ├── build.js
│   ├── start.js
│   └── test.js
└── src
    ├── App.css
    ├── App.js
    ├── App.test.js
    ├── index.css
    ├── index.js
    ├── logo.svg
    └── registerServiceWorker.js
```

Now test to see if it works by running `npm run start`
A browser should be launched, and a default page shown at http://localhost:3000
![alt text](http://v1k45.com/images/modern-django-1-react-welcome.png "create-react-app default page")
"This development server has hot loading enabled by default. This means any changes you do in you source files will be instantly reflected in the browser without you having to refresh the page manually again and again."
Leave it running.

If you need to, open a new terminal, and go into the `frontend` folder and run
```
npm install webpack-bundle-tracker --save-dev
```
This installs a plugin that generates a file that Django uses in rendering the react page.

Now, we will be making some react configuration changes for it to work with Django.
*Anytime you're unsure of where to make an edit, consult the `reference` folder at the root of this repository. CTRL-f is your friend :)*

Now, in your `frontend/config/paths.js` add the following key and value in the module.exports object.
```
module.exports = {
  // ... other values
  statsRoot: resolveApp('../'),
}
```
In `frontend/config/webpack.config.dev.js` change `publicPath` and `publicUrl` to http://localhost:3000/ as shown below:
```
const publicPath = 'http://localhost:3000/';
const publicUrl = 'http://localhost:3000/';
```
In the same file, import `webpack-bundle-tracker` and include `BundleTracker` in webpack `plugins` and replace `webpackHotDevClient` line with the other two modules (they are commented out by default.
```
const BundleTracker = require('webpack-bundle-tracker');

module.exports = {
  entry: [
    // ... KEEP OTHER VALUES
    // this will be found near line 30 of the file
    require.resolve('webpack-dev-server/client') + '?http://localhost:3000',
    require.resolve('webpack/hot/dev-server'),
    // require.resolve('react-dev-utils/webpackHotDevClient'),
  ],
  plugins: [
    // this will be found near line 215-220 of the file.
    // ... other plugins
    new BundleTracker({path: paths.statsRoot, filename: 'webpack-stats.dev.json'}),
  ],
}
```

"The reason of replacing `webpackHotDevClient`, `publicPath` and `publicUrl` is that we are going to serve webpack dev server's bundle on a Django page, and we don't want webpack hot loader to send requests to wrong url/host.

Now in `frontend/config/webpackDevServer.config.js` we need to allow the server to accept requests from external origins. http://127.0.01:8000 (Django server) will send XHR requests to http://localhost:3000 webpack server to check for source file changes.

Put `headers` object seen below in the object returned by the `exported` function. This object is to be placed at the same level of `https` and `host` properties."
```
headers: {
  'Access-Control-Allow-Origin': '*'
},
```

Remember doing `npm run start` and leaving it running? Stop that server, and run it again. Then, using another shell if you need to, go back into the directory where `manage.py` is located, and run `python3 manage.py runserver` you should see the same react welcome page as you did after running `npm run start`.

Now, any changes you do in `src/App.js` file will be instantly reflected on the opened page in browser through hot loading.
Replace whatever is in the `App.js` file with the following and save. You can parts of the text and save, and see how it's immediately updated in the browser.
```
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';

class App extends Component {
  render() {
    return (
      <div className="App">
        <header className="App-header">
          <img src={logo} className="App-logo" alt="logo" />
          <h1 className="App-title">Welcome to My Django-React App!</h1>
        </header>
        <p className="App-intro">
            A react app with django as a backend.
        </p>
      </div>
    );
  }
}

export default App;
```

### Production configuration
Remember "... the Django server will send XHR requests to http://localhost:3000 webpack server to check for source file changes..."?
Well this works so far because when the browser loads the template, it checks for the necessary .js and .css files on the current machine. That's a problem in production, because it means in a browser, your template would be trying to load js and css files from the machine of users who loaded your site. This is only ideal for development, so we're gonna change that.

Notice the directory `assets/bundles/` in Django's base directory. This directory will store all our static assets. The `bundles` sub-directory will be used as build target; Webpack will save all the build files to `assets/bundles/`.
We make this change by modifying webpack's build output dir to `assets/bundles`. In `frontend/config/paths.js` change the `appBuild` value as shown below:
```
// config after eject: we're in ./config/
module.exports = {
  // .. KEEP OTHER VALUES
  appBuild: resolveApp('../assets/bundles/'),
};
```

Now in `frontend/config/webpack.config.prod.js` make the following changes. Some of these will have to be added, others already exist, and will simply need to be modified. Consult the `reference` folder at the root of this repository if you need to, and CTRL-f is your friend :D
```
const BundleTracker = require('webpack-bundle-tracker');

const publicPath = "/static/bundles/";

const cssFilename = 'css/[name].[contenthash:8].css';

module.exports = {
  // KEEP OTHER VALUES
  output: {
    // NEAR LINE 67

    // Generated JS file names (with nested folders).
    // There will be one main bundle, and one file per asynchronous chunk.
    // We don't currently advertise code splitting but Webpack supports it.
    filename: 'js/[name].[chunkhash:8].js',
    chunkFilename: 'js/[name].[chunkhash:8].chunk.js',
  },
  module: {
    // .. KEEP OTHER VALUES, ONLY UPDATE THE FOLLOWING VALUES
    rules: [
      {
        oneOf: [
          // LINE 140
          {
            options: {
              limit: 10000,
              name: 'media/[name].[hash:8].[ext]',
            },
          },
          {
            // LINE 220
            options: {
              name: 'media/[name].[hash:8].[ext]',
            },
          },
        ],
      },
    ],
  },
  plugins: [
    // KEEP OTHER VALUES
    // LINE 320
    new BundleTracker({path: paths.statsRoot, filename: 'webpack-stats.prod.json'}),
  ],
}
```
Here we configured webpack to set `static/bundles/` as `publicPath` because the build files will be stored in `assets/bundles` and `/static/` url (in Django settings) points to the `assets` directory. We also remove static prefixes from filenames and path to prevent unnecessary nesting of build files.

This configures webpack to build all files' directories into `assets/bundles` without creating an additional `static` directory in it.

After saving the the modified `webpack.config.prod.js` file, we can build the project files using the following command:
```
npm run build
```

This will create bunch of files in `assets/bundles` and a `webpack-stats.prod.json` file right outside your `frontend` react project folder (in Django's base directory).

To check if everything was setup properly, we can run Django's development server using production settings with webpack server stopped (remember `npm run start`? stop that server).
```
python manage.py runserver --settings=djangoproject.settings.prod
```

If you check http://<IP_ADDRESS>:8000/, you'll see the same page which was rendered when webpack server was running. If you check the source code of the webpage, you'll see the js files are now being served directly through Django and not webpack (the browser looking for the `.js` and `.css` files at `localhost`).

### Important Points
It is better to `build` on your CI server or your deployment server instead of including in version control or source code.

In your development sure to run `python3 manage.py collectstatic` after you build the js files, otherwise your webserver (NGINX, Apache, etc) might not find the build files.

Make sure your build generates a `webpack-stats.prod.json` file. If you are deploy by building the files manually, make sure you also include it when you're copying files from your machine to server.

All the directory and file names specified above are not enforced in any sense. Feel free to change the directory location or file names to your liking, but make sure all config files are properly updated.

Docker-compose files are already configured and ready to with this. Showing how to use docker-compose is out of the scope of this exercise. Docker has extensive reference and documentation at https://docs.docker.com/compose/compose-file/. See the the `.yml` files at the root of this repository to learn more about how to deploy in various environments.

WARNING: In the current state of their configuration, processes in the alpine based containers run with higher privileges than they need. Consider adding users and performing whatever other changes necessary to abide to the [principle of least privilege](https://en.wikipedia.org/wiki/Principle_of_least_privilege).

Please see http://v1k45.com/blog/modern-django-part-1-setting-up-django-and-react/ for a little more insightful explanation of this react configuration, and subsequent tutorials to extend the functionality of your project.

repository: sudomann/nginx-uwsgi-django-react

repo_name: sudomann/nginx-uwsgi-django-react


text:
# create-exnode-app [![NPM version](https://img.shields.io/npm/v/create-exnode-app)](https://www.npmjs.com/package/create-exnode-app) [![NPM Downloads](https://img.shields.io/npm/dt/create-exnode-app.svg)](https://www.npmjs.com/create-exnode-app) [![Gitter](https://badges.gitter.im/SharozTanveer/community.svg)](https://gitter.im/SharozTanveer/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-green.svg)](https://github.com/ShahrozTanveer/create-exnode-app/blob/master/CONTRIBUTING.md)

Please consider following this project's author, [Sharoz Tanveer](https://github.com/ShahrozTanveer), and consider starring the project to show your :heart: and support.

Create Express apps with no build configuration.

- Set up a Express(Javascript or Typescript) app by running one command.

## Quick start

```sh
npx create-exnode-app
cd myapp
npm start

# or
npm install -g create-exnode-app
create-exnode-app
cd myapp
npm start
```

Inside the newly created project, you can run some built-in commands:

### `npm start` or `yarn start`

Runs the app in production mode.

Open [http://localhost:5000](http://localhost:5000) to view it in the browser.

### `npm run dev` or `yarn dev`

Runs the app in development mode.

Open [http://localhost:5000](http://localhost:5000) to view it in the browser.

The Server will automatically restart if you make changes to the code.

### Author

**Sharoz Tanveer**

- [LinkedIn Profile](https://www.linkedin.com/in/sharoztanveer/)
- [GitHub Profile](https://github.com/ShahrozTanveer)
- [Twitter Profile](https://twitter.com/saadtanveer3121)

### License

Copyright © 2020, [Sharoz Tanveer](https://github.com/ShahrozTanveer).
Released under the [MIT License](LICENSE).

---

Contributions are welcomed! :octocat: :heart:

Made with :heart: in Javascript

repository: ShahrozTanveer/create-exnode-app

repo_name: ShahrozTanveer/create-exnode-app


text:
---
layout: relation
title: 'advcl:periph'
shortdef: 'peripheric adverbial clause modifier'
udver: '2'
---

This document is a placeholder for the language specific documentation for the `advcl:periph` relation.

repository: PhyloStar/UDTelugu

repo_name: PhyloStar/UDTelugu