text:
# Change Log

## 1.5.10 (Aug 11, 2023)

* bug fix - Fix a bug which will cause failed. See [#293](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/293)
* enhancement - Add support for Use "CamelHumps" words. See [#300](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/300)
* enhancement - Keyboard layout-independent bindings. See [#305](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/305)

## 1.5.9 (Apr 4, 2023)

* enhancement - keybindings of jupyter notebook. See [#281](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/281)

## 1.5.8 (Apr 2, 2023)

* enhancement - Include the full set of VS Code "format document" commands. See [#288](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/288)
* enhancement - keybindings of jupyter notebook. See [#281](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/281)

## 1.5.7 (Mar 12, 2023)

* bug fix - Go Back collides with Outdent Line. See [#285](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/285)

## 1.5.6 (Mar 11, 2023)

* bug fix - Go Back collides with Outdent Line. See [#285](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/285)

## 1.5.5 (Jan 4, 2023)

* enhancement - feat: declare the plugin as a UI extension. See [#280](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/280)
* enhancement - Fix typo "keybindngs" to "keybindings". See [#282](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/282)

## 1.5.4 (Oct 15, 2022)

* bug fix - Reformat document "ctrl + alt + l" is not working. See [#276](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/276), [#278](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/278)

## 1.5.3 (Sep 19, 2022)

* bug fix - No code actions for 'source.overrideMethods' available. See [#266](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/266)
* enhancement - Go to super-method / super-class Ctrl + U. See [#251](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/251)
* bug fix - Ctrl keys in terminal should pass to shell. See [#250](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/250)
* bug fix - Reformat selected code is not work. See [#248](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/248)

## 1.5.2 (Jul 28, 2022)

* enhancement - Add support for the find in folder alternative command. See [#267](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/267)
* enhancement - Add Dart version of Go to super-method/super-class (ctrl+u). See [#269](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/269)

## 1.5.1 (May 19, 2022)

* enhancement - alt+insert should have proper commands for different components. See [#252](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/252)
* enhancement - Support restore default layout. See [#255](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/255)
* bug fix - fix column selection mode. See [#256](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/256)
* enhancement - Support compare files. [#257](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/257)
* enhancement - Support Refactor This.... [#259](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/259)
* enhancement - Support Extract Field. [#260](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/260)
* enhancement - Support extract constant. [#261](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/261)
* enhancement - Support stop when debugging. [#262](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/262)
* enhancement - Fix view breakpoints. [#263](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/263)
* enhancement - Support Go to Test. [#264](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/264)

## 1.5.0 (Oct 30, 2021)

* enhancement - Add support for Visual Studio Web. See [#238](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/238)
* enhancement - Add merge-conflict. See [#235](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/235)

## 1.4.5 (Jun 10, 2021)

* enhancement - add keymap for Move. See [#228](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/228)
* enhancement - add keymap for type hierarchy. See [#227](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/227)
* enhancement - add shortcut to optimize imports. See [#226](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/226)
* enhancement - add shortcut to override/implement methods. See [#225](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/225)
* enhancement - Add keymap for call hierarchy. See [#222](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/222)
* enhancement - Adding the keymap keyword to package.json. See [#220](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/220)
* enhancement - Update the shift shift 'Search Anywhere' command to call quickOpen. See [#218](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/218)

## 1.4.4 (Apr 3, 2021)

* enhancement - fixes Ctrl/Cmd+Shift+F due to change in VSCode. See [#216](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/216)

## 1.4.3 (Mar 18, 2021)

* bug fix - ctrl+e or cmd+e : Recent files popup. See [#213](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/213#issuecomment-801546096)

## 1.4.2 (Mar 14, 2021)

* bug fix - Ctrl + Enter started to conflict with git commit after v1.4.0. See [#212](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/212)

## 1.4.1 (Mar 14, 2021)

* bug fix - ctrl+e or cmd+e : Recent files popup. See [#213](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/213)

## 1.4.0 (Mar 5, 2021)

* enhancement - shortcut for search everywhere is not working. See [#170](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/170)
* enhancement - Export tutorial outdated. See [#208](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/208)
* bug fix - Go to Symbol in Editor... - Ctrl+F12 keybinding is not working anymore in markdown files. See [#211](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/211)

## 1.3.0 (Jan 30, 2021)

* bug fix - [bug report] revertselectedRanges should work outside of diffEditor. See [#205](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/205)
* enhancement - Keymap for completion. See [#183](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/189)

## 1.2.2 (Jan 30, 2021)

* bug fix - Unable to import keybindings. See [#203](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/203)

## 1.2.1 (Jan 28, 2021)

* bug fix - Fresh install could not find an import command. See [#201](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/201)

## 1.2.0 (Jan 28, 2021)

* enhancement - IntelliJ Importer for Linux. See [#200](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/200)
* enhancement - Improve pickers.

## 1.1.0 (Jan 26, 2021)

* enhancement - Add option to use windows keymap on MacOS. See [#67](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/67)

## 1.0.1 (Jan 24, 2021)

* bug fix - Add basic keymaps to Importer. See [#195](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/195)
* bug fix - Repeated custom keymaps has been generated. See [#197](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/197)
* bug fix - Windows not works. See [#197](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/197)

## 1.0.0 (Jan 23, 2021)

* enhancement - is it possible to import myown custom keymap from Intellij Idea to vscode?. See [#120](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/120)

## 0.2.41 (Jun 3, 2020)

* bug fix - keybinding for comment/uncomment with block comment is incorrect. See [#183](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/183)

## 0.2.40 (May 19, 2020)

* enhancement - Binding "Change All Occurences" to Shift+F6. See [#180](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/180)

## 0.2.40 (May 19, 2020)

* enhancement - Binding "Change All Occurences" to Shift+F6. See [#180](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/180)

## 0.2.39 (May 11, 2020)

* enhancement - Add column selection shortcut. See [#178](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/178)

## 0.2.38 (Mar 26, 2020)

* enhancement - run previous Go test. See [#171](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/171)

## 0.2.37 (Nov 9, 2019)

* enhancement - Change Cmd+D from "editor.action.copyLinesDownAction" to new "editor.action.duplicateSelection". See [#157](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/157)
* bug fix - Paste Command not found. See [163](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/163)

## 0.2.36 (Oct 22, 2019)

* bug fix - Ctrl+D doesn't work for duplicate selection. See [#161](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/161)

## 0.2.35 (Oct 22, 2019)

* enhancement - ctrl + home mapping for macOS. See [#149](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/149)
* enhancement - [navigation] cursorTop + cursorBottom. See [#154](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/154)
* enhancement - Change Cmd+D from "editor.action.copyLinesDownAction" to new "editor.action.duplicateSelection". See [#157](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/157)

## 0.2.34 (July 9, 2019)

* bug fix - ctrl+f has no "when" so always searches in editor, so finding in terminal / webview is clobbered. See [#153](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/153)
* enhancement - Missing command - Expand recursively. See [#152](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/152)

## 0.2.33 (June 15, 2019)

* enhancement - New Binding Request: (VS Code)`Revert Selected Range` can be mapped to `Revert...`(Intellij). See [#145](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/145)
* enhancement - New Binding Request: `Structure`(⌘7) can be ported by making use of `Focus on outline view`. See [#146](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/146)
* bug fix - Native shortcut sequences beginning with ctrl+k clash with IntelliJ ctrl+k commit command. See [#150](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/150)

## 0.2.32 (May 20, 2019)

* enhancement - Revert uncommitted changes shortcut. See [#144](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/144)
* Update dependencies

## 0.2.31 (Jan 15, 2019)

* enhancement - Updated "VCS quick popup". See [#141](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/141)

## 0.2.30 (Dec 10, 2018)

* enhancement - better mapping for `Find All References` and `List All References` commands. See [#136](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/136)
* enhancement - `Copy File Path` should be added. See [#137](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/137)

## 0.2.29 (Nov 17, 2018)

* bug fix - Fix cmd+n not opening new untitled file. See [#134](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/134)
* bug fix - navigateToLastEditLocation not released. See [#135](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/135)

## 0.2.28 (Oct 27, 2018)

* enhancement - Enables 'navigate to last edit' shortcut. See [#131](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/131)
* bug fix - Generating getters/setters/constructors on mac. See [#130](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/130)

## 0.2.27 (Oct 1, 2018)

* enhancement - Alt Home hotkey for focusing the breadcrumbs. See [#128](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/128)

## 0.2.26 (Sep 11, 2018)

* bug fix - Removed triggerSuggest keybinding. See [#124](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/124)

## 0.2.25 (Sep 1, 2018)

* bug fix - Fixed triggerSuggest condition. See [#122](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/122)

## 0.2.24 (Jun 17, 2018)

* bug fix - Git sync keybinding does not work. See [#115](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/115)

## 0.2.23 (Apr 22, 2018)

* enhancement - Add refactor keybindings for extract method and extract constant. See [#112](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/112)
* enhancement - Added support for move line up & move line down. See [#113](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/113)

## 0.2.22 (Mar 25, 2018)

* enhancement - Go to next error and previous error. See [#111](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/111)

## 0.2.21 (Feb 17, 2018)

* bug fix - Fix terminal focus. See [#108](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/108)
* enhancement - Added jsbeautifier config

## 0.2.20 (Feb 4, 2018)

* enhancement - Open Highlighted File (Explorer). See [#107](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/107)

## 0.2.19 (Feb 1, 2018)

* enhancement - Implement ctrl+shift+k shortcut for the git.pushTo command. See [#104](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/104)
* enhancement - ctrl+opt+shift + ↑ ↓ can be mapped on VSCode #102. See [#102](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/102)

## 0.2.18 (Dec 28, 2017)

* enhancement - navigate between editor group could be mapped to option/alt + tab. See [#101](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/101)

## 0.2.17 (Dec 20, 2017)

* bug fix - Cmd+E opens Recent Projects popup instead of current project's Recent Files. See [#97](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/97)

## 0.2.16 (Nov 1, 2017)

* bug fix - fix cmd+k commit shortcut. See [#93](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/93)

## 0.2.15 (Oct 7, 2017)

* bug fix - Wrong Mac shortcuts to move lines/statements up/down. See [#90](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/90)

## 0.2.14 (Sep 22, 2017)

* bug fix - send `ctrl+d` to terminal on mac. See [#88](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/88)
* bug fix - cmd+k in integrated terminal should clear terminal. See [#85](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/85)

## 0.2.13 (Aug 9, 2017)

* enhancement - Updated mapping as per https://github.com/Microsoft/vscode/issues/28383. See [#81](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/81).

## 0.2.12 (Jun 10, 2017)

* enhancement - Add support for Goto Implementation. See [#77](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/77).
* bug fix - Start debug doesn't work.

## 0.2.11 (Jun 1, 2017)

* enhancement - “find in files” shortcut doesn't works. See [#54](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/54).

## 0.2.10 (March 3, 2017)

* enhancement - Navigate Backward. See [#63](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/63).
* enhancement - Add secondary keymaps.

## 0.2.9 (February 25, 2017)

* enhancement - Added IntelliJ products to package.json. See [#60](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/60).
* enhancement - Added JetBrains products to README. See [#61](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/61).
* enhancement - Update icon from png to svg.
* enhancement - new file keybinding. See [#59](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/59).

## 0.2.8 (January 30, 2017)

* bug fix - Map to new shortcuts for new features in vscode insiders. See [#50](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/50).
* bug fix - `cmd+5` open debug window doesn't work.
* enhancement - add terminal focusPrevious and terminal focusNext. See [#58](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/58).

## 0.2.7 (December 14, 2016)

* enhancement - Map to new shortcuts for new features in vscode insiders. See [#50](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/50).
* bug fix - Update package.json with a compatible engine. See [#51](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/51).
* bug fix - Installing from VS Code Marketplace installs version 0.1.1 instead of latest (0.2.6). See [#53](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/53).

## 0.2.6 (December 6, 2016)

* enhancement - ctrl+q should be bound to show hover. See [#46](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/46).
* enhancement - ctrl+q should be bound to show hover. See [#46](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/46).

## 0.2.5 (December 1, 2016)

* enhancement - shift+esc can be mapped to ctrl+j. See [#40](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/40).

## 0.2.4 (November 30, 2016)

* enhancement - Ctrl+Shift+Numpad (- and +) should perform "Fold all" & "Expand all". See [#38](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/38).
* enhancement - ctrl+f12 should do what ctrl+shift+o does by default. See [#39](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/39).
* enhancement - shift+esc can be mapped to ctrl+j. See [#40](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/40).

## 0.2.3 (November 29, 2016)

* enhancement - alt+1 should toggle close corresponding tool window instead of just opening. See [#36](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/36).

## 0.2.2 (November 24, 2016)

* bug fix - My Ctrl + Delete and Ctrl + Backspace shortcuts are inverted. See [#34](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/34).

## 0.2.1 (November 17, 2016)
* enhancement - Add 'Delete Line' command. See [#31](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/31).
* enhancement - Add VS Code Marketplace batch.
* bug fix - fix README version

## 0.2.0 (November 17, 2016)
* enhancement - Add new key commands. See [#26](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/26).
* enhancement - Add CHANGELOG.md.
* bug fix - Issue with Updating Extension and Versions. See [#27](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/27).

## 0.1.10 (November 7, 2016)
* enhancement - add editorReadonly.
* enhancement - add travis ci cache.
* bug fix - Ctrl+Alt+L Not Formatting XML Documents. See [#23](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/23).
* bug fix - fix of extension name in README.md. See [#24](https://github.com/kasecato/vscode-intellij-idea-keybindings/pull/24).

## 0.1.9 (November 3, 2016)
* enhancement - update VS Code Market Category from Other to Keymaps.

## 0.1.8 (October 31, 2016)
* bug fix - Support fort start new line before. See [#19](https://github.com/kasecato/vscode-intellij-idea-keybindings/issues/19).

## 0.1.7 (October 27, 2016)

## 0.1.6 (September 17, 2016)

## 0.1.5 (August 6, 2016)

## 0.1.4 (July 16, 2016)

## 0.1.3 (July 12, 2016)

## 0.1.2 (May 14, 2016)

## 0.1.1 (April 5, 2016)

gha_language: TypeScript


text:
---
title: 'Using quadratic programming to solve L1-norm regularization'
output: html_document
fontsize: 12pt
published: true
status: publish
mathjax: true
---

When doing regression modeling, one will often want to use some sort of regularization to penalize model complexity, for reasons that I have discussed in [many](http://www.erikdrysdale.com/cirdna/) [other]((https://erikdrysdale.github.io/ridge/)) [posts](https://erikdrysdale.github.io/ml_causal/). In the case of a linear regression, a popular choice is to penalize the L1-norm (sum of absolute values) of the coefficient weights, as this results in the [LASSO](https://en.wikipedia.org/wiki/Lasso_(statistics)) estimator which has the attractive property that many of the (low-correlation) features are given zero weight[[^1]].

The LASSO estimator can be formulated by two equivalent minimization problems: Ivanov regularization \\(\eqref{eq:ivanov}\\) or [Tikhonov](https://en.wikipedia.org/wiki/Tikhonov_regularization) regularization \\(\eqref{eq:tikhonov}\\). The latter transforms a constrained problem into an unconstrained one, and are generally easier to solve. However, formulating the problem with Tikhonov regularization allows for a more interpretable model complexity measure. This short post will review what quadratic programming is, show its relation to the LASSO estimator, and provide the `R` code necessary to solve these problems.

$$\newcommand{\bbeta}{\pmb{\beta}} $$

$$
\begin{align}
\text{Ivanov:} \hspace{1cm} \min_{\bbeta}& \sum_{i=1}^n (y_i - x_i^{T}\bbeta)^2 \hspace{4mm} \text{s.t.} \hspace{3mm} \sum_{j=1}^p |\beta_j| \leq t \tag{1}\label{eq:ivanov} \\
\text{Tikhonov:} \hspace{1cm} \min_{\bbeta}& (\textbf{y}-\textbf{X}\bbeta)^T(\textbf{y}-\textbf{X}\bbeta) + \lambda\sum_{j=1}^p |\beta_j|  \tag{2}\label{eq:tikhonov}
\end{align}
$$

## A simple quadratic programming problem

Consider the following problem as shown in equation \\(\eqref{eq:simp}\\). This is an example of a quadratic programming problem (QPP) because there is a quadratic objective function with linear constraints.

$$
\begin{align}
\min_{x_1,x_2,x_3}& x_1^2 + 2x_2^2 + 4x_3^2 - x_1 - x_2 + 5x_3 \tag{3}\label{eq:simp} \\
\text{s.t.}\hspace{2mm}& x_1 + x_3 \leq 1 \nonumber \\
& x_1 \geq 5 \nonumber \\
& x_2 \leq 0 \nonumber
\end{align}
$$

This QPP can be solved in `R` using the `quadprog` library. However, the package requires that the problem be written in the form of:

$$\min_b \frac{1}{2} b^{T}Db - d^{T}b \hspace{1cm} \text{s.t. } A^{T}b \geq b_0 $$

The specific example shown above matches the general form when:

$$
\begin{align*}
b &= (x_1,x_2,x_3)^{T} \\
D &= \begin{pmatrix} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 4 \end{pmatrix} \\
d &= (1,1,-5)^{T} \\
A^{T} &= \begin{pmatrix} -1 & 0 & -1 \\ 1 & 0 & 0 \\ 0 & -1 & 0 \end{pmatrix} \\
b_0 &= (-1,5,0)
\end{align*}
$$

Implementing this if fairly simple:

{% highlight r %}
A <- cbind(c(-1,1,0),c(0,0,-1),c(-1,0,0))
b0 <- c(-1,5,0)
D <- diag(c(1,2,4))
P <- 2*D
d <- c(1,1,-5)
xHat <- solve.QP(Dmat=P,dvec=d,Amat=t(A),bvec=b0)
xHat$solution
{% endhighlight %}

{% highlight text %}
## [1]  5  0 -4
{% endhighlight %}

### QPP and LASSO

The LASSO formulation in equation \\(\eqref{eq:ivanov}\\) is also a QPP, as the residual sum of squares: \\(RSS(b) \propto b^T (X^T X) b - 2y^T X \beta\\) is equivalent to \\(D=2 (X^TX)\\) and \\(d^{T}=2y^TX\\). However, in order to write \\(A\\) there will have to be \\(2^p\\) inequality constraints. For example, when \\(p=2\\), the constraint \\(\|\beta_1\| + \|\beta_2\| \leq t\\) is equivalent to:

$$
\begin{align*}
\beta_1 + \beta_2 &\leq t \\
-\beta_1 + \beta_2 &\leq t \\
\beta_1 - \beta_2 &\leq t \\
-\beta_1 - \beta_2 &\leq t \\
\begin{pmatrix} -1 & -1 \\ 1 & -1 \\ -1 & 1 \\ 1 & 1 \end{pmatrix} &= A \\
(-t,-t,-t,-t)^T &= b_0
\end{align*}
$$

That \\(2^p\\) can quickly get out of hand was well known even to [Ibn Khallikan](https://en.wikipedia.org/wiki/Wheat_and_chessboard_problem). Nevertheless, this QP approach will be demonstrated for the simple `Boston` data set from the `MASS` package, by fitting a LASSO estimator to predict median house prices (`medv`) using the average number of rooms (`rm`) and the distance to employment centers (`dis`) by shrinking the L1-norm of the parameters to half of their unconstrained OLS counterpart.

{% highlight r %}
# Load in the data
X <- as.matrix(boston[,c('rm','dis')]) %>% scale(center=T,scale=F)
y <- as.matrix(boston[,'medv']) %>% scale(center=T,scale=F)
# Find the OLS estimates
ls.beta <- lm(y~-1+X)
t.max <- ls.beta  %>% coef %>% abs %>% sum
# Define the function
lasso.qp <- function(X,y,t) {
  n <- dim(X)[1]
  p <- dim(X)[2]
  D <- t(X) %*% X
  P <- 2*D
  d <- 2 * t(y) %*% X
  A <- as.matrix(expand.grid(rep(list(c(-1,1)),p)))
  b0 <- rep(-t,2^p)
  beta.lasso <- solve.QP(Dmat=P,dvec=d,Amat=t(A),bvec=b0)
  return(beta.lasso$solution)
}
# Run the LASSO for 50% shrinkage
lasso.qp(X=X,y=y,t=0.5*t.max) %>% round(2)
{% endhighlight %}

{% highlight text %}
## [1] 4.36 0.28
{% endhighlight %}

One thing that is nice about Ivanov regularization is that it is much more intuitive that Tikhonov regularization as the constraint term \\(t\\) can be thought of a shrinkage parameter: \\(s=t/t_{\text{OLS}}\\). We can now show the first example of a mapping between the \\(t\\) constraint from equation \\(\eqref{eq:ivanov}\\) and \\(\lambda\\) penalty from equation \\(\eqref{eq:tikhonov}\\). The `glmnet` package can estimate a LASSO for a given \\(\lambda\\).

{% highlight r %}
library(glmnet)
# Run the LASSO
lasso.tikhonov <- glmnet(x=X,y=y,intercept=F,standardize=F,alpha=1,lambda=1)
# Find the implied shrinkage
tikhonov.beta <- lasso.tikhonov %>% coef %>% as.matrix
tikhonov.shrink <- (tikhonov.beta %>% abs %>% sum)/t.max
# Use the lasso.qp function
ivanov.beta <- lasso.qp(X,y,t=tikhonov.shrink*t.max)
data.frame(tikhonov=tikhonov.beta[-1],ivanonv=ivanov.beta) %>%
  set_rownames(c('rm','dis'))
{% endhighlight %}

{% highlight text %}
##      tikhonov   ivanonv
## rm  6.8276126 6.8276126
## dis 0.3980483 0.3980484
{% endhighlight %}

### QP with moderately sized \\(p\\)

In order to scale the quadratic programming problem to a moderate number of features, the `LowRankQP` package can be used. This allows us to use the interior point method to solve quadratic programming problems of the form[[^2]]:

$$
\begin{align*}
\min_x \hspace{3mm} &\frac{1}{2} x^T V V^T x + c^T x \\
&Ax = b \\
&l \preceq x \preceq u
\end{align*}
$$

Using the old trick that \\(q = q^+ - q^-\\) the LASSO minimization problem can be re-written as:

$$
\begin{align*}
\min_{\beta^+,\beta^-} \hspace{3mm} &(\beta^+-\beta^-)^T XX^T  (\beta^+-\beta^-) - 2yX^T (\beta^+-\beta^-) \\
\text{s.t.} \hspace{3mm} &\sum_{j=1}^p (\beta_j^+ - \beta_j^-) \leq t \\
&\beta^+ \succeq 0, \hspace{2mm} \beta^- \succeq 0
\end{align*}
$$

This problem requires only \\(3p\\) constraints rather than \\(2^p\\). The `LowRankQP` package allows for the estimation of matrices that are not strictly positive definite.

$$
\newcommand{\tbeta}{\tilde{\beta}}
\begin{align*}
\min_{\tbeta} \hspace{3mm} &\tbeta^T Q^TXX^T\tbeta - 2yX^TQ\tbeta   \\
\text{s.t.} \hspace{3mm} & -R\tbeta \succeq -s \\
& \tbeta \succeq 0
\end{align*}
$$

Writing the function in `R`:

{% highlight r %}
library(LowRankQP)
lasso.lr <- function(X,y,t) {
  n <- dim(X)[1]
  p <- dim(X)[2]
  Vn <- X %*% cbind (cbind (diag(p), -diag(p)), 0)
  yX = apply(sweep (X, MARGIN=1, -y, '*'), 2, sum)
  Zn = c (2*yX, -2*yX, 0)
  bOls = lm.fit(X, y)$coefficients
  u = c(abs(bOls), abs(bOls), sum(abs(bOls)))
  A = matrix (c(rep (1, 2*p), 1), nrow=1)
  b = c(min(t, sum(abs(bOls))))
  soln = LowRankQP(sqrt(2)*t(Vn), Zn, A, b, u, method="LU",verbose =F)
  return(round(soln$alpha[1:p] - soln$alpha[(p+1):(2*p)], digits=5))
}
{% endhighlight %}

A comparison between the custom function and `glmnet` will be made for well-known `prostate` data set[[^3]], available in the `ElemStatLearn` library.

{% highlight r %}
X <- prostate[,1:8] %>% as.matrix %>% scale(center=T,scale=T)
y <- prostate[,'lpsa'] %>% as.matrix %>% scale(center=T,scale=F)
# Fit for a random lambda with glmnet
prostate.glmnet <- glmnet(x=X,y=y,intercept=F,standardize=F,lambda=0.25)
beta.glmnet <- prostate.glmnet %>% coef %>% as.matrix %>% as.numeric
t.glmnet <- beta.glmnet %>% abs %>% sum
# Get the implied shrinkage
t.max <- lm(y~-1+X) %>% coef %>% abs %>% sum
shrink.glmnet <- t.glmnet/t.max
# Use the lasso.lr function
beta.lr <- lasso.lr(X,y,t=shrink.glmnet*t.max)
{% endhighlight %}

{% highlight text %}
## LowRankQP CONVERGED IN 15 ITERATIONS
##
##     Primal Feasibility    =   3.9920603e-13
##     Dual Feasibility      =   1.1102230e-16
##     Complementarity Value =   9.2018684e-11
##     Duality Gap           =   9.2015284e-11
##     Termination Condition =   1.2965388e-12
{% endhighlight %}

{% highlight r %}
# Compare
rbind(beta.glmnet[-1],beta.lr) %>% data.frame %>%
  set_rownames(c('glmnet','lasso.lr')) %>%
  set_colnames(rownames(coef(prostate.glmnet))[-1]) %>%
  round(5)
{% endhighlight %}

{% highlight text %}
##           lcavol lweight age lbph     svi lcp gleason pgg45
## glmnet   0.51014 0.08699   0    0 0.11259   0       0     0
## lasso.lr 0.51013 0.08699   0    0 0.11260   0       0     0
{% endhighlight %}

The output shows that both approaches yield a very similar estimate. For medium-sized data sets, when performing model selection with cross-validation it is nice to be able to pick a range of \\(t\\)'s from equation \\(\eqref{eq:ivanov}\\) that have a nice interpretation: 10%, 25%, ..., 99% shrinkage of the unregularized least squares estimate. However, quadratic programming will not scale as well to very large data sets and solving the regularization problem in the unconstrained form will necessary.

* * *

[^1]: This is desirable property in that it embeds model selection (picking variables) and results in an interpretable model.

[^2]: For more details see the [course notes for ST-810](http://www.stat.ncsu.edu/people/zhou/courses/st810/notes/lect09QP.pdf).

[^3]: This was the original data set used in Tibshirani's [1996 paper](http://statweb.stanford.edu/~tibs/lasso/lasso.pdf).

license: MIT

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
# Changelog

## 0.3.0

### Breaking changes
`Playbook.stream` has been refactored to include a new `raise_on_failure` parameter.
This is part of a change in behaviour for this method to no longer raise exceptions by default
and stream the entire Playbook execution.

To previous behaviour can be obtained by passing `raise_on_failure: :during`
to the `stream`method i.e.

```ruby
Playbook.stream "some_playbook.yml", raise_on_failure: :during
```

Alternatively, if you'd still like to raise exception for failures, but only after output has finished streaming, you can use:
```ruby
Playbook.stream "some_playbook.yml", raise_on_failure: :after
```

In addition to the breaking changes above,`Playbook.stream` now handles tasks that
are skipped according to Ansible's output.
This should include tasks which have `ignore_errors` set.

repository: pgeraghty/ansible-wrapper-ruby

gha_language: Ruby

gha_license_id: MIT

repo_name: pgeraghty/ansible-wrapper-ruby


text:
---
layout: post
title: "Crafting paper sensors: the embelashed toolkit"
date: 2020-07-31
categories:
  - Hardware
  - Software
  - Education
  - Tutorials
  - Workshops
description: "Introducing the embelashed toolkit for prototyping with paper sensors and Bela Mini."
image: becky-stewart/header.jpg
author: BeckyStewart
---

In this post Becky Stewart introduces the embelashed toolkit for prototyping with paper sensors and Bela Mini – a brilliant way to get started creating interactive projects from traditional craft materials.

# Crafting electronics

Digital crafts are a growing community with roots in both academic research (often found in academic conferences like [DIS](https://programs.sigchi.org/dis/2020/program/session/39147), [TEI](https://tei.acm.org/2020/program/), and [CHI](https://programs.sigchi.org/chi/2020/program/session/36704)) and DIY maker spaces (like the [eTextile Summer Camps](http://etextile-summercamp.org/) and [Spring Break](http://etextilespringbreak.org/) or products such as the [LilyPad](https://store.arduino.cc/lilypad-arduino-main-board), or [Chibitronics](https://store.arduino.cc/lilypad-arduino-main-board)). The exact definition of what constitutes a digital craft project can vary across those sub-communities, but are usually considered to be the combination of electronics and computing with materials often seen in hand-crafts like textiles and paper.

{% include single-image.html fileName="becky-stewart/pressure.gif" caption="Documentation showing how a pressure sensor could be used." %}

A big benefit to working with a material like paper is that is you don't need a lot of specialist knowledge or tools to get going. Everyday household items like scissors and glue along with the construction skills you learned in art class as a small child go a long way. You can very quickly make simple paper circuits - like making an LED light up - but when combined with code and sensors, you can also create sophisticated interactive projects like the work of [Jie Qi](http://technolojie.com/) which combine traditional craft techniques with digital technologies.

{% include youtube.html youtube="C1-pdgGn0SI" %}

However, those coming to electronics and coding for the first time via digital crafts quickly come up against some common barriers. The first is how to get started coding. If you want to make your paper creations interactive, you don't want to have to complete university-level coursework in computer science before making an LED turn on and off with a switch! And then the perhaps less obvious barrier is that there isn't a *normal* way to connect a paper circuit of copper tape or conductive paint to an electronics board like a Bela or Arduino.

To try and solve these problems, or at least make them more manageable, Bela teamed up with a group of researchers at Queen Mary University of London led by [Dr Becky Stewart](http://theleadingzero.com/) (Becky has since moved to Imperial College London). The result was the [embelashed toolkit](http://embelashed.org) for quickly prototyping interactive audio projects.

# The embelashed Toolkit

{% include single-image.html fileName="becky-stewart/pressure-sensors.jpg" caption="Two paper pressure sensors connected to a Bela Paper Capelet." %}

The toolkit consists of four main parts:

- [Paper sensor hardware and tutorials](http://embelashed.org/paper/paper-index.html#) - Downloadable templates that can be printed and cut out to make sensors with tutorials to guide you step-by-step. Plus a Paper Capelet and Pocket Connector system to simplify connecting your paper sensors to a Bela Mini.
- [Pure Data abstractions](http://embelashed.org/code/abstractions-index.html) - to simplify some of the messy part of the Pd language and make some common functions wrapped up and ready to go.
- [Pure Data examples](http://embelashed.org/code/examples-index.html) - a collection of working Pd examples showing how to use the abstractions and also just to give a starting point so you aren't stuck staring at a blank patcher window.

Both the abstractions and examples work with any Bela board and analog or digital sensor. You don't have to use the paper sensors or the Paper Capelet. Equally, you can use the paper sensors and Pocket Connectors with other boards like Arduinos, they aren't Bela-specific.

## More About the Hardware

{% include single-image.html fileName="becky-stewart/paper-switch.jpg" caption="Paper switch sensor." %}

The paper sensors use a variety of techniques. Some like the [button switch](http://embelashed.org/paper/sensors/button-switch.html) use cleverly folded paper with copper tape, while others like the [piezo vibration sensor](http://embelashed.org/paper/sensors/piezo.html) combine off-the-shelf electronics components with a copper tape circuit. You can solder these circuits together or cold-solder with [Bare Conductive Electric Paint](https://www.bareconductive.com/shop/electric-paint-10ml/).

{% include single-image.html fileName="becky-stewart/pocket-connector.jpg" caption="Pocket Connector." %}

To connect the paper sensors to a Bela Mini, the [Paper Capelet](http://embelashed.org/paper/paper-capelet.html) can be  used. It sits on top of the Bela Mini and breaks out four analog and four digital inputs (though only a total of four of either type can be used at the same time). Grove connectors then connect to Pocket Connectors which provide a non-permanent way to hook up a paper sensor.

{% include single-image.html fileName="becky-stewart/velo1_small2.png" caption="Circuit guide for creating the pressure sensor." %}

The Paper Capelet and Pocket Connectors are not going to be Bela products, so you won't be able to buy them in the Bela shop. However, they are open-source hardware and you can [order them directly from OSH Park](https://oshpark.com/shared_projects/EoGQSTLz). You will need to solder them together yourself, but there are instructions to guide you through the process on the [embelashed site](http://embelashed.org/paper/paper-capelet.html).

# Workshops That Shaped the Toolkit

{% include single-image.html fileName="becky-stewart/e-stitches-workshop.jpg" caption="Ideation workshop run at the V&A with e-Stitches London." %}

The research team ran a lot of development workshops to work out the best way to write the code and figure out what sensors were the most useful. Around a dozen workshops were run across the UK and Europe with just under 200 participants.

The most recent workshop was run at [Audio Mostly](https://audiomostly.com/2019/) in September 2019. Participants learned how to make custom sensors and program Bela Minis with Pd in the space of an afternoon.

{% include single-image.html fileName="becky-stewart/audio-mostly-workshop.jpg" caption="Constructing sensors at Audio Mostly 2019." %}

# More To Come

The embelashed project isn't stopping at just working with paper, there will be more materials like textiles coming as well. So keep an eye out on future developments. And in the meantime, let us know what you make with the embelashed toolkit. Tag your posts with `#embelashed` and feel free to reach out to [Becky](mailto:r.stewart@imperial.ac.uk).

{% include single-image.html fileName="becky-stewart/build-instructions.jpg" caption="Build instructions for making a magnetic field sensor." %}

extension: markdown


text:
```
/* techdegree project 9 - REST API                 */
/* April 17, 2019                                  */
/*                                                 */
/* Using Javascript, Express, MongoDB and Mongoose */
/* to create a REST API.                           */
```

* The `seed` folder contains a starting set of data for the database in the form of a JSON file (`data.json`) and a collection of files (`context.js`, `database.js`, and `index.js`) that can be used to create your app's database and populate it with data (we'll explain how to do that below).
* The `nodemon.json` file configures the nodemon Node.js module, which we are using to run your REST API.

## Getting Started

```
First, install the project's dependencies using `npm`.
npm install

Second, start your MongoDB server.
mongod

Third, seed your MongoDB database with data.
npm run seed

Lastly, start the application.
npm start

To test the Express server, browse to the URL [http://localhost:5000/](http://localhost:5000/).
```

repository: sblondell/portfolio

gha_language: JavaScript

repo_name: sblondell/portfolio


text:
# Badgy

# Getting Started

By default your Badgy displays the welcome message when powered on. To upload new firmware, you'll need to first connect it to your WiFi network.

1. Power your Badgy through USB or a rechargeable battery, or both. Make sure the power switch is in the off position (up)

**WARNING: The battery charging IC does not have reverse polarity protection! Check the polarity before inserting the battery, and make sure you are using a high quality Micro-USB cable to avoid potentially burning the IC.**

2. Hold down the center button and slide the power switch on (down). **Note: On older firmware versions it is not necessary to hold down the center button and OTA is on by default**
3. The screen should now update letting you know to connect to the "Badgy AP" network. You can now let go of the center button
4. Using your mobile phone, connect to the "Badgy AP" WiFi network
5. Follow the captive portal instructions to select your desired WiFi connection
6. Once connected, Badgy is ready to receive new firmware! Go to http://*YOUR_IP_ADDRESS*:8888/update to upload your new firmware
7. WiFi credentials are automatically saved onboard, your Badgy will automatically connect to your selected network the next time you perform an update

Check out the examples folders for various Arduino code samples, we're constantly adding more!

repository: smartree/badgy

repo_name: smartree/badgy


text:
Hooks & Plugins
===============

* [Plugins](#plugins)
* [Hooks](#hooks)
  * [Bootstrap Hooks](#bootstrap-hooks)
  * [Runtime Hooks](#runtime-hooks)
  * [Shutdown Hooks](#shutdown-hooks)

Finit can be extended to add general functionality in the form of I/O
monitors, or hook plugins.  It is even possible to run scripts at these
hook points, see below.

The following sections detail existing plugins and hook points.  For
more information, see the plugins listed below.

Plugins
-------

For your convenience a set of *optional* plugins are available:

* *alsa-utils.so*: Restore and save ALSA sound settings on
  startup/shutdown.  _Optional plugin._

* *bootmisc.so*: Setup necessary files and system directories for, e.g.,
  UTMP (tracks logins at boot).  This plugin is central to get a working
  system and runs at `HOOK_BASEFS_UP`.  The `/var`, `/run`, and `/dev`
  file systems must be writable for this plugin to work.

  Note: On an embedded system both `/var` and `/run` can be `tmpfs` RAM
  disks and `/dev` is usually a `devtmpfs`.  This must be defined in the
  `/etc/fstab` file and in the Linux kernel config.

* *dbus.so*: Setup and start system message bus, D-Bus, at boot.
  _Optional plugin._

* *hook-scripts.so*: Trigger the execution of scripts from plugin hook
  points (see [Hooks](#hooks)).  _Optional plugin._

  This plugin is particularly useful for early boot debugging that needs
  to take place before regular services are available.

  For example, say that you want to enable some kernel tracing before
  modules are loaded. With hook scripts, you can just drop in a shell
  script in `/libexec/finit/hook/mount/all/` that will poke the right
  control files in tracefs.

  Scripts are located in `/libexec/finit/hook` by default, this can be
  customized at build-time using the `--with-hook-scripts-path=PATH`
  argument to `configure`.

* *hotplug.so*: Setup and start either udev or mdev hotplug daemon, if
  available.  Enabled by default.

  > See the [Services](config.md#services) section in the configuration
  > guide for an example how to run `mdevd`, alternative to plain mdev.

* *rtc.so*: Restore and save system clock from/to RTC on boot/halt.
  Enabled by default.

* *modules-load.so*: Scans `/etc/modules-load.d/*.conf` for modules to
  load using `modprobe`.  Each file can contain multiple lines with the
  name of the module to load.  Any line starting with the standard UNIX
  comment character, `#`, or `;`, is skipped.

  Modules are by default loaded in runlevel `S` using the `task` stanza.
  Each module gets a unique `name:modprobe.foo`, and optional`:ID`.  The
  runlevel can be changed per file using:

        set runlevel 2345

  The `:ID` is a globally incremented index, which can be disabled per
  file (anywhere) using the following config line:

        set noindex

  To change the index used by the plugin:

        set index 1234

  **Note:** unlike the traditional .conf `module` directive, which load
  any listed module immediately, this plugin creates a background `task`
  which load the module(s) in the background.  The program is modprobe,
  `/sbin/modprobe`, which you can override per .conf file:

        set modprobe /path/to/maybe-a-modprobe-wrapper

  Since these tasks run in the background, they usually return `[ OK ]`
  at boot, unless the modprobe tool does not exist.  Check syslog for
  warnings and the actual status of the operation using `initctl`.

* *netlink.so*: Listens to Linux kernel Netlink events for gateway and
  interfaces.  These events are then sent to the Finit service monitor
  for services that may want to be SIGHUP'ed on new default route or
  interfaces going up/down.  Enabled by default.

* *resolvconf.so*: Setup necessary files for `resolvconf` at startup.
  _Optional plugin._

* *tty.so*: Watches `/dev`, using inotify, for new device nodes (TTY's)
  to start/stop getty consoles on them on demand.  Useful when plugging
  in a usb2serial converter to login to your embedded device.  Enabled
  by default.

* *urandom.so*: Setup random seed at startup.  Enabled by default.

* *x11-common.so*: Setup necessary files for X-Window.  _Optional plugin._

Usually you want to hook into the boot process once, simple hook plugins
like `bootmisc.so` are great for that purpose.  They are called at each
hook point in the boot process, useful to insert some pre-bootstrap
mechanisms, like generating configuration files, restoring HW device
state, etc.  Available hook points are:

Hooks
-----

In the below listings, the first label is the hook point for a C plugin,
the second is the condition name and hook script path.  A hook script is
a plain shell script, or program, that does a very small dedicated job
at the below hook points.

See [Run-parts Scripts](config.md#run-parts-scripts) for details on the
requirements, possibilities, and *limitations* of hook scripts.

All hook scripts are called with at least one environment variable set,
the hook name, useful when reusing the same hook script for multiple
hook points:

  - `FINIT_HOOK_NAME`: set to the second label, e.g., `hook/net/up`
  - `FINIT_SHUTDOWN`: set for `hook/sys/shutdown` and later to one
    of `halt`, `poweroff`, or `reboot`.

**Example:**

    $ mkdir -p /libexec/finit/hook/sys/down
    $ cat <<EOF >/libexec/finit/hook/sys/down/foo.sh
    #!/bin/sh
    echo 'I run just before the reboot() syscall at shutdown/reboot'
    echo 'I have access to /dev since devtmpfs is exempt from umount'
    echo "FINIT_HOOK_NAME: $FINIT_HOOK_NAME"
    if [ -n "$FINIT_SHUTDOWN" ]; then
            echo "FINIT_SHUTDOWN:  $FINIT_SHUTDOWN"
    fi
    exit 0
    EOF
    $ chmod +x /libexec/finit/hook/sys/down/foo.sh

> **Note:** to use hook scripts, even for pre-bootstrap and pre-shutdown
> tasks, you must build with `configure --enable-hook-scripts-plugin`.

### Bootstrap Hooks

* `HOOK_BANNER`, `hook/sys/banner`: The very first point at which a
  plugin can run.  Intended to be used as a banner replacement.
  Essentially this runs just before entering runlevel S.  Assume nothing
  is available, so be prepared to use absolute paths, etc.

* `HOOK_ROOTFS_UP`, `hook/mount/root`: When `finit.conf` has been read
  and `/` has is mounted — very early

* `HOOK_MOUNT_ERROR`, `hook/mount/error`: executed if `mount -a` fails

* `HOOK_MOUNT_POST`, `hook/mount/post`: always executed after `mount -a`

* `HOOK_BASEFS_UP`, `hook/mount/all`: All of `/etc/fstab` is mounted,
  swap is available and default init signals are setup

* `HOOK_SVC_PLUGIN`, `hook/svc/plugin`: Called in `conf_init()` right
  before loading `/etc/finit.conf`.  For plugins to register any early
  run/task/services, please do NOT use any earlier hook point.  That
  will cause uninitialized rlimits that lead to unpredictable results
  when Finit later tries to start the run/task/service.

* `HOOK_NETWORK_UP`, `hook/net/up`: System bootstrap, runlevel S, has
  completed and networking is up (`lo` is up and the `network` script
  has run)

* `HOOK_SVC_UP`, `hook/svc/up`: All services in the active runlevel have
  been launched

* `HOOK_SYSTEM_UP`, `hook/sys/up`: All services *and* everything in
  `/etc/finit.d` has been launched

### Runtime Hooks

* `HOOK_SVC_RECONF`, N/A: Called when the user has changed something in
  the `/etc/finit.d` directory and issued `SIGHUP`.  The hook is called
  when all modified/removed services have been stopped.  When the hook
  has completed, Finit continues to start all modified and new services.

* `HOOK_RUNLEVEL_CHANGE`, N/A: Called when the user has issued a
  runlevel change.  The hook is called when services not matching the
  new runlevel have been been stopped.  When the hook has completed,
  Finit continues to start all services in the new runlevel.

### Shutdown Hooks

* `HOOK_NETWORK_DN`, `hook/net/down`: Called right after having changed
  to runlevel 6, or 0, when all services have received their 'stop' signal.

* `HOOK_SHUTDOWN`, `hook/sys/shutdown`: Called at shutdown/reboot, right
  before all services are sent `SIGTERM`

* `HOOK_SVC_DN`, `hook/svc/down`: In shutdown/reboot, all services and
  non-reserved processes have been killed.  **Note:** only hook scripts
  can run here!

* `HOOK_SYSTEM_DN`, `hook/sys/down`: In shutdown/reboot, called after
  all non-reserved file systems have been unmounted, just before Finit
  tells the kernel to reboot or shut down.  **Note:** only hook scripts
  can run here!

Plugins like `tty.so` extend finit by acting on events, they are called
I/O plugins and are called from the finit main loop when `poll()`
detects an event.  See the source code for `plugins/*.c` for more help
and ideas.

repository: troglobit/finit

gha_language: C

repo_name: troglobit/finit


text:
# elm-spinner

A highly configurable, efficiently rendered spinner component.

![Example](https://github.com/damienklinnert/elm-spinner/raw/master/example/elm-spinner.gif)

The `Spinner` module exposes the `Model` and `Msg` type as well as an `update` and `view` function, all ready
to with the Elm Architecture in your application.

**Features**:

- No images, no external CSS
- Highly configurable ([try the interactive spinner editor](https://damienklinnert.github.io/elm-spinner/))
- Resolution independent (looks great on Retina!!)
- Efficient animations thanks to `window.requestAnimationFrame`
- Works in Chrome, Safari, Firefox from IE >= 10

**Reference**:

- [license](https://github.com/damienklinnert/elm-spinner/issues/blob/master/LICENSE)
- [bug tracker](https://github.com/damienklinnert/elm-spinner/issues)
- [source code](https://github.com/damienklinnert/elm-spinner)
- [documentation](http://package.elm-lang.org/packages/damienklinnert/elm-spinner/latest/)
- [changelog](https://github.com/damienklinnert/elm-spinner/blob/master/CHANGELOG.md)

## Quickstart

This section will walk you through your very first steps with the `Spinner` module.
At the end, you'll have a good understanding of how to use this module.

You can find two complete examples in the `example/` folder:

- A [simple, bare bones integration](https://github.com/damienklinnert/elm-spinner/tree/master/example/simple)
  of a spinner in `example/simple/`
- A [visual spinner editor](https://damienklinnert.github.io/elm-spinner/),
  allowing you to make your own spinner in  `example/editor/`

If you're not yet familiar with [The Elm Architecture](http://guide.elm-lang.org/architecture/), give it a quick read.
It will help you to understand how the spinner works.

### Preparation: Import the module

Run the following command in the root directory of your project:

```bash
elm package install damienklinnert/elm-spinner

```

And then import the `Spinner` module at the top of a module like this:

```elm
import Spinner
```

Now you're ready to wire up everything!

### Subscription

Since our spinner is animated, we'll need to add a `subscription` to our `program`:

```elm
main : Program Never Model Msg
main =
    program
        { init = init
        , update = update
        , view = view
        , subscriptions = (\model -> Sub.map SpinnerMsg Spinner.subscription)
        }
```

### Update Function

You might have already noticed the `SpinnerMsg` in the previous example. Since our spinner is animated, it will send
messages of type `Spinner.Msg` wrapped inside a `SpinnerMsg` to our update function.

Now it's up to us to forward those messages to the `Spinner.update` function:

```elm
update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
    case msg of
        Noop ->
            model ! []

        SpinnerMsg msg ->
            let
                spinnerModel =
                    Spinner.update msg model.spinner
            in
                { model | spinner = spinnerModel } ! []
```

### Model

The previous example already referenced `model.spinner`, which is of type `Spinner.Model`. The `Spinner.update` function
takes care of keeping that up to date for us. However we still need to add `Spinner.Model` to our applications model.

```elm
type alias Model =
    { spinner : Spinner.Model
    }
```

Now where `Spinner.Model` is part of your model, you also need to properly initialise it. You can use `Spinner.init` to get started quickly:

```elm
init : ( Model, Cmd Msg )
init =
    { spinner = Spinner.init } ! []
```

### View

Now, last but not least, you can add the spinner to your application's view like this:

```elm
view : Model -> Html.Html Msg
view model =
    Html.div [] [ Spinner.view Spinner.defaultConfig model.spinner ]

```

Et Voilà, you should now have an animated spinner in your application.

**Note**: If you dislike the default spinner stype, you can make your own. Check the [spin module docs](http://package.elm-lang.org/packages/damienklinnert/elm-spinner/latest/) for more info.

### What's next?

- Check the [bare bones integration](https://github.com/damienklinnert/elm-spinner/tree/master/example/simple)
- [Make your own spinner](https://damienklinnert.github.io/elm-spinner/)
- Check out the full documentation for the [Spin module](http://package.elm-lang.org/packages/damienklinnert/elm-spinner/latest/)

## Credits

This module is highly inspired by [spin.js from Felix Gnass](http://spin.js.org).

repository: damienklinnert/elm-spinner

gha_language: Elm

repo_name: damienklinnert/elm-spinner


text:
Tenejo: a General Purpose Digital Repository
============================================

[![CircleCI](https://circleci.com/gh/curationexperts/tenejo.svg?style=svg)](https://circleci.com/gh/curationexperts/tenejo) [![Apache 2.0 License](http://img.shields.io/badge/APACHE2-license-blue.svg)](./LICENSE) [![Maintainability](https://api.codeclimate.com/v1/badges/11b857b0d512575d91c5/maintainability)](https://codeclimate.com/github/curationexperts/tenejo/maintainability)

Tenejo gives you the most commonly used Samvera features and functions in an easy to use hosted solution.

Hosting
-------

Contact [tenejo<EMAIL_ADDRESS>for information about Tenejo as a managed service for your institution.

Development
-----------

1. `git clone https://github.com/curationexperts/tenejo.git`
1. `cd ./tenejo` then check out a working branch `git checkout -b [meaningful_name]`
1. Ensure you have the prerequisites from https://github.com/samvera/hyrax, although you do not need a separately running Solr or Fedora instance in order to begin in development, since these are packaged with this application, in the form of solr_wrapper and fcrepo_wrapper.
1. Copy `.env.sample` to `.env.development` if you want to override any default settings in your local development environment. Choose a random password for your local tenejo database user and add it to this file.
1. Setup your database.
   We use PostgreSQL. To support the test and development environments, you'll
   need have Postgres installed and running.

    * Create your development and test postgres databases `createdb tenejo_development` and `createdb tenejo_test`
    * Open your psql console in using the newly created tenejo_development database `psql tenejo_development`
    ```
    postgres=# create user tenejo with encrypted password 'whatever';
    CREATE ROLE
    postgres=# grant all privileges on database tenejo_development to tenejo;
    GRANT
    postgres=# grant all privileges on database tenejo_test to tenejo;
    GRANT
    postgres=# ALTER DATABASE tenejo_development OWNER TO tenejo;
    ALTER DATABASE
    postgres=# ALTER DATABASE tenejo_test OWNER TO tenejo;
    postgres=# \q
    ```
1. Set up your gemset using rvm (it's possible you'll need to download a new Ruby, depending on the project - `rvm install [ruby-version]`)
    ```
    rvm list rubies
    * ruby-2.5.1 [ x86_64 ]
    => ruby-2.6.3 [ x86_64 ]

    # => - current
    # =* - current && default
    #  * - default

    rvm use gemset ruby-2.6.3@tenejo --create
    ruby-2.6.3 - #gemset created /Users/max/.rvm/gems/ruby-2.6.3@tenejo
    ruby-2.6.3 - #generating tenejo wrappers.........
    Using /Users/max/.rvm/gems/ruby-2.6.3 with gemset tenejo
    ```
1. Run `bundle install`
1. Run `bundle exec rake db:migrate` to setup the development database and schema.
1. Start the servers, one per terminal window/tab - `fcrepo_wrapper`, `solr_wrapper`, `rails server`, and `sidekiq`
1. (optional) Create standard accounts: `rake tenejo:standard_users_setup`.
1. Create default collection types: `bundle exec rails hyrax:default_collection_types:create`
1. `bundle exec rails hyrax:default_admin_set:create`
1. Make sure your computer has directories `/opt/uploads/` and `/opt/derivatives` that you own

Production
----------
1. Set `IIIF_SERVER_URL=http://SERVERNAME/cantaloupe/iiif/2/` to use an external cantaloupe IIIF server

License
-------

Tenejo is available under the [Apache License Version 2.0](./LICENSE).

branch_name: refs/heads/main


text:
# Examples

In order to run the examples, make sure that you have datmo properly installed with the latest
stable or development version. You can install it with the following command:

```
$ pip install datmo
```

## Using the Examples
### CLI flow
See [CLI flow examples](/examples/cli) for instructions

### CLI + Python flow
See [CLI + Python flow examples](/examples/python) for instructions

### CLI + Jupyter Notebook flow
See [CLI + Jupyter Notebook flow examples](/examples/jupyter_notebook) for instructions

## Examples
Listed below are actions you might want to take with Datmo. For each
we have listed if there are any example for each type of flow. You can
navigate to the specific flow folder to find the exact instructions for
each example.

#### Creating a Snapshot
* [CLI flow](/examples/cli/)
    * snapshot_create_iris_sklearn
* [CLI + Python flow](/examples/python)
    * snapshot_create_iris_sklearn
* [CLI + Jupyter Notebook flow](/examples/jupyter_notebook)
    * snapshot_create_iris_sklearn

#### Running a containerized task (with option to create Snapshot)
* [CLI + Python flow](/examples/python)
    * task_run_iris_sklearn_basic
    * task_run_iris_sklearn_compare

repository: aernesto/datmo

repo_name: aernesto/datmo


text:
---
name: Config and run
sort: 6
---

# Configuration and run

## Configuration

### Default configuration

The default configuration is saved in `conf/app.ini`, you do **NOT** need to edit it at all.

### Custom configuration

So how to do custom configuration if you are not allowed to edit `conf/app.ini`? Well, create `custom/conf/app.ini` then! Overwrite corresponding key in corresponding section in `custom/conf/app.ini`.

For example, to change the root path of where repository raw data being stored, add something like follows:

```
[repository]
ROOT = /home/jiahuachen/gogs-repositories
```

Of course, you want to change database setting as well:

```
[database]
PASSWD = root
```

### Why are we doing this?

Yes, why don't you just edit `conf/app.ini`? The reason is that to keep your custom configuration safe:

- For people who install from binary, every time after you ship the program, can just simply copy and paste without re-configuring anything.
- For people who install from source, we've ruled out the `custom/conf/app.ini` in `.gitignore` so it will not cause changes in version control which you have to do batch of other stuff before updating.

## Run Gogs server

### For Developers

- You need to set key `security -> INSTALL_LOCK` to be `true` in file `custom/conf/app.ini` in order to run from source.
- You can enable live compile by executing `bra run` in the Gogs source folder
	- Install [bra](https://github.com/Unknwon/bra): `go get -u github.com/Unknwon/bra`

### For Deployment

**Scripts are in `scripts` directory**

- There are 3 ways to start by default:
	- Plain: just use `./gogs web`
	- Script: execute `./scripts/start.sh` or `./scripts/start.bat`
	- Supervisor:
		- Start: `./scripts/gogs_supervisord.sh start`
		- Stop: `./scripts/gogs_supervisord.sh stop`
		- Restart: `./scripts/gogs_supervisord.sh restart`
- Go to `/install` to do your first-time run configuration.

repository: mengqingshare/docs

repo_name: mengqingshare/docs


text:
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

#### Code Sample, a copy-pastable example if possible

```python
# Your code here

```
#### Problem description

[this should explain **why** the current behavior is a problem and why the expected output is a better solution.]

#### If query related, does it happen on other platforms (Kusto Web UI, Kusto Explorer)?

[this step is to help pin point problems that are only specific to this platform.]

#### Output of ``pip freeze``

<details>

[paste the output of ``pip freeze`` here below this line]

</details>

repository: Azure/azure-kusto-python

gha_language: Python

repo_name: Azure/azure-kusto-python


text:
THE AUTHENTICATOR
===================

THE AUTHENTICATOR DOES NOT CARE LETTER BEFORE AUTH. THE AUTHENTICATOR PROVIDE GOOD USER EXPERIENCE. THE AUTHENTICATOR BEND OAUTH TO WILL.

What is this?
-------------

This is a proof of concept Objective-C OAuth desktop client for Twitter that implements a login flow that mimics xAuth (Username + Password) for a silky smooth user experience.

Why?
----

Because there's been hubbubb over the bad user experience associated with OAuth. This resurfaced recently when Twitter decided that all API clients except their own must use OAuth for authentication.

[http://daringfireball.net/2011/05/twitter_shit_sandwich](http://daringfireball.net/2011/05/twitter_shit_sandwich)

How?
----

The client embeds a WebKit view to do the authentication, but restyles Twitter's normal authentication dialog to look more like a native OS X window.

Once the user has logged in it hides the WebKit view, and in the background uses Javascript to extract the verification PIN to retrieve the access token.

Practical?
----------

It's a giant hack, and probably violates some Term of Service clause. But it works.

Caveats
------

- Needs more native styling
- Needs a few seconds to download the auth dialog before it can be shown. This can be remedied with some clever UX.

License
-------

By Kim Ahlström<EMAIL_ADDRESS>
MIT License

repository: Kimtaro/THE-AUTHENTICATOR

repo_name: Kimtaro/THE-AUTHENTICATOR


text:
# Simple steps to deploy app in Google Cloud

Please follow the following instructions to create and deploy your first google cloud application.

## Account and other basic Steps
1. Please log in to google via your google account,  or if you dont have an google account create one here

2. Go to google cloud's website
3. Go to ![Console](https://raw.githubusercontent.com/farshidrayhanuiu/cloud_computing/master/misc/1.PNG)
4. Accept the license

![aggreement](https://raw.githubusercontent.com/farshidrayhanuiu/cloud_computing/master/misc/2.PNG)
5. Select project ![a](https://raw.githubusercontent.com/farshidrayhanuiu/cloud_computing/master/misc/3.PNG)    <br/

6. Select New Project

![a](https://raw.githubusercontent.com/farshidrayhanuiu/cloud_computing/master/misc/4.PNG)

7. Select a project name

![a](https://raw.githubusercontent.com/farshidrayhanuiu/cloud_computing/master/misc/5.PNG)

8. Select the project you just created

![a](https://raw.githubusercontent.com/farshidrayhanuiu/cloud_computing/master/misc/18.PNG)

## Final steps

9. Now you should have the dashboard. From there select the terminal (highlighted with a red circle) and and select "start cloud shell"

![a](https://raw.githubusercontent.com/farshidrayhanuiu/cloud_computing/master/misc/6.PNG)

10. use the fllowing code the clone the demo codes from github.
 #### git clone https://github.com/farshidrayhanuiu/cloud_computing.git
![a](https://raw.githubusercontent.com/farshidrayhanuiu/cloud_computing/master/misc/27.PNG)

11. go to that directory
![a](https://raw.githubusercontent.com/farshidrayhanuiu/cloud_computing/master/misc/8.PNG)

12. Now we need to install the prerequisites. To do that type the following codes
#### pip install -t lib -r requirements.txt
13. Then we need to initialize the enviourment with
#### gcloud init

14. Follow these instructions

![a](https://raw.githubusercontent.com/farshidrayhanuiu/cloud_computing/master/misc/14.PNG)
![a](https://raw.githubusercontent.com/farshidrayhanuiu/cloud_computing/master/misc/15.PNG)
![a](https://raw.githubusercontent.com/farshidrayhanuiu/cloud_computing/master/misc/16.PNG)

15. Finally now we are going to deploy the app using the command
#### gcloud app deploy

16. and we are going to follow these instructions

![a](https://raw.githubusercontent.com/farshidrayhanuiu/cloud_computing/master/misc/9.PNG)

![a](https://raw.githubusercontent.com/farshidrayhanuiu/cloud_computing/master/misc/10.PNG)
![a](https://raw.githubusercontent.com/farshidrayhanuiu/cloud_computing/master/misc/11.PNG)
![a](https://raw.githubusercontent.com/farshidrayhanuiu/cloud_computing/master/misc/12.PNG)

17. And we are done ! run the last command to deploy the app via a weblink
#### gcloud app browse

18. Clink on the link to see the webpage

![a](https://raw.githubusercontent.com/farshidrayhanuiu/cloud_computing/master/misc/17.PNG)

19. Output

![a](https://raw.githubusercontent.com/farshidrayhanuiu/cloud_computing/master/misc/19.PNG)


text:
# Ceracea brasiliensis Rick SPECIES

#### Status
ACCEPTED

#### According to
Index Fungorum

#### Published in
in Rambo (Ed. ), Iheringia, Sér. Bot. 2: 50 (1958)

#### Original name
Ceracea brasiliensis Rick

### Remarks
null

repository: mdoering/backbone

repo_name: mdoering/backbone


text:
# Pitch

Pitch your ideas to the world

## Version

 Pitch-V1.0

## Author

* **mungaijoel**

## Features

As a user of the website you will be able to:

1. Open the app on the web.
2. Navigate the app.
3. View different pitch posts.
4. See other comments.

## Behaviour Driven Development (BDD)
|Behaviour 	           |    Input 	                 |       Output          |
|----------------------------------------------|:-----------------------------------:|-----------------------------:|
|Page loads	                           |   USer clicks any link in navbar                            |       Respective content is displayed  |                        |

### Installing

*** To view the app.Visit -> [Pitch](https://pitches-on-pitches.herokuapp.com/)
* Step 1:
Clone this repo: git clone https://github.com/mungai-joel/Pitch.git.
* Step 2:
The repo comes in a zipped or compressed format. Extract to your prefered location and open it.
* Step 3:
open your terminal and navigate to gallery.
* Step 4:
To run the app, you'll have to run the following commands in your terminal
.\start.sh

## Built With

* Python Flask framework
* HTML - For building Mark Up pages/User Interface
* CSS - For Styling User Interface

## License

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

## Acknowledgments

repository: mungai-joel/pitch

repo_name: mungai-joel/pitch


text:
---
layout: post
title:  "Craft beer and cider @ Yi fa hot and cold drinks"
categories: [ east coast lagoon, hawker centre, craft beer ]
image: assets/images/craft-beer-collage.jpg
featured: false
hidden: false
rating: 5
author: steve
date: 2019-09-25 11:44 +0800
---

The craft beer scene is currently exploding in Singapore. You are able to taste delicious ranges of brews at [cool bars](https://www.facebook.com/DruggistsSG/), [stalls](https://www.facebook.com/smithstreettaps) in hawker centres, to local [microbreweries](http://pinkblossomsbrewing.com). In following this trend, it is refreshing to now see drink stalls in hawkers centres that offer more than the usual Asia Pacific or Carlsberg choices.

Uncle Allen has been well ahead of the trend, offering a wide variety of been by the bottle for several years. His stock of beers range from craft American IPAs, to German wheat beers, and even Somerset ciders. There is something for everyone here and at a decent price compared to bars and pubs in the area.

![Snow beer]({{site.baseurl}}/assets/images/snow-beer-collage.jpg)

Although, the specialty at this stall is the *snow beer*, not the [tasteless beer from China](https://www.ratebeer.com/beer/snow-beer/39394/), but a super cold beer. The bottle of beer is stored in a freezer, along with the glass, to create a icy effect similar to snow when its poured out — a snow dome effect. Probably the most refreshing cold beer you can have. I first came across this beer freezing technique in the old town at [Ipoh](http://www.vkeong.com/eat/sun-yoon-wah-snow-beer-ipoh/). While it might seem that the beer would get flat, the temperature appears to be just warm enough so that when the beer does become icy it retains enough carbonation. There is simply nothing better on a hot Singapore afternoon, especially with the views east coast park has to offer.

![East coast park vistas]({{site.baseurl}}/assets/images/east-coast-park-collage.jpg)

**Price:** Most beers under $10

**Hawker centre:** East coast lagoon food village
**Address:** #01-25, 1220 East coast parkway
**Hours:** 11:00am - 11:00pm  (closed mondays)

***

![yi fa hot and cold drinks stall]({{site.baseurl}}/assets/images/yi-fa-hot-cold-drinks.jpg "Yi Fa Hot and Cold Drinks Stall")

<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3988.78049912728!2d103.93275511475396!3d1.3068680990468287!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x31da18764013f43b%3A0x6cfef20f595a57b0!2sEast%20Coast%20Lagoon%20Food%20Village!5e0!3m2!1sen!2ssg!4v1567135621194!5m2!1sen!2ssg" width="600" height="450" frameborder="0" style="border:0;" allowfullscreen=""></iframe>

repository: shawes/ang-moh-in-the-east

repo_name: shawes/ang-moh-in-the-east


text:
# **eucalypt** (the language)

**eucalypt**, the language, is unorthodox in many respects - probably
moreso than you might realise on first acquaintance.

Many people have deep-seated and inflexible opinions about programming
languages and language design [^1] and will likely find something in
here that they have a kneejerk reaction against.

However, the design is not unprincipled and, while it is experimental
in some respects, I believe it's internally consistent. Several
aspects of the design and the aesthetic are driven by the primary use
case. Maybe by exploring some of the inspiration and philosophy behind
the language itself, I can head off potential criticism.

## Accept crypticality for minimal intrusion

**eucalypt** is first and foremost a *tool*, rather than a language. It is
intended to replace generation and transformation processes on
semi-structured data formats. Many or most uses of **eucalypt** the
language should just be simple one-liner tags in YAML files, or maybe
eucalypt files that are predominantly data rather than manipulation.

The **eucalypt** language is the depth behind these one-liners that allows
**eucalypt** to accommodate increasingly ambitious use cases without
breaking the paradigm and reaching for a general purpose scripting
language.

The pre-eminence of one-liners and small annotations and "logic
mark-up", means that **eucalypt** often favours concise and cryptic over
wordy and transparent. This is a controversial approach.

- **eucalypt** logic should "get out of the way" of the data. Templating
  is attractive precisely because the generating source looks very
  like the result. Template tags are often short (with "cryptic"
  delimiters - `{{}}`, `<%= %>`, `[| ]`...) because these are "marking
  up" the data which is the main event. At the same time, the tags are
  often "noisy" or visually disruptive to ensure they cannot be
  ignored. **eucalypt** via operator and bracket definitions, picks and
  chooseS from a similar palette of expressive effects to try and be a
  sympathetic cohabitee with its accompanying data.

- There are many cases where it makes sense to resist offering an
  incomplete understanding in favour of demanding full understanding.
  For example, it is spurious to say that `bind(x, f)` gives more
  understanding of what is going on than `x >>= f` - unless you
  understand the monad abstraction and the role of bind in it, you
  gain nothing from the ideas that the word `bind` conveys when trying
  to understand program text.

- **eucalypt** just plain ignores the notion that program text should be
  readable as English text. This (well motivated) idea has made a
  resurgence in recent years through the back door of internal DSLs
  and "fluent" Java interfaces [^2]. There is much merit in languages
  supple enough to allow the APIs to approach the natural means of
  expression of the problem domain. However, problem domains
  frequently have their own technical jargon and notation which suit
  their purpose better than natural language so it cuts both ways.
  Program text should be approachable by its target audience but that
  does not mean it should make no demands of its target audience.

These stances lead directly to several slightly esoteric aspects of
**eucalypt** that may be obnoxious to some:

- **eucalypt** tends to be operator-heavy. Operators are concise (if
  cryptic) and the full range of unicode is available to call upon.
  Using operators keeps custom logic visually out of the way of the
  data whilst also signposting it to attract closer attention.

- **eucalypt** lets you define your own operators and specify their
  precedence and associativity (which are applied at a relatively late
  stage in the evaluation pipeline - *operator soup* persists through
  the initial parse). There are no ternary operators.

- For absolute minimal intrusion, merely the act of placing elements
  next to each other ("catenation"), `x f`, is meaningful in **eucalypt**.
  By default this is pipeline-order function application, but blocks
  and lists can be applied as functions to make common
  transformations, like block merge, very succinct.

- For even more power, **eucalypt** will let you alter the meaning of
  concatenation via overloaded *idiot brackets* [^3]. (`[[x y]]:
  ...`). This is inspired by the *idiom brackets* that can be used to
  express applicative styles in functional programming [^4]. These
  also provide an acceptable proxy for ternary and other operators
  too.

- An equivalent generalisation of **eucalypt** block syntax to provide a
  capability similar to Haskell's `do` notation might follow.

## Cohabitation of code and data

Just like templates, **eucalypt** source (or **eucalypt**-tagged YAML or JSON)
should be almost entirely data.

The idea behind **eucalypt** is to adopt the basic maps-and-arrays
organisation philosophy of these data formats but make the data
*active* - allowing lambdas to live in and amongst it and operate on
it and allowing the data to express dispositions towards its
environment by addition of metadata that controls import, export, and
execution preferences.

**eucalypt** therefore collapses the separation of code and data to some
degree. You can run `eu` against a mixture of YAML, JSON and eucalypt
files and all the data and logic appears there together in the same
namespace hierarchy. The namespace hierarchy just *is* the data.

However, code and data aren't unified in the sense of Lisp for
instance. **eucalypt** is not homoiconic. The relationship is more like
cohabitation; code lives in amongst the data it operates on but is
stripped out before export.

Nevertheless **eucalypt** is heavily inspired by Lisp and aims for a
similar fluidity through:

- lazy evaluation (going some way towards matching uses of Lisp macros
  which control evaluation order - `if` is a function)
- economical syntax to allow for manipulation of code as data

## Simplicity

- **eucalypt** values simplicity in the sense of fewer moving parts (and
  therefore, hopefully, fewer things to go wrong). It values ease of
  use in the sense of offering a rich and powerful toolkit. You may
  not think it achieves either.

- **eucalypt** values familiarity more in the "shallower" parts of the
  language where it only requires a couple of mental leaps for the
  average programmer in these areas - (ab)use of catenation being the
  key one.

- However, **eucalypt** shouldn't be ashamed of its dusty corners. Dusty
  corners are areas where novices and experts alike can get trapped
  and lose time but they're also rich seams for experimentation,
  innovation and discovery[^5]. If you have to venture too far
  off-piste to find what you need, we'll find a way to bring it onto
  the nursery slopes but we won't close off the mountain.

---

#### Footnotes

[^1]: ...often a result of underfamiliarity with the alternatives.

[^2]: Actually the real benefit of fluent interfaces in Java is they
	offer a cheap user interface for configuration of APIs by
	leveraging your IDE's autocomplete capability. All other benefits
	are orthogonal.

[^3]: If I didn't call them that, someone else would.

[^4]: Applicative Programming with Effects, Conor McBride and Ross
	Paterson. (2008)
	http://www.staff.city.ac.uk/~ross/papers/Applicative.html

[^5]: "A man of genius makes no mistakes. His errors are volitional
	and are the portals to discovery." - James Joyce, Ulysses


text:
# Django Bulbs [![Build Status](https://travis-ci.org/theonion/django-bulbs.svg?branch=promotions)](https://travis-ci.org/theonion/django-bulbs) [![Coverage Status](https://img.shields.io/coveralls/theonion/django-bulbs.svg)](https://coveralls.io/r/theonion/django-bulbs?branch=master)

django-bulbs is a set of apps used to power content at [The Onion](http://www.theonion.com).

This project very much under active development, and is currently not as reusable as it could be.

## Setting up virtual env
```
virtualenv .
source bin/activate
```

First, enter any virtualenv, etc, that you plan on developing in.
```bash
pip install -e .
pip install "file://$(pwd)#egg=django-bulbs[dev]"
```

## Running Tests

1. Clone [django-elastimorphic](https://github.com/theonion/django-elastimorphic) into a sibiling directory
2. Install dev requirements
```bash
pip install -e ".[dev]"
```
3. Run tests
```bash
py.test tests/
```

## Building Docs
```bash
cd docs
make html
```

repository: csinchok/django-bulbs

repo_name: csinchok/django-bulbs


text:
# Analytics for the Internet of Things (IoT)
This is the code repository for [Analytics for the Internet of Things (IoT)](https://www.packtpub.com/hardware-and-creative/analytics-internet-things-iot?utm_source=github&utm_medium=repository&utm_campaign=9781787120730), published by [Packt](https://www.packtpub.com/?utm_source=github). It contains all the supporting project files necessary to work through the book from start to finish.
## About the Book
We start with the perplexing task of extracting value from huge amounts of barely intelligible data. The data takes a convoluted route just to be on the servers for analysis, but insights can emerge through visualization and statistical modeling techniques. You will learn to extract value from IoT big data using multiple analytic techniques.

Next we review how IoT devices generate data and how the information travels over networks. You’ll get to know strategies to collect and store the data to optimize the potential for analytics, and strategies to handle data quality concerns.

Cloud resources are a great match for IoT analytics, so Amazon Web Services, Microsoft Azure, and PTC ThingWorx are reviewed in detail next. Geospatial analytics is then introduced as a way to leverage location information. Combining IoT data with environmental data is also discussed as a way to enhance predictive capability. We’ll also review the economics of IoT analytics and you’ll discover ways to optimize business value.

By the end of the book, you’ll know how to handle scale for both data storage and analytics, how Apache Spark can be leveraged to handle scalability, and how R and Python can be used for analytic modeling.

## Instructions and Navigation
All of the code is organized into folders. Each folder starts with a number followed by the application name. For example, Chapter02.

The code will look like the following:
```
IF SUM([Amount of Precipitation (inches)]) >= 0.2 THEN
 "Yes"
ELSE
 "No"
END
```

## Related Products
* [Internet of Things with Arduino Cookbook](https://www.packtpub.com/hardware-and-creative/internet-things-arduino-cookbook?utm_source=github&utm_medium=repository&utm_campaign=9781785286582)

* [Internet of Things with Python](https://www.packtpub.com/hardware-and-creative/internet-things-python?utm_source=github&utm_medium=repository&utm_campaign=9781785881381)

* [Internet of Things Programming with JavaScript](https://www.packtpub.com/web-development/internet-things-programming-javascript?utm_source=github&utm_medium=repository&utm_campaign=9781785888564)

### Download a free PDF

 If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.
Simply click on the link to claim your free PDF.

 https://packt.link/free-ebook/9781787120730


text:
---
title: "What's new in Svelte: July 2021"
description: Keeping cool with fixes, TypeScript tooling and tonnes of new features
author: Dani Sandoval
authorURL: https://dreamindani.com
---

As the northern hemisphere heats up, Svelte has stayed cool with lots of performance and bug fixes, better TypeScript support, and lots of new components & tools from around the ecosystem. Let's take a peek 👀

## New in SvelteKit

- `adapter-node` now precompresses assets using gzip & brotli ([#1693](https://github.com/sveltejs/kit/pull/1693))
- Support for TypeScript transpilation has been added to the `svelte-kit package` tooling ([#1633](https://github.com/sveltejs/kit/pull/1633))
- Improved caching defaults in `adapter-node` ([#1416](https://github.com/sveltejs/kit/pull/1416))
- Allow configuring Rollup output options ([#1572](https://github.com/sveltejs/kit/pull/1572))
- Fixed usage of SSL with HMR ([#1517](https://github.com/sveltejs/kit/pull/1517))

## Features & bug fixes from around svelte/\*

- [Svelte 3.38.3](https://github.com/sveltejs/svelte/blob/master/CHANGELOG.md#3383) (released June 22) includes a bunch of performance and bug fixes - including hydration optimizations, `this` preservation in bubbled events, and more!
- The latest language tools releases added support for prop renaming from outside of a component, PostCSS syntax grammar, and a `.d.ts` output target in `svelte2tsx` which can be used to create type definitions from Svelte files.
- Also in language tools, some long-awaited experimental features for enhanced TypeScript support were added - including explicitly typing all possible component events or slots, and using generics. Have a look at [the RFC](https://github.com/sveltejs/rfcs/pull/38) for more details and leave feedback in [this issue](https://github.com/sveltejs/language-tools/issues/442) if you are using it.
- `svelte-scroller` got some quality-of-life fixes in 2.0.7 - fixing an initial width bug and updating its `index` more conservatively

## Coming soon to Svelte

- Constants in markup ([RFC](https://github.com/sveltejs/rfcs/blob/master/text/0000-markup-constants.md)): Adds a new `{@const ...}` tag that defines a local constant ([PR](https://github.com/sveltejs/svelte/pull/6413))

---

## Community Showcase

**Apps & Sites**

- [SvelteThemes](https://sveltethemes.dev/) is a curated list of Svelte themes and templates built using svelte, sveltekit, elderjs, routify etc.
- [Beatbump](https://github.com/snuffyDev/Beatbump) is an alternative frontend for YouTube Music created using Svelte/SvelteKit.
- [Sveltuir](https://github.com/webspaceadam/sveltuir) is an app help you memorize the guitar fretboard

**Educational Content**

- [Svelte Radio: A Jolly Good Svelte Summer](https://share.transistor.fm/s/60880542) is a conversation about what's new in Svelte and a celebration of Svelte Radio's 1-year anniversary
- [Class properties in Svelte](https://navillus.dev/blog/svelte-class-props) is a refresher on the power of `class` for developers switching over to Svelte from React
- [Sveltekit Tutorial for Beginners](https://www.youtube.com/playlist?list=PLm_Qt4aKpfKjf77S8UD79Ockhwp_699Ms) is a video playlist for learning SvelteKit by WebJeda
- [How To Cache Dynamic Pages On Demand With A Service Worker In SvelteKit](https://jochemvogel.medium.com/how-to-cache-dynamic-pages-on-demand-with-a-service-worker-in-sveltekit-4b4a7652583d) walks through the power of service workers when used within SvelteKit for on-demand caching
- [Vue vs Svelte: Comparing Framework Internals](https://www.vuemastery.com/blog/vue-vs-svelte-comparing-framework-internals/) dives deep into the differences between Vue and Svelte from the inside out
- [Setting up a development environment for SvelteKit with Docker and Docker Compose](https://jenyus.web.app/blog/2021-05-30-setting-up-a-development-environment-for-sveltekit-with-docker-and-compose) walks through how to use Docker to create reusable development environments, no matter what kind of device you run your code on
- Scalable Scripts released three videos this month documenting how to deploy dockerized Svelte Apps to [AWS](https://youtu.be/VOs2Od5jYOc), [Azure](https://youtu.be/gdg4ne_uDm8) and [Google Cloud](https://youtu.be/_-uBb61Tikw)
- [Render Katex with Svelte from zero to hero](https://www.youtube.com/watch?v=euowJs9CblA) demonstrates how to implement Katex in a Svelte project
- [Using Custom Elements in Svelte](https://css-tricks.com/using-custom-elements-in-svelte/) shows some of the quirks to look out for when using custom elements in a Svelte site

**Libraries, Tools & Components**

- [svelte-pipeline](https://github.com/novacbn/svelte-pipeline) provides custom JavaScript contexts and the Svelte Compiler as Svelte Stores, for REPLs, Editors, etc.
- [Sveltotron](https://github.com/Salemmous/sveltotron) is an Electron-based app made to inspect your Svelte app
- [svelte-qr-reader-writer](https://github.com/pleasemarkdarkly/svelte-qr-reader-writer) is a Svelte component that helps read and write data from QR codes
- [svelte-stack-router](https://www.npmjs.com/package/svelte-stack-router) Aims to make Svelte apps feel more native by routing with Stacks
- [svelte-typed-context](https://www.npmjs.com/package/svelte-typed-context) provides an interface which, when provided to `getContext` or `setContext`, allows for stricter types
- [svelte-modals](https://svelte-modals.mattjennings.io/) is a simple, flexible, zero-dependency modal manager for Svelte

**Want to contribute a component? Interested in helping make Svelte's presence on the web better?** Submit a Component to the Svelte Society site by making [a PR to this file](https://github.com/svelte-society/sveltesociety-2021/blob/main/src/routes/components/components.json) or check out [the list of open issues](https://github.com/svelte-society/sveltesociety-2021/issues) if you'd like to contribute to the Svelte Society rewrite in SvelteKit.

## See you next month!

Want more updates? Join us on [Reddit](https://www.reddit.com/r/sveltejs/) or [Discord](https://discord.com/invite/yy75DKs)!

repository: sveltejs/svelte

repo_name: sveltejs/svelte