text:
# Lab 5 - Build Systems

## CMake Tutorial:

#### Step 1

![](Step1_Results/Step1.png)

The CMakeLists file is:

https://github.com/nickchan99/CSCI-4961-Labs/blob/master/Lab5/Step1_Results/CMakeLists.txt

#### Step 2

![](Step2_Results/Step2.png)

The CMakeLists file is:

https://github.com/nickchan99/CSCI-4961-Labs/blob/master/Lab5/Step2_Results/CMakeLists.txt

#### Step 3

![](Step3_Results/Step3.png)

The CMakeLists file is:

https://github.com/nickchan99/CSCI-4961-Labs/blob/master/Lab5/Step3_Results/CMakeLists.txt

The CMakeLists file for the MathFunctions directory is:

https://github.com/nickchan99/CSCI-4961-Labs/blob/master/Lab5/Step3_Results/CMakeLists(MathFunctions).txt

#### Step 4

![](Step4_Results/Step4_ctest_part1.png)
![](Step4_Results/Step4_ctest_part2.png)
![](Step4_Results/Step4_make_install.png)

The CMakeLists file is:

https://github.com/nickchan99/CSCI-4961-Labs/blob/master/Lab5/Step4_Results/CMakeLists.txt

The CMakeLists file for the MathFunctions directory is:

https://github.com/nickchan99/CSCI-4961-Labs/blob/master/Lab5/Step4_Results/CMakeLists(MathFunctions).txt

#### Step 5

![](Step5_Results/Step5.png)

The CMakeLists file is:

https://github.com/nickchan99/CSCI-4961-Labs/blob/master/Lab5/Step5_Results/CMakeLists.txt

The CMakeLists file for the MathFunctions directory is:

https://github.com/nickchan99/CSCI-4961-Labs/blob/master/Lab5/Step5_Results/CMakeLists(MathFunctions).txt

## Makefile Practice

Using one makefile to build two executables:

```
static_block: program.c libblockstatic.a
	gcc -Wall program.c -o static_block -L. -lblockstatic
dynamic_block: program.c libblockshared.so
	gcc -L. -Wl,-rpath=. -Wall program.c -o dynamic_block -lblockshared
libblockstatic.a: block.o headers/block.h
	ar rcs libblockstatic.a block.o headers/block.h
libblockshared.so: block.o headers/block.h
	gcc -shared block.o -o libblockshared.so
block.o: source/block.c
	gcc -fPIC -c source/block.c -o block.o
libs: libblockstatic.a
clean:
	rm -f static_block dynamic_block *.o *.so *.a
```
This makefile specifies two target executables, static_block and dynamic_block. The compiler arguments for each are specified. The static library simply requires a link argument and -L flag to tell gcc where to look for the library. The dynamic library requires the rpath to be specified to the library, telling the compiler to link that shared library. Below are the targets for the dependancies. The shared library is compiled, but the static library is given files to archive. Lastly, block.o is specified, and compiled as a position independent object. A clean command is specified to enable an easier clean rebuild.

static_block is 8747 bytes, while dynamic_block is 8600 bytes.

## Makefile Practice using CMake

The makefile above can be emulated using CMake:

```
cmake_minimum_required(VERSION 3.3)
project(CMakeExample)

set(CMAKE_CXX_STANDARD 14)

add_library(blocklibstat STATIC source/block.c headers/block.h)
add_library(blocklibshar SHARED source/block.c headers/block.h)

list(APPEND STATIC_LIBS blocklibstat)
list(APPEND DYNAMIC_LIBS blocklibshar)

add_executable(static_block program.c)
add_executable(dynamic_block program.c)

target_link_libraries(static_block ${STATIC_LIBS})
target_link_libraries(dynamic_block ${DYNAMIC_LIBS})
```

We can add files to the required libraries, and specify whether or not they will be static or shared. Appending the libraries to load allows them to be linked with the executables we specified with add_executable().

And this generates the following makefile:

```
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.5

# Default target executed when no arguments are given to make.
default_target: all

.PHONY : default_target

# Allow only one "make -f Makefile2" at a time, but pass parallelism.
.NOTPARALLEL:

#=============================================================================
# Special targets provided by cmake.

# Disable implicit rules so canonical targets will work.
.SUFFIXES:

# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =

.SUFFIXES: .hpux_make_needs_suffix_list

# Suppress display of executed commands.
$(VERBOSE).SILENT:

# A target that is always out of date.
cmake_force:

.PHONY : cmake_force

#=============================================================================
# Set environment variables for the build.

# The shell in which to execute make rules.
SHELL = /bin/sh

# The CMake executable.
CMAKE_COMMAND = /usr/bin/cmake

# The command to remove a file.
RM = /usr/bin/cmake -E remove -f

# Escaping for special characters.
EQUALS = =

# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /mnt/c/Users/Nick/Desktop/OSS/Lab5-Lab-Example/combined_makefile_cmake

# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /mnt/c/Users/Nick/Desktop/OSS/Lab5-Lab-Example/combined_makefile_cmake

#=============================================================================
# Targets provided globally by CMake.

# Special rule for the target edit_cache
edit_cache:
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "No interactive CMake dialog available..."
	/usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available.
.PHONY : edit_cache

# Special rule for the target edit_cache
edit_cache/fast: edit_cache

.PHONY : edit_cache/fast

# Special rule for the target rebuild_cache
rebuild_cache:
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
	/usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache

# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache

.PHONY : rebuild_cache/fast

# The main all target
all: cmake_check_build_system
	$(CMAKE_COMMAND) -E cmake_progress_start /mnt/c/Users/Nick/Desktop/OSS/Lab5-Lab-Example/combined_makefile_cmake/CMakeFiles /mnt/c/Users/Nick/Desktop/OSS/Lab5-Lab-Example/combined_makefile_cmake/CMakeFiles/progress.marks
	$(MAKE) -f CMakeFiles/Makefile2 all
	$(CMAKE_COMMAND) -E cmake_progress_start /mnt/c/Users/Nick/Desktop/OSS/Lab5-Lab-Example/combined_makefile_cmake/CMakeFiles 0
.PHONY : all

# The main clean target
clean:
	$(MAKE) -f CMakeFiles/Makefile2 clean
.PHONY : clean

# The main clean target
clean/fast: clean

.PHONY : clean/fast

# Prepare targets for installation.
preinstall: all
	$(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall

# Prepare targets for installation.
preinstall/fast:
	$(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall/fast

# clear depends
depend:
	$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend

#=============================================================================
# Target rules for targets named blocklibshar

# Build rule for target.
blocklibshar: cmake_check_build_system
	$(MAKE) -f CMakeFiles/Makefile2 blocklibshar
.PHONY : blocklibshar

# fast build rule for target.
blocklibshar/fast:
	$(MAKE) -f CMakeFiles/blocklibshar.dir/build.make CMakeFiles/blocklibshar.dir/build
.PHONY : blocklibshar/fast

#=============================================================================
# Target rules for targets named dynamic_block

# Build rule for target.
dynamic_block: cmake_check_build_system
	$(MAKE) -f CMakeFiles/Makefile2 dynamic_block
.PHONY : dynamic_block

# fast build rule for target.
dynamic_block/fast:
	$(MAKE) -f CMakeFiles/dynamic_block.dir/build.make CMakeFiles/dynamic_block.dir/build
.PHONY : dynamic_block/fast

#=============================================================================
# Target rules for targets named blocklibstat

# Build rule for target.
blocklibstat: cmake_check_build_system
	$(MAKE) -f CMakeFiles/Makefile2 blocklibstat
.PHONY : blocklibstat

# fast build rule for target.
blocklibstat/fast:
	$(MAKE) -f CMakeFiles/blocklibstat.dir/build.make CMakeFiles/blocklibstat.dir/build
.PHONY : blocklibstat/fast

#=============================================================================
# Target rules for targets named static_block

# Build rule for target.
static_block: cmake_check_build_system
	$(MAKE) -f CMakeFiles/Makefile2 static_block
.PHONY : static_block

# fast build rule for target.
static_block/fast:
	$(MAKE) -f CMakeFiles/static_block.dir/build.make CMakeFiles/static_block.dir/build
.PHONY : static_block/fast

program.o: program.c.o

.PHONY : program.o

# target to build an object file
program.c.o:
	$(MAKE) -f CMakeFiles/dynamic_block.dir/build.make CMakeFiles/dynamic_block.dir/program.c.o
	$(MAKE) -f CMakeFiles/static_block.dir/build.make CMakeFiles/static_block.dir/program.c.o
.PHONY : program.c.o

program.i: program.c.i

.PHONY : program.i

# target to preprocess a source file
program.c.i:
	$(MAKE) -f CMakeFiles/dynamic_block.dir/build.make CMakeFiles/dynamic_block.dir/program.c.i
	$(MAKE) -f CMakeFiles/static_block.dir/build.make CMakeFiles/static_block.dir/program.c.i
.PHONY : program.c.i

program.s: program.c.s

.PHONY : program.s

# target to generate assembly for a file
program.c.s:
	$(MAKE) -f CMakeFiles/dynamic_block.dir/build.make CMakeFiles/dynamic_block.dir/program.c.s
	$(MAKE) -f CMakeFiles/static_block.dir/build.make CMakeFiles/static_block.dir/program.c.s
.PHONY : program.c.s

source/block.o: source/block.c.o

.PHONY : source/block.o

# target to build an object file
source/block.c.o:
	$(MAKE) -f CMakeFiles/blocklibshar.dir/build.make CMakeFiles/blocklibshar.dir/source/block.c.o
	$(MAKE) -f CMakeFiles/blocklibstat.dir/build.make CMakeFiles/blocklibstat.dir/source/block.c.o
.PHONY : source/block.c.o

source/block.i: source/block.c.i

.PHONY : source/block.i

# target to preprocess a source file
source/block.c.i:
	$(MAKE) -f CMakeFiles/blocklibshar.dir/build.make CMakeFiles/blocklibshar.dir/source/block.c.i
	$(MAKE) -f CMakeFiles/blocklibstat.dir/build.make CMakeFiles/blocklibstat.dir/source/block.c.i
.PHONY : source/block.c.i

source/block.s: source/block.c.s

.PHONY : source/block.s

# target to generate assembly for a file
source/block.c.s:
	$(MAKE) -f CMakeFiles/blocklibshar.dir/build.make CMakeFiles/blocklibshar.dir/source/block.c.s
	$(MAKE) -f CMakeFiles/blocklibstat.dir/build.make CMakeFiles/blocklibstat.dir/source/block.c.s
.PHONY : source/block.c.s

# Help Target
help:
	@echo "The following are some of the valid targets for this Makefile:"
	@echo "... all (the default if no target is provided)"
	@echo "... clean"
	@echo "... depend"
	@echo "... edit_cache"
	@echo "... rebuild_cache"
	@echo "... blocklibshar"
	@echo "... dynamic_block"
	@echo "... blocklibstat"
	@echo "... static_block"
	@echo "... program.o"
	@echo "... program.i"
	@echo "... program.s"
	@echo "... source/block.o"
	@echo "... source/block.i"
	@echo "... source/block.s"
.PHONY : help

#=============================================================================
# Special targets to cleanup operation of make.

# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
	$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system
```
The sizes of the generated executables were exactly the same as the makefile that was written by hand (static_block: 8747 bytes, dynamic_block: 8600 bytes)

The result of running the executables is:

![](Makefiles/result.png)

The resources below were useful for learning how to write CMake and Make files.

https://www.cprogramming.com/tutorial/shared-libraries-linux-gcc.html

https://mirkokiefer.com/cmake-by-example-f95eb47d45b1

license: Unlicense


text:
---
layout: single
title: "The PowerShell Profile"
excerpt: "How to improve your PowerShell user Environment.
 One of PowerShell's most under-utilised admin assistants."
header:
    overlay_image: /assets/images/banner-images/remove-blogserver-marmoset.png
    overlay_filter: rgba(90, 104, 129, 0.75)
    teaser: /assets/images/default-teaser-image.png
toc: true
toc_label: Admin Assistant
toc_icon: user-secret
toc_sticky: true
date: 2021-01-02T08:30:00
last_modified_at: 2021-01-03T08:30:00
categories:
    - Blog
tags:
    - PowerShell
    - Admin
    - Profile
---

{: .text-right}
<button onclick="window.print()">Print</button>

#  PowerShell you say....?

As this year has progressed and COVID-19 has increasingly changed the way we manage both our home and work lives, I am sure many administrators have found the requirement to use PowerShell to orchestrate their fleet of computers, servers and services more common than ever.

Many companies were forced into pandemic fuelled digital transformation in order to enable their workforce to continue to function. IT Departments will now find a mixture of their servers and services hosted both on-premise and hosted on some flavour of cloud platform; [Amazon Web Services][1]{:target="\_blank"}, [Microsoft O365][2]{:target="\_blank"} / [Microsoft Azure][3]{:target="\_blank"} or [Google Cloud Platform][4]{:target="\_blank"}

As a result, fixing everyday issues may now require a few more hoops to jump through before you can just open 'Active Directory Users & Computers' and hit "reset password".

The ability to be able to create your own bespoke tooling to be used for administration of frequently time consuming tasks makes PowerShell the perfect tool for every IT Admin's arsenal. Everyday user checks can be performed quickly and can be tuned to your own needs or your teams needs.

{: .text-right}
Back to Top

#  But PowerShell is painful...

As with any tool, there are a few things you need to configure in order to prevent your experience from being painful and a few tweaks that will make it far easier to use and a much more enjoyable experience. There are also a handful of basic commands that will generally get you out of trouble or help you get on the right track

##  Execution Policy

The first hurdle most PowerShell users first need to overcome relates to the PowerShell execution policy. PowerShell's execution policy is a safety feature that controls the conditions under which PowerShell loads configuration files and runs scripts. This feature helps prevent the execution of malicious scripts.

On a Windows computer you can set an execution policy for the local computer, for the current user, or for a particular session. You can also use a Group Policy setting to set execution policies for computers and users.

Execution policies for the local computer and current user are stored in the registry. You don't need to set execution policies in your PowerShell profile. The execution policy for a particular session is stored only in memory and is lost when the session is closed.

The execution policy isn't a security system that restricts user actions. For example, users can easily bypass a policy by typing the script contents at the command line when they cannot run a script. Instead, the execution policy helps users to set basic rules and prevents them from violating them unintentionally.

Every user, whether a Local Administrator or not, can change the execution policy to allow them to run scripts as follows:-

```powershell
# Current User Policy
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser -Force

# Machine Policy - Requires Local Admin rights
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force
```

Without configuring this setting, you will be unable to run any scripts or indeed your PowerShell Profile

*Further reading*

docs.microsoft.com - [Set-ExecutionPolicy][9]{:target="_blank"}

devblogs.microsoft.com - [Change PowerShell Script Execution Policy][10]{:target="_blank"}

blog.itpro.tv - [SET-EXECUTIONPOLICY][11]{:target="_blank"}

devblogs.microsoft.com - [Scripting Guy - Weekend Scripter][12]{:target="_blank"}

{: .text-right}
Back to Top

##  PowerShell Profiles?

There are several articles scattered around the internet that already provide either a cursory overview of the PowerShell profiles or a detailed explanation of their functionality. Here are a handful of articles that will no doubt explain anything that I miss.

*Further reading*

devblogs.microsoft.com - [Understanding the Six PowerShell Profiles][5]{:target="_blank"}

docs.microsoft.com - [About Profiles][6]{:target="_blank"}

deployhappiness.com - [What is the PowerShell Profile and Why Should I Care?][7]{:target="_blank"}

red-gate.com - [Persistent PowerShell: The PowerShell Profile][8]{:target="_blank"}

###  Creating your own Profile

By default your user account will not have any profile files created but it is a simple task to create your own. You can create a blank profile file by copying and pasting the following command:-

```powershell
if (!(Test-Path -Path $PROFILE)) {
  New-Item -ItemType File -Path $PROFILE -Force
}
```

Entering the environment variable $PROFILE, will show you the path for your blank profile.

```powershell
PS C:\> $profile
C:\Users\YOURUSERNAME\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
```

###  OK, I have one, now what do I do?

You can very easily edit your profile by entering:-

```powershell
PS C:\> notepad $PROFILE
```

Your blank file will open and you can start adding features to your profile.

{: .text-right}
Back to Top

---

####  Example Exchange Functions

If you have an on-premise Exchange Servers, you can copy the following code, replacing **`http://INTERNAL-EXCHANGE-URI/PowerShell/`** with your servers address.

_This will enable you to use_ **`New-OnPremExchangeSession`** _when you open your profile. No longer requiring you to copy and paste your current strings from your notepad repository of useful commands._

Example Exchange Functions

{: .text-right}
Back to Top

---

####  Example PowerShell Profile

This example adds logic to the profile enabling you to run a particular section of your profile by pressing and holding LeftCtrl/LeftShift/None keys prior to running your PowerShell Session. Selecting one of these options will provide a different set of functions when the Shell starts. This has enabled me to separate Work and Home Functions and also load a session with the noprofile switch from within a single profile.

_If you use this example, you will need replacing_ `http://INTERNAL-EXCHANGE-URI/PowerShell/` _with your servers address._

Example PowerShell Profile

{: .text-right}
Back to Top

---

####  Example Notes

-   _As you can see from these examples, utilising your PowerShell profile can enable you to speed up the process of using your currently saved Functions by placing them in your profile to enable them to auto-load each time you start a New Session._

-   _I would recommend that you do not run any code obtained from the internet without understanding what it will do._

{: .text-right}
Back to Top

---

##  Useful Commands

```powershell
CommandType     Name                  Version    Source
-----------     ----                  -------    ------
Cmdlet          Get-Help              <IP_ADDRESS>    Microsoft.PowerShell.Core
Cmdlet          Get-Member            <IP_ADDRESS>    Microsoft.PowerShell.Utility
Cmdlet          Get-Command           <IP_ADDRESS>    Microsoft.PowerShell.Core
Function        Find-Module           2.2.3      PowerShellGet
Cmdlet          Get-Module            <IP_ADDRESS>    Microsoft.PowerShell.Core
```

There are plenty of different CmdLets, Functions and Modules to play with but there are a handful of commands that will be the most useful. Microsoft recommend that you make very good use of the help function and the PowerSHell founder [Jeff Snover][14]{:target="\_blank"}, goes so far as to say that you should master this command

{: .text-right}
Back to Top

###  Update PowerShell Help

When you first use PowerShell, the local copy of the PowerShell help topics when accessed for the first-time has to be downloaded. It's recommended to periodically update the help system because there can be updates to the help content from time to time. The Update-Help cmdlet is used to update the help topics. It requires internet access by default and for you to be running PowerShell elevated as an administrator.

```powershell
Running the folowing commands will download an updated version of the help files.

PS C:\> Update-Help -Force
```

{: .text-right}
Back to Top

###  Get-Help

This is by far my most used command. There are a huge number of commands available in PowerShell and it would be impossible to learn them all. As PowerShell has provided a uniform way to use commands and their switches, using the help for each new command.

```powershell
Take for example, our old DOS favourite `DIR`
This command has been replaced by Get-Childitem

PS C:\GitRepos> Get-Alias -Name DIR

CommandType     Name
-----------     ----
Alias           dir -> Get-ChildItem
```

Using Get-Help, you can easily find out how to use the command by looking at examples contained within `Get-ChildItem` help.

```powershell
PS C:\> Get-Help Get-ChildItem -Examples

NAME
    Get-ChildItem

SYNOPSIS
    Gets the items and child items in one or more specified locations.

    --- Example 1: Get child items from a file system directory ---

    Get-ChildItem -Path C:\Test

    Directory: C:\Test

    Mode                LastWriteTime         Length Name
    ----                -------------         ------ ----
    d-----        2/15/2019     08:29                Logs
    -a----        2/13/2019     08:55             26 anotherfile.txt
    -a----        2/12/2019     15:40         118014 Command.txt
    -a----         2/1/2019     08:43            183 CreateTestFile.ps1
    -ar---        2/12/2019     14:31             27 ReadOnlyFile.txt
```

You may just want to view a single parameter.

```powershell
PS C:\> Get-Help Get-ChildItem -Parameter Directory

-Directory <System.Management.Automation.SwitchParameter>
    To get a list of directories, use the Directory parameter or the Attributes parameter with the Directory property. You can use the Recurse parameter with Directory .

    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       False
    Accept wildcard characters?  false
```

Please experiment with `Get-Help` and read the articles below as your ability to get started with any new commands can only benefit from your practice.

*Further reading*

[Microsoft - The Help System][13]{:target="_blank"}

[Microsoft - Get-Help][15]{:target="_blank"}

[How To Get More Help with PowerShell Cmdlets][16]{:target="_blank"}

[Using the PowerShell Help Command Get-Help][17]{:target="_blank"}

{: .text-right}
Back to Top

## Conclusion

If you have made it to the end of the article, well done, I hope it has been useful. There are many different things that can be achieved with PowerShell, supercharge your PowerShell Session and make those stored functions more useful.

{: .text-center}
Back to Top

[1]: https://aws.amazon.com/
[2]: https://www.office.com/
[3]: https://azure.microsoft.com/
[4]: https://cloud.google.com/
[5]: https://devblogs.microsoft.com/scripting/understanding-the-six-powershell-profiles/
[6]: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles
[7]: https://deployhappiness.com/what-is-the-powershell-profile-and-why-should-i-care/
[8]: https://www.red-gate.com/simple-talk/sysadmin/powershell/persistent-powershell-the-powershell-profile/
[9]: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/set-executionpolicy
[10]: https://devblogs.microsoft.com/scripting/powertip-change-powershell-script-execution-policy/
[11]: https://blog.itpro.tv/set-executionpolicy-powershell-cmdlet/
[12]: https://devblogs.microsoft.com/scripting/hey-scripting-guy-weekend-scripter-the-scripting-wife-sets-the-script-execution-policy/
[13]: https://docs.microsoft.com/en-us/powershell/scripting/learn/ps101/02-help-system
[14]: http://www.jsnover.com/Docs/MonadManifesto.pdf
[15]: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/get-help
[16]: https://redmondmag.com/articles/2018/07/17/get-more-help-with-powershell-cmdlets.aspx
[17]: https://adamtheautomator.com/powershell-help-command-get-help/

license: MIT

branch_name: refs/heads/master

extension: md

gha_language: JavaScript

gha_license_id: MIT

license_type: permissive


text:
[![Actions Status](https://github.com/tbrowder/Proc-More/workflows/test/badge.svg)](https://github.com/tbrowder/Proc-More/actions)

### Note: This module replaces module `Linux::Proc::Time` which is deprecated.

This module provides functions using Raku's **Proc** class.  Two of the most noteworthy ones are:

+ `run-command`
+ `time-command`

This module uses the GNU **time** command (usually installed as
'/usr/bin/time') to time user commands.

### WARNING:  These functions have been successfully tested only on Linux and OSX systems (but the author plans to port them to other OSs).

## Synopsis

    use Proc::More :run-command;
    my $cmd = "some-user-prog arg1 arg2";
	my $other-dir = $*TMPDIR";
    my ($exitcode, $stderr, $stdout) = run-command $cmd, :dir($other-dir), :all;

    use Proc::More :time-command;
    my $cmd = "some-user-prog arg1 arg2";
    my $user-time = time-command $cmd;
    say $user-time; # output: 42.70 # seconds

## Getting the **time** command

On Debian hosts the **time** command may not installed by default, but
it is available in package 'time'.  It can also be built from source
available at the Free Software Foundation's git site.  Clone the
source repository:

    $ git clone https://git.savannah.gnu.org/git/time.git

The build and install instructions are in the repository along with the source code.

Unfortunately, there is no equivalent command available for Windows
unless you install Cygwin or an equivalent system.

## The **time** command

The details for running **time** are described in **time**'s man page which can be viewed by
running 'man 1 time' at the command line.

This module will look for time in the following locations and order:

- the location defined by the LINUX_PROC_TIME environment variable
- /usr/local/bin/time
- /usr/bin/time

If the **time** command is not found, an exception will be thrown.
Likewise, if the **time** command returns an exit code other than
zero, an exception will be thrown.

# The Proc::More module

The routines are described in detail in
[ALL-SUBS](https://github.com/tbrowder/Proc-More/blob/master/docs/ALL-SUBS.md)
which shows a short description of each exported routine along with
its complete signature.

## The :$typ and :$fmt named parameters

The two named parameters control the type and format of the output
from the time-command.  (Note there is a fourth format which is used
if the **:$fmt** variable is not used or defined.  In that case only
the raw time in seconds is shown without any other formatting.)  The
allowed values and a short description are described in the source
code and are repeated here:

```Raku
my token typ { ^ :i             # the desired time(s) to return:
                    a|all|      # show all three times:
                                #   "Real: [time in desired format]; User: [ditto]; Sys: [ditto]"
                    r|real|     # show only the real (wall clock) time
                    u|user|     # show only the user time (default)
                    s|sys       # show only the system time
             $ }
my token fmt { ^ :i             # the desired format for the returned time(s)
                    s|seconds|  # time in seconds with an appended 's': "30.42s"
                    h|hms|      # time in hms format: "0h00m30.42s"
                    ':'|'h:m:s' # time in h:m:s format: "0:00:30.42"
             $ }
```

## Status

This version is 0.\*.\* which is considered usable but may not be
ready for production.  The APIs are subject to change in which case
the version major number will be updated. Note that newly added
subroutines or application programs are not considered a change in
API.

## Debugging

For debugging, use one of the following methods:

- set the module's $DEBUG variable:

```Raku
$Proc::More::DEBUG = True;
```

- set the environment variable:

```Raku
PROC_MORE_DEBUG=1
```

## Contributing

Interested users are encouraged to contribute improvements and
corrections to this module, and pull requests, bug reports, and
suggestions are always welcome.

COPYRIGHT and LICENSE
=====================

Copyright © 2017-2021 Tom Browder<EMAIL_ADDRESS>
This library is free software; you may redistribute or modify it under the Artistic License 2.0.

repository: tbrowder/Proc-More

repo_name: tbrowder/Proc-More


text:
## How to Participate in CHAOSS?

- Introduce yourself on the mailing list.
- Join us in our weekly video conferences.
- Pick a project or working group and fork the GitHub repository.
- Come see us at [conferences, workshops, and hackathons](https://chaoss.community/community/#user-content-upcoming-events).

The CHAOSS community is dedicated to fostering an open and welcoming environment for contributors.
Please read our [Code of Conduct](https://chaoss.community/about/code-of-conduct/) to learn more about participating in CHAOSS.

repository: theexplorist/website

repo_name: theexplorist/website


text:
# Origami Logs

A github changelog generator for your release notes.

[![Build Status](https://travis-ci.org/xogroup/origami-logs.svg?branch=master)](https://travis-ci.org/xogroup/origami-logs)

## Installation

```npm i -g origami-logs```

## First Step

Create a file named `.origami-logs-config.json` in the root of your project.

The file should look something like this:

```
{
  "github":{
    "apiUrl": "https://git.somedomain.com/api/v3",
    "token": "123456",
    "repository": "Organization/repo-name"
  }
}
```

## How to use

TO RUN:

```
changelog generate --tags "startingTag,endingTag"

```

To see all other options:

```
changelog generate --help
```

## Config Options Explained

If you wish to add other config options it might look like this:

```
{
  "github":{
    "apiUrl": "https://git.somedomain.com/api/v3",
    "token": "123456",
    "repository": "Organization/repo-name"
  },
  "aliases": {
    "enhancement": [
      "feature"
    ]
  },
  "extraLabels": {
    "chore": "Chores Completed:"
  },
  "extras": {
    "pivotal":{
      "boardID": "1234567"
    }
  }
}
```

* `github`: *REQUIRED* The info about the given repository you wish to get the changelog format for markdown
* `aliases`: This is to be used if you want to use your own custom labels but still conform to the enhance/bug format.
  * IE: You might have a feature label but still want it to show `Features Implemented` on the changelog.
* `extraLabels`: Define your own custom labels and changelog headings
* `extras`: Where additional connections live
  * `pivotal`: Supports linking pivotal stories in your change log assuming commits conform to the format:
    `[#STORY_ID_HERE] Commit Message here`
    * `boardID`: Pivotal Board ID (Found at the end of the url such as `https://www.pivotaltracker.com/n/projects/ID-HERE`)

## Development

To test locally run
```
node cli.js generate --tags "TAG1,TAG2"
```

repository: xogroup/origami-logs

repo_name: xogroup/origami-logs


text:
# Inception v3 in TensorFlow

The [Inception v3](https://github.com/tensorflow/models/tree/master/research/slim) network can be used for image classification.  The provided Makefile does the following:
1. Download the TensorFlow checkpoint file
2. Run the conversion/save python script to generate `network.meta` file
3. Profile, Compile and Check the network using the Neural Compute SDK
4. There is a `run.py` provided that does a single inference on a provided image as an example on how to use the network using the Neural Compute API

---
## Makefile

Provided `Makefile` describes various targets that help with the above mentioned tasks.

### `make all`

* Makes the following: `profile`, `compile`, and `run`.
* **NOTICE:** It will take few minutes during this command!

### `make profile`

Runs the provided network on the NCS and generates per layer statistics that are helpful for understanding the performance of the network on the Neural Compute Stick.

### `make compile`

* Uses the network description and the trained weights files to generate a Movidius internal "graph" format file.
* This file is later used for loading the network on to the Neural Compute Stick and executing the network.

### `make run`

Runs the provided `run.py` file which sends a single image to the Neural Compute Stick and receives and displays the inference results.

### `make check`

Runs the network on Caffe on CPU and runs the network on the Neural Compute Stick. Check then compares the two results to make sure they are consistent with each other.

### `make clean`

Removes all the temporary files that are created by the `Makefile`

---
## Example Result

Make sure you have already run `make all` before `make run` as follow:

```bash
# Run "run.py" and show an example result
$ make run
......
......
Number of categories: 1001
Start download to NCS...
*******************************************************************************
inception-v3 on NCS
*******************************************************************************
547 electric guitar 0.988281
403 acoustic guitar 0.00778961
715 pick, plectrum, plectron 0.00153923
421 banjo 0.000959396
820 stage 0.000690937
*******************************************************************************
Finished
```

repository: yungshenglu/ncsdk-practice

repo_name: yungshenglu/ncsdk-practice


text:
# T10-Gait

Foot segment identification from footsteps on pressure pads

Google Drive folder is here: https://drive.google.com/open?id=0B2WhXU_IjE68cjlmMzZZdV9iMm8

Proposal is here: https://drive.google.com/open?id=1vuIcVz8KHbXqyjY4PWqkA_2YfWaEg1bcKuxf7oa9vcg

### Conditional Random Field training

File `main.m` trains a Conditional Random Field (CRF) model. It is heavily based off of `sophisticated_example.m`.

Setup:

1. Download JustinsGraphicalModelToolbox from the Google Drive, or from Slack.
Unzip it and move it into the root of the project. The folder "JustinsGraphicalModelToolboxPublic" should be
in the same folder as this README.
2. Rename `JustinsGraphicalModelsToolboxPublic/External/toolbox/external/other/savefig.m` to
`JustinsGraphicalModelsToolboxPublic/External/toolbox/external/other/savefig_m.m`. We rename it
because it has the same name as a MATLAB builtin and causes problems.
3. Add the graphical model toolbox to MATLAB's path, recursively. Do this by
running `>> addpath(genpath('JustinsGraphicalModelsToolboxPublic'));` in MATLAB.

Train:

1. In MATLAB, run `>> main`.

### Semi-Automated Foot Labelling

File `labelling_automation/label_foot.m` is a function which will guide you
through converting an image of a labelled foot into proper labelled foot data
which the system can consume in model training.

The paths are hardcoded. It must be run from within `labelling_automation`.

![foot labelling tool screencast](README-resources/3x-labelling-tool.gif)

Example: labeling FinalData/NP40/3108

```
>> cd labelling_automation
>> label_foot('NP40', '3108'`)
```

In this case, the files `FinalData/NP40/3108.jpg` and `FinalData/NP40/3108.lst` must exist.
The jpg file is an image of an expert-segmented image, and the lst file is the footstep data
file for the given image.

The first step shows a picture of the labelled foot and instructs the user
to resize a rectangle to fit the outline of the colored squares. Each step after that
shows a picture of the labelled foot and instructs the user to trace one labelled region.

The region mask is then converted from pixel-coordinates to .lst-file coordinates and
the result is written to a .mat file in `labels_data`.

It also moves the matching .lst file to `training_test_data`.

### Files, Directories

Directory `training_test_data` contains pedobarograph (pressure pad) data.

- Each `.lst` file represents one reading of a single footstep on the pedobarograph.
It is read using `pedo_extract.m`.

Directory `labels_data` contains labeled matrices.

- Each `.mat` file is a labelled matrix corresponding to the max-pressure map
of the `.lst` file with the same id, eg `pb_data/NP10_2651.lst` corresponds to `labels_data/NP10_2651.mat`.
- The labelled matrix contains 1s for the great toe, 2s for the lateral forefoot,
3s for the medial forefoot, 4s for the heel, and 0s for all other entries.

File `pedo_extract.m` (Written by: Quinn Boser, July 2013) takes a `lst` file and returns

1. a 3d struct array with dimensions (x,y,time)
2. a 2d max-pressure map with dimensions (x,y)
3. the length of the x dimension
4. the length of the y dimension
5. the length of the time dimension

File `pedo_format.txt` describes the format of an `.lst` file. It is used by `pedo_extract.m`.

File `get_params.m` reads the number of rows, columns, and frames from an `.lst` file, where frames is the length of the time dimension. It is used by `pedo_extract.m`.

File `JaccardScore.m` takes 2 matrices, A and B, and returns their Jaccard Score.

File `silly_example.m` is a small example of training a Conditional Random Field (CRF) on noise. It is pulled from http://users.cecs.anu.edu.au/~jdomke/JGMT/#binarydenoising under the MIT License.

File `sophisicated_example.m` is an example of training a Conditional Random Field (CRF) on the Stanford Backgrounds dataset. It is pulled from http://users.cecs.anu.edu.au/~jdomke/JGMT/#backgrounds under the MIT License.


text:
[<<< Previous question <<<](0635.md)   Question ID#0636.md   [>>> Next question >>>](0637.md)
---

When using a function such as strip_tags, are markup-based attacks still possible?

- [ ] A) Yes, attributes of allowed tags are ignored
- [ ] B) No, HTML does not pose any security risks
- [ ] C) Yes, even a
 HTML tag is a security risk
- [ ] D) No, strip_tags will prevent any markup-based attack

Answer

  Answer: A

repository: alceanicu/zce

gha_language: TypeScript

repo_name: alceanicu/zce


text:
At the moment this has only been tested under Linux.
I'm fairly sure getting it all working under OSX would be pretty simple.
Windows is a completely different matter and will probably take a lot of work.

## Dependencies

You will need LibXtract, which you can find here:
https://github.com/jamiebullock/LibXtract/

You will also need the Octave package developer libraries. These are available in the octave-pkg-dev package in ubuntu.

## Installation

Install the above dependencies first, then (all being well) running make in the XtractOctave directory should build everything for you.

If that worked there should now be a load of .oct file in the directory. If these files are in Octave's search path the functions should all be usable.

## Documentation

Documentation is available in the same way it is for all Octave functions, using the help command in the octave prompt.

## License

Copyright (C) 2014 Sean Enderby

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

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

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

repository: seanlikeskites/XtractOctave

repo_name: seanlikeskites/XtractOctave


text:
### [CVE-2014-1482](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-1482)
![](https://img.shields.io/static/v1?label=Product&message=n%2Fa&color=blue)
![](https://img.shields.io/static/v1?label=Version&message=n%2Fa&color=blue)
![](https://img.shields.io/static/v1?label=Vulnerability&message=n%2Fa&color=brighgreen)

### Description

RasterImage.cpp in Mozilla Firefox before 27.0, Firefox ESR 24.x before 24.3, Thunderbird before 24.3, and SeaMonkey before 2.24 does not prevent access to discarded data, which allows remote attackers to execute arbitrary code or cause a denial of service (incorrect write operations) via crafted image data, as demonstrated by Goo Create.

### POC

#### Reference
- http://www.oracle.com/technetwork/topics/security/bulletinapr2016-2952098.html

#### Github
No PoCs found on GitHub currently.

repository: trickest/cve

branch_name: refs/heads/main

gha_language: HTML

repo_name: trickest/cve


text:
This file is part of eRCaGuy_hello_world: https://github.com/ElectricRCAircraftGuy/eRCaGuy_hello_world

# Socket examples & study

1. \*\*\*\*\*+ EXCELLENT example code, UDP sending and receiving examples, multicast, etc: https://wiki.python.org/moin/UdpCommunication
1. TCP example code: https://wiki.python.org/moin/TcpCommunication
1. https://docs.python.org/3/library/select.html#poll-objects - select — Waiting for I/O completion — Python 3.11.4 documentation [GS notes: how to do Ethernet polling in Python: create a socket, call `poll.register(fd)` to pass in the socket fd file descriptor, then call `poll.poll([timeout_ms])` to get back an iterable tuple of `(fd, event)` 2-tuples telling me which socket file descriptors are ready to be read and have data right now!; how to do ethernet socket polling in Python--see my notes to the left!]

# Examples

From: https://wiki.python.org/moin/UdpCommunication

1. UDP sender ("client"):
    ```bash
    import socket

    UDP_IP = "<IP_ADDRESS>"
    UDP_PORT = 5005
    MESSAGE = b"Hello, World!"

    print("UDP target IP: %s" % UDP_IP)
    print("UDP target port: %s" % UDP_PORT)
    print("message: %s" % MESSAGE)

    sock = socket.socket(socket.AF_INET, # Internet
                         socket.SOCK_DGRAM) # UDP
    sock.sendto(MESSAGE, (UDP_IP, UDP_PORT))
    ```

1. UDP receiver ("server")
    ```bash
    import socket

    UDP_IP = "<IP_ADDRESS>"
    UDP_PORT = 5005

    sock = socket.socket(socket.AF_INET, # Internet
                         socket.SOCK_DGRAM) # UDP
    sock.bind((UDP_IP, UDP_PORT))

    while True:
        data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes
        print("received message: %s" % data)
    ```

From: https://wiki.python.org/moin/TcpCommunication

1. TCP sender ("client"): see link above.
1. TCP receiver ("server"): see link above.

gha_language: Assembly


text:
Template: bookref
BookName: Analytical Chemistry Volume 2 Quantitative Analysis
BookAuthor: F. P. Treadwell & William T. Hall
BookPublisher: John Wiley & Sons
BookLanguage: 英语
BookCover: /images/Covers/Analytical Chemistry Volume 2 Quantitative Analysis - F. P. Treadwell & William T. Hall.jpg
BookBaidupanDownloadUrl: https://pan.baidu.com/s/1ibVySS7qBNcTtG5PgMsYwA
BookBaidupanDownloadCode: la7q

[TOC]

本书pdf是文字识别版的，影印质量还行。

相关书籍：

- [Analytical Chemistry Volume 1 Qualitative Analysis]({filename}./Analytical Chemistry Volume 1 Qualitative Analysis - F. P. Treadwell & William T. Hall.md)
- [Analytical Chemistry Volume 2 Quantitative Analysis]({filename}./Analytical Chemistry Volume 2 Quantitative Analysis - F. P. Treadwell & William T. Hall.md)

### Introduction

1.1 Gravimetric and Volumetric Analysis

1.2 Direct and Indirect Analyses

1.3 Weighing

1.4 Reduction of Weighing to Vacuo

1.5 Testing of Weights

1.6 Filtration and Washing of Precipitates

1.7 Drying and Igniting of Precipitates

1.8 Evaporation of Liquids

1.9 Drying Substances in Currents of Gases

1.10 Preparation of the Substance for Analysis

1.11 Recrystallization

### Gravimetric Determination of The Metals

2.1 Group Ⅴ(Alkalies)

2.2 Group Ⅳ(Alkaline Earths)

2.3 Group Ⅲ

2.4 Group Ⅱ

2.5 Group Ⅰ

### Gravimetric Determination of The Metalloids

3.1 Group Ⅰ

3.2 Group Ⅱ

3.3 Group Ⅲ

3.4 Group Ⅳ

3.5 Group Ⅴ

3.6 Group Ⅵ

3.7 Group Ⅶ

### Volumetric Analysis

4.1 Acidimetry and Alkalimetry

4.2 Oxidation and Reduction Methods

4.3 Precipitation Analyses

### Gas Analysis

url: https://raw.githubusercontent.com/a358003542/a358003542.github.io/aa0fe86f152c127dc8f6dc319483bc9999a08d85/content/articles/化学/化学 - 化学实验/化学 - 化学实验 - 分析化学/Analytical Chemistry Volume 2 Quantitative Analysis - F. P. Treadwell & William T. Hall.md


text:
shellfish

  shellfish, your go-to template for the perfect stack.

## 🚀 Quick Start

The interactive CLI will guide you to easily setup your project.

```
npm run get-started
```

## 📋 Table of Contents

- [About the Project](#-about-the-project)
- [Demo Application](#-demo-application)
  - [Technical Stack](#technical-stack)
- [Getting Started](#-getting-started)
  - [Prerequisites](#prerequisites)
  - [Copy the template](#copy-the-template)
  - [Make it yours](#make-it-yours)
  - [Run the application](#run-the-application)
  - [Continuous Integration](#continuous-integration)
  - [Deployment](#deployment)
    - [Digital Ocean App Platform](#digital-ocean-app-platform)
    - [Kubernetes](#kubernetes)
- [Implementation](#%EF%B8%8F-implementation)
  - [Database](#database)
    - [Postgres](#postgres)
    - [Mongo](#mongo-not-recommended)
    - [Data seeding](#data-seeding)
  - [Backend](#backend)
  - [Frontend](#frontend)
  - [General](#global)

## 📚 About the Project

Have you ever started a new project by yourself?
If so, you probably know that it is tedious to set up all the necessary tools.

Indeed, this template is opinionated as to what's the best, but it does enforce excellent practices such as **code re-usability**, **enforces coding guidelines**, **usage of a monorepo**, etc.

If you want more details about how this idea was implemented, I recommend reading the [series of blog articles](https://yann510.hashnode.dev/creating-the-modern-developer-stack-template-part-1-ckfl56axy02e85ds18pa26a6z) I wrote on the topic.

## 🦄 [Demo Application](https://www.shellfish.dev)

This template includes a demo **todo application** that serves as an example of sound patterns.
Of course, you won't be creating a todo application for your project, but you can use this as an example of useful patterns and learn how to use the technologies presented in this project.

![demo application](readme-assets/todo-demo.gif)

### Technical Stack

| Database                                         | Backend                                        | Frontend                                                      |
| ------------------------------------------------ | ---------------------------------------------- | ------------------------------------------------------------- |
| [Postgres](https://github.com/postgres/postgres) | [Nest](https://github.com/nestjs/nest)         | [React](https://github.com/facebook/react)                    |
| [Mongo](https://github.com/mongodb/mongo)        | [Fastify](https://github.com/fastify/fastify)  | [React Router](https://github.com/ReactTraining/react-router) |
|                                                  | [TypeORM](https://github.com/typeorm/typeorm)  | [Redux Toolkit](https://github.com/reduxjs/redux-toolkit)     |
|                                                  | [NestJs CRUD](https://github.com/nestjsx/crud) | [axios](https://github.com/axios/axios)                       |

## 💥 Getting Started

### Prerequisites

- [Docker Compose](https://docs.docker.com/compose/install/)
- [node.js](https://nodejs.org/en/download/) v14.x

### Copy the template

This repository is a repository template, which means you can use the `Use this template` button at the top to create your project based on this.

![use template button](readme-assets/use-template.png)

\*Note: If you have an existing repository, this will require more work. I would recommend using the `use template button` and migrating your current code to the newly created projects.

### Make it yours

You will now want to make this project yours by replacing all organization and project naming occurrences with your own names.
Thankfully, we have a script just for that:

```
npm run rename-project -- --organization {YOUR_ORGANIZATION_NAME} --project {YOUR_PROJECT_NAME}
```

\*Note: I highly recommend that the project name is the same as your git repository.

The file will delete itself once it has been completed.
On completion, you will see the following message:

![project appropriation success](readme-assets/project-appropriation-success.png)

### Run the application

First, install the dependencies:

```
npm i
```

Then, run the whole stack:

```
npm run postgres
```

```
npm start api
```

```
npm start webapp
```

Finally, why not test it:

```
npm run affected:test && npm run affected:e2e
```

For a full list of available commands, consult the `package.json`.

### Continuous Integration

This templates integrates Github Actions for its Continuous Integration. The existing workflows are under `.github/workflows`.
To have the CI working, you must:

1. Link your repository with [Coveralls](https://coveralls.io/repos/new).
1. (Optional) Insert your [Nx Cloud](https://nx.app/) access token in github secrets under `NX_CLOUD_TOKEN`. This enables for caching and faster build times.

### Deployment

The application can be deployed in two different ways, depending on your objectives.

#### Digital Ocean App Platform

For a simple and fast deployment, the new [App Platform](https://www.digitalocean.com/docs/app-platform/) from Digital Ocean makes it easy to work with monorepos. For our todo app, the config file lies under `.do/app.yaml`. There, you can change the configuration of the different apps being deployed. [The spec can be found here.](https://www.digitalocean.com/docs/app-platform/references/app-specification-reference/)

To deploy this full stack application yourself, follow the steps below:

1. Create an account on [Digital Ocean Cloud](https://m.do.co/c/67f72eccb557) (this is a sponsored link) and enable Github access
1. Install [doctl CLI](https://www.digitalocean.com/docs/apis-clis/doctl/how-to/install/)
1. Run `doctl apps create --spec .do/app.yaml`
1. View the build, logs, and deployment url [here](https://cloud.digitalocean.com/apps)

Once done, your app will be hooked to master branch commits as defined in the spec. Therefore, on merge, the application will update. To update the spec of the application, first get the application id with `doctl apps list`, then simply run `doctl apps update <app id> --spec .do/app.yaml`.

#### Kubernetes

More to come..

## ⚙ Implementation

### Database

#### Postgres

There are 2 databases available, postgres and mongo.
To ensure your developers don't get into any trouble while installing those, they are already pre-configured with `docker-compose.yml` files.

**By default, the project uses postgres.**
If this is what you want, you're good to go; everything will work out of the box.

#### Migrations

By default, the automatic synchronization is activated between your models and the database.
This means that making changes on your models will be automatically reflected on your database schemas.
If you would like to control your migrations manually, you can do so by setting `synchronize` to false in `orm-config.ts` file.

Generate migration from your modified schemas:

```
npm run typeorm -- migration:generate -n {MIGRATION_NAME}
```
This will check the difference between models for your defined entities and your database schemas.
If it finds changes, it will generate the appropriate migration scripts.

Run all pending migrations:

```
npm run typeorm -- migration:run
```

To get all the information on migrations, consult [typeorm documentation](https://github.com/typeorm/typeorm/blob/master/docs/migrations.md).

#### Mongo [NOT RECOMMENDED]

If you would like to use mongodb, even though it is absolutely not recommended because it currently doesn't work well with [typeorm](https://github.com/typeorm/typeorm), you can still do that by updating the connection info under `./apps/api/src/config/configuration.ts`.
You simply need to replace `type: "postgres"` with `type: "mongo"`.

#### Data seeding

If you want your database to be pre-populated with that, it is very easy to do so.
For postgres add your `sql` statements to `apps/database/postgres/init.sql` file.
For mongo add your mongo statements to `apps/database/mongo/mongo-entrypoint/seed-data.js` file.

### Backend

We are using cutting edge technologies to ensure that you get the best development experience one could hope for.
To communicate with the database, we make use of the great [typeorm](https://github.com/typeorm/typeorm).
We use the code-first approach, which means defining your models will also represent your tables in your database.
Here is an example:

```typescript
import { Column, Entity } from "typeorm"
import { RootEntity } from "./root.entity"
import { MinLength } from "class-validator"

@Entity()
export class Todo extends RootEntity {
  @Column()
  @MinLength(5, { always: true })
  text: string
}
```

To serve your API requests, we make use of [nest](https://github.com/nestjs/nest) alongside with [fastify](https://github.com/fastify/fastify) to ensure blazing fast [performance](https://github.com/fastify/fastify#benchmarks).

To reduce the boilerplate commonly found around creating a new entity, we are using the [nestjsx/crud](https://github.com/nestjsx/crud) plugin that will generate all necessary routes for CRUD operations.

Here is an example from our todo app:

```typescript
import { Controller } from "@nestjs/common"
import { Crud, CrudController } from "@nestjsx/crud"
import { Todo } from "@shellfish/models"

import { TodosService } from "./todos.service"

@Crud({ model: { type: Todo } })
@Controller("todos")
export class TodosController implements CrudController<Todo> {
  constructor(public service: TodosService) {}
}
```

Of course, you're probably wondering if this actually works.
To convince you, we have implemented integration tests that perform real requests using [supertest](https://github.com/visionmedia/supertest).

**Can I view the generated endpoints?** Well, of course, you can!

We now have generated [swagger documentation](https://github.com/fastify/fastify-swagger) that is viewable with the beautiful [redoc](https://github.com/Redocly/redoc).

Once you navigate to [localhost:3333](http://localhost:3333), you will see this:

![redoc](readme-assets/redoc.png)

### Frontend

For our webapp, we're using the very popular [react](https://github.com/facebook/react) alongside [redux-toolkit](https://github.com/reduxjs/redux-toolkit) and [react-router](https://github.com/ReactTraining/react-router).
We highly recommend that you use [function components](https://reactjs.org/docs/components-and-props.html) as demonstrated in the example.

To further reduce the boilerplate necessary for redux-toolkit we provide you with a `thunkFactory` which allows you to generate all actions needed for a CRUD endpoint.

Here is how you use it:

```typescript
import { Todo } from "@shellfish/models"

import { thunkFactory } from "../utils/thunkFactory"

export const todoThunks = {
  ...thunkFactory<Todo>("/todos"),
}
```

We also provide a `sliceReducerFactory` that will generate the required reducers for the thunks you just created.

Here is how you use it:

```typescript
import { Slice, createSlice } from "@reduxjs/toolkit"
import { Todo } from "@shellfish/models"

import { sliceReducerFactory } from "../utils/sliceReducerFactory"
import { SliceState, getInitialSliceState } from "../utils/SliceState"
import { todoThunks } from "./todos.thunk"

export interface TodoState extends SliceState<Todo> {}

export const todoSlice: Slice = createSlice({
  name: "todos",
  initialState: getInitialSliceState<TodoState, Todo>(),
  reducers: {},
  extraReducers: {
    ...sliceReducerFactory<Todo, TodoState>(todoThunks),
  },
})
```

As you can see, everything is typed adequately. Thus you will get auto-completion when developing.

Now let's say we want to fetch all our todos from our API, we can simply do this:

```typescript
dispatch(todoThunks.getAll())
```

While the API is processing, we would like to add a loading.
That is very easy because our `thunkFactory` handles all of this for us. You can access the loading status like this:

```typescript
todoState.status.getAll.loading
```

For a complete example of CRUD operations, consult the `app.tsx` file.

In our example, we are using [material-ui](https://github.com/mui-org/material-ui), but you could replace that with any other framework.

We also use [axios](https://github.com/axios/axios) to simplify our requests handling as it works very well with TypeScript.

### General

We strongly believe that typing helps create a more robust program; thus, we use [TypeScript](https://github.com/microsoft/TypeScript).

To facilitate and optimize the usage of the monorepo, we make use of [NX](https://github.com/nrwl/nx).

[eslint](https://github.com/eslint/eslint) enforces excellent standards, and [prettier](https://github.com/prettier/prettier) helps you apply them.

Commit messages must abide to those [guidelines](https://www.conventionalcommits.org/en/v1.0.0/). If you need help following them, simply run `npm run commit` and you will be prompted with an interactive menu.

File and directory names are enforced by the custom made `enforce-file-folder-naming-convention.js`.

Branch names are enforced before you even commit to ensure everyone adopts the same standard: `{issue-number}-{branch-work-title-kebab-case}`.

For end to end testing, we use the notorious [cypress](https://github.com/cypress-io/cypress).

We also have a pre-built CI toolkit for you that will build and run the tests.

repository: strathausen/shellfish

repo_name: strathausen/shellfish


text:
# Spinning geometry animation

This HTML 5 canvas animation is based [on a GIF][orig].

* <https://skeeto.github.io/spinning-geometry/>

[orig]: https://redd.it/84018v

repository: skeeto/spinning-geometry

repo_name: skeeto/spinning-geometry


text:
Gretel

An algorithm for recovering haplotypes from metagenomes. Sister to Hansel.

What is it?
-----------

**Gretel** is a Python package providing a command line tool for the recovery of haplotypes
from metagenomic data sets. **Gretel** parses an alignment of reads into a **Hansel** matrix
and uses the evidence of SNP pairs observed to appear on the same reads to probabilistically
reconstruct the most likely haplotypes.

**Gretel** uses an L'th order Markov chain model to reconstruct likely sequences
of variants that constitute haplotypes in the real metagenome.
Our approach involves graph-like traversal of the data within the **Hansel** matrix.
Edges are probabilitically weighted based on the evidence on the reads, as well as
the haplotype as it has been reconstructed so far.

What can I use it for?
----------------------

**Gretel** is designed to recover haplotypes from your data set, without the need for
setting (or optimisation) of any parameters.
**Gretel** does not require a priori knowledge of your input data (such as its contents, or
the true number of haplotypes) and makes no assumptions
regarding the distributions of alleles at variant sites and uses the available evidence
from the aligned reads without altering or discarding the observed varations.

Why should I use it?
--------------------

**Gretel** is the first tool capable of recovering haplotypes from metagenomes.
Whilst tools exist for analogous haplotyping problems, such as the assembly of
viral quasispecies, typically these tools rely on overlap approaches that create
too many unranked haplotypes. **Gretel** is capable of ranking the haplotypes it
outputs by their likelihood.

**Gretel** requires no parameters and our approach is robust to sequencing error
and misalignment noise.

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

    $ pip install numpy hanselx pysam PyVCF

Install
-------

    $ pip install gretel

Alternatively, Gretel has been packaged for bioconda (Thanks [@johnne!](https://github.com/johnne)):

    $ conda install -c bioconda gretel

Usage
-----
You will require a sorted BAM containing your reads, aligned to some pseudo-reference.
You can use any sequence as your reference, such as a consensus assembly of the
metagenomic reads, or a known strain reference (such as HIV-1).
You must bgzip and tabix your VCF.

    $ gretel <bam> <vcf.gz> <contig> -s <1-start> -e <1-end> --master <master.fa> -o <outdir>

Citation
--------
```
@article{10.1093/bioinformatics/btaa977,
    author = {Nicholls, Samuel M and Aubrey, Wayne and De Grave, Kurt and Schietgat, Leander and Creevey, Christopher J and Clare, Amanda},
    title = "{On the complexity of haplotyping a microbial community}",
    journal = {Bioinformatics},
    volume = {37},
    number = {10},
    pages = {1360-1366},
    year = {2021},
    month = {01},
    issn = {1367-4803},
    doi = {10.1093/bioinformatics/btaa977},
    url = {https://doi.org/10.1093/bioinformatics/btaa977},
    eprint = {https://academic.oup.com/bioinformatics/article-pdf/37/10/1360/38663805/btaa977.pdf},
}
```
[Read more on Twitter](https://twitter.com/samstudio8/status/1329406136592834564)

License
-------
Hansel and Gretel are distributed under the MIT license, see LICENSE.

repository: alienzj/gretel

repo_name: alienzj/gretel


text:
# Personal Website

Project of my [personal website](11808s8.github.io).

Using github pages to deploy! :D

## Development
### Requirements
* npm
    (to build and deploy)
* [gulp](https://github.com/gulpjs/gulp): ^4
    * gulp-plugins:
        * gulp-concat: ^2.6.1
        * gulp-inject-partials: ^1.0.5
        * gulp-minify-css: ^1.2.4
### Workflow
run `$ npm install` at your first run, then, after changes, run `$ gulp` inside the directory `./src/` and you're done.

### Project Structure

.html files use partials, emulating a templating engine, but using [gulp-inject-partials](https://github.com/meeroslav/gulp-inject-partials).
Partials start with an underscore and are located into the `./src/html/partial` folder.
Favor reusable code instead of hardcoding entire pages.

gulpfile.js follows the latest [task creating syntax](https://gulpjs.com/docs/en/getting-started/creating-tasks).

Css files are minified and concatenated for production purposes.

Any questions send to<EMAIL_ADDRESS>:D

### Misc

Project using the [Milligram Framework](https://milligram.io/) for responsive css

## License
[MIT License](https://github.com/11808s8/11808s8.github.io/blob/master/LICENSE)

Copyright (c) 2020 Adriano Gomes da Silva


text:
---
layout: post
title: "On the origin of Blue Luminescence in Mg doped GaN"
date: 2017-08-18 16:44:22
categories: arXiv_CV
tags: arXiv_CV GAN
author: Sanjay Nayak, Mukul Gupta, Umesh V. Waghmare, S.M. Shivaprasad
mathjax: true
---

* content
{:toc}

##### Abstract
We uncover the origin of blue luminescence (BL) peak in Mg doped GaN thin film using a combination of experimental X-ray absorption near edge spectroscopy (XANES), first-principles calculations based on density functional theory and full multiple scattering theoretical analysis of various possible defect complexes and their XANES signatures. We demonstrate that a defect complex composed of Mg substituted at Ga site (MgGa) and Mg at interstitial site (Mgi) is primarily responsible for the observed BL by Donor-Acceptor Pair transition (DAP) associated with a deep donor state in the gap. It correlates with a higher (lower) oxidation state of N (Ga) in heavily Mg doped GaN than in its pristine structure, evident in our experiments as well as calculations. Physical and chemical mechanisms identified here point out a route to achieving efficient p-type GaN.

##### Abstract (translated by Google)

##### URL
[https://arxiv.org/abs/1708.04036](https://arxiv.org/abs/1708.04036)

##### PDF
[https://arxiv.org/pdf/1708.04036](https://arxiv.org/pdf/1708.04036)


text:
# About guiExample

![Screenshot of guiExample](examplePanel.png)

### Learning Objectives
This example shows you how to use a GUI to interact dynamically with sketch parameters. It also includes the use of listeners to check for changes.

Pay special attention to the usage of `ofParameter`.

### Expected Behavior

When you open the app, you should see a screen with a hexagon and a number of sliders. Click and move the sliders to change the hexagon.

Try changing the `circle res` slider to create a circle. Try clicking the `fill` toggle.

Pressing the `h` key will hide and show the panel; spacebar sets color to white.

### Classes Used in This File

This example also uses:

	ofSoundPlayer


text:
## Extending limits

The `BETTER_ENUM` macro makes heavy use of the preprocessor, and some of the
internal macros have size limits. There are two: on the number of constants you
can declare, and on the maximum length of a constant name under very specific
conditions. If you run into either one, you can extend the limit by following
the instructions on this page.

The second limit, on the maximum length of a constant name, applies only when
you are compiling an enum in
["full" `constexpr`](${prefix}OptInFeatures.html#CompileTimeNameTrimming) mode
*and* the constant has an initializer. Otherwise, your constants can have names
of arbitrary length.

The default limits are 64 constants in an enum and 23 characters for initialized
constants of full-`constexpr` enums. To extend:

  1. Pick your desired limits. I will use 512 constants and 63 characters as an
     example. Add 1 to the number of characters to account for the null
     terminator — our numbers are now 512 and 64.
  2. Get `make_macros.py` from your copy of the full Better Enums distribution
     or from GitHub.
  3. You will run this script to generate a header file containing some
     replacement macros for `enum.h` to use. Pick a name for this file and a
     location somewhere in your include path. I will assume that this file is
     `common/enum_macros.h` in your project.
  4. Run `python make_macros.py 512 64 > common/enum_macros.h`.
  5. Define `BETTER_ENUMS_MACRO_FILE <common/enum_macros.h>` before including
     `enum.h`. This is typically done by supplying extra flags to the compiler
     on the command line:

     - For g++ and clang++, `-DBETTER_ENUMS_MACRO_FILE='<common/enum_macros.h>'`
     - For VC++, `\DBETTER_ENUMS_MACRO_FILE='<common/enum_macros.h>'`
     - With CMake, you may need something like
       `add_definitions(-DBETTER_ENUMS_MACRO_FILE="$${CMAKE_SOURCE_DIR}/src/enum-macros.h")`

     You can also create a new header file that defines this macro, and then
     includes `enum.h`. Then, include your new file everywhere where you would
     otherwise include `enum.h`:

     ~~~comment
     #pragma once

     #define BETTER_ENUMS_MACRO_FILE <common/enum_macros.h>
     #include <enum.h>
     ~~~

  6. Enjoy the looser limits. Just watch out — increasing the second
     number can really slow down compilation of full-`constexpr` enums.
  7. You don't need `make_macros.py` anymore. It's not part of your build
     process and you can delete it.

---

I am paying attention to feedback, so if more than a few users say that the
default limit of 64 constants is too low, I will increase it to simplify
everyone's command line. The current choice of 64 is basically an arbitrary
guess, loosely informed by the following two facts about macro parameter limits:

- The default limit in Boost.Preprocessor is 64. Though Better Enums does not
  use Boost, I took this number as a guideline.
- The next power of two, 128, is more than [the number Visual C++ supports][vc]
  (127).

[vc]: https://msdn.microsoft.com/en-us/library/ft39hh4x.aspx

%% description =
How to extend limits imposed by internal macros in Better Enums.

repository: mortbopet/better-enums

repo_name: mortbopet/better-enums


text:
# botovod

[![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](
https://github.com/OlegYurchik/botovod/blob/master/LICENSE)
[![built with Python3](https://img.shields.io/badge/built%20with-Python3-red.svg)](
https://www.python.org/)
[![paypal](https://img.shields.io/badge/-PayPal-blue.svg)](
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QEZ85BDKJCM4E)

## Description

This is a simple and easy-to-use library for interacting with the Instagram. The library works
through the web interface of the Instagram and does not depend on the official API

Contents

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

* [Release Notes](#release-notes)
  * [0.1.4](#version-0-1-4)
  * [0.1.5](#version-0-1-5)
  * [0.1.6](#version-0-1-6)
  * [0.1.7](#version-0-1-7)
  * [0.1.8](#version-0-1-8)
* [Getting Started](#getting-started)
  * [Installation from Pip](#installation-from-pip)
  * [Installation from GitHub](#installation-from-github)
  * [Quick Start](#quick-start)
* [User Guide](#user-guide)
  * [What is Botovod](#what-is-botovod)
  * [What is Agent](#what-is-agent)
* [Handlers](#handlers)
* [Examples](#examples)
* [Help the author](#help-the-author)
  * [Contribute repo](#contribute-repo)
  * [Donate](#donate)

## Release Notes

### Version 0.1.4

* Add new dbdriver - Gino
* Fix bugs

### Version 0.1.5

* Add new methods for telegram Agent
* Add emoji

### Version 0.1.6

* Fix gino getting follower
* Adding item assignments for Botovod objects

### Version 0.1.7

* Add new features for telegram agent
* Add start_dialog and start_async_dialog functions
* Fix gino driver bugs

### Version 0.1.8

* Fix utils handlers
* Add new methods for telegram
* Optimize interaction with DB

### Version 0.1.9

* Change Botovod API
* Fix telegram agent
* Remove old info from README.md

## Getting Started

### Installation from Pip

For installation botovod library from pip you should have pip with python (prefer python3.6 or
later)

```bash
pip install botovod
```

### Installation from GitHub

To basic installation from GitHub repository you should have git, python3 (prefer python3.6 or
later), pip (optionally) in your system

```bash
git clone https://github.com/OlegYurchik/botovod.git
cd botovod
pip install .
```

or

```bash
git clone https://github.com/OlegYurchik/botovod.git
cd botovod
python setup.py install
```

### Quick Start

After installation, you can use the library in your code. Below is a sneak example of using the
library

```python3
from botovod import Botovod
from botovod.agents import TelegramAgent

def echo(agent, chat, messsage, follower=None):
    agent.send_message(chat, text=message.text)

botovod = Botovod()
botovod.add_handler(echo)

telegram_agent = TelegramAgent(token="your-telegram-token", method="polling)
botovod.add_agent("telegram", telegram_agent)

botovod.start()
```

This code setup and run Telegram echo-bot by polling

```python3
from botovod import Botovod
from botovod.agents import TelegramAgent
from botovod.dbdrivers.sqlalchemy import DBDriver
from botovod.dialogs import Dialog

class RegisterDialog(Dialog):
    def start(self):
        self.reply(text="Hello, my friend!")
        self.reply(text="What is your name?")
        self.set_next_step(self.what_name)

    def what_name(self):
        name = self.message.text
        self.follower.set_value("name", name)
        self.reply(text="Nice to meet you, %s. What would you want?" % name)
        self.set_next_step(self.menu)

    def menu(self):
        pass
        # your code

dbdriver = DBDriver()
dbdriver.connect(engine="sqlite", database="file.db")
botovod = Botovod(dbdriver)

botovod.add_handler(RegisterDialog)

telegram_agent = TelegramAgent(token="your-telegram-token")
botovod.add_agent("telegram", telegram_agent)

botovod.start()
```

This code setup and run telegram code which working with database and followers

repository: OlegYurchik/botovod

repo_name: OlegYurchik/botovod


text:
### Installation and running this solution
1. Download this repo.
2. With Docker installed on your machine, open terminal and navigate to the folder where you just downloaded the project.
3. Type in the following to create a local image. Creating the image for the first time might take a few minutes.
  - $ docker build -t nfl-rushing .
    - should result in the following - Successfully tagged nfl-rushing:latest
4. Once the previous process is completed, type in the following in terminal.
  - $ docker run --rm -p 3000:3000 nfl-rushing
    - If everything is successful, you will now have a live feed of the web server.
5. Navigating to http://<IP_ADDRESS>:3000/ will take you to the list page. Here you can sort by any coloumn you like and search through all the records. The search also works on the team column. You can also copy your filtered results to clip board, or export to csv or xls.

repository: Andyislam/nfl-rushing

repo_name: Andyislam/nfl-rushing


text:
# Approaches to troubleshooting in bioinformatics – A checklist

When a command is not working, you are getting an unexpected output, etc, it might help you to go through this list to solve the issue!

## Common issues

+ Are you in the right folder / directory? ('mapp' in Swedish) (use `pwd`)
+ Is your input file in the right folder or are you providing the right path to it? (use `ls`)
+ Is your input file what it should be? E.g. is the format correct? (use `less`)
+ Double check the command - any typo in the name of the software, of the files etc, will make it impossible for the command to be executed.
+ If -Y forwarding is not working on Uppmax: maybe you connected with `ssh -Y` from an existing Uppmax session. In that case log out completely from Uppmax and try again.
+ To interrupt a process: press 'Ctrl' and 'C'.
+ Try to read the error message. Sometimes they are not very informative, but sometimes they are!

## Useful commands:

+ `pwd`
+ `cd`
+ `less` (exit with 'q')
+ `cat`
+ `nano`
+ `cp from_folder/filename to_folder/filename` If you want to copy entire folders, use `cp -r`. If you are in 'to_folder' already and you want the same filename, you can use `cp from_folder/filename .` .

## Transfer files between your computer and Uppmax

Open a new terminal window. Navigate to the folder where you want to work (i.e. either the folder containing the files you want to transfer to Uppmax, or the folder where you want to copy the files currently on Uppmax).

Log in to Uppmax with the `sftp` protocol instead of `ssh`: `ssh<EMAIL_ADDRESS>
Navigate to the right folder using `cd`.

If you need to navigate on your own computer, use `lcd` (or `lpwd` to know where you are).

To copy files FROM your computer TO Uppmax: use `put` and the name of the file.

To copy files FROM Uppmax TO your computer: use `get` and the name of the file.

If you wish to copy entire folders, use the `-r` flag.

gha_language: Python


text:
Basic commands to use the blockchain
===========

#### Sync with the network
To sync with the network and download the blockchain:
```
sync:start().
```

#### Current block height
To see the current block height downloaded to this node:
```
easy:height().
```

#### Stop a node
```
easy:off().
```

#### sign a transaction
```
keys:sign(Tx).
```

#### sign binary data
```
keys:raw_sign(Tx).
```

license: ISC

repository: wires/testnet

repo_name: wires/testnet


text:
# App Engine driver

[![Latest Version](https://img.shields.io/github/release/bernardphp/appengine-driver.svg?style=flat-square)](https://github.com/bernardphp/appengine-driver/releases)

**[Google App Engine](https://cloud.google.com/appengine) driver for Bernard.**

## Install

Via Composer

```shell
composer require bernard/appengine-driver
```

## Usage

```php
<?php

use Bernard\Driver\AppEngine\Driver;

$driver = new Driver(['name' => 'endpoint']);
```

## License

The project is licensed under the [MIT License](LICENSE).

repository: bernardphp/drivers

gha_language: PHP

repo_name: bernardphp/drivers


text:
---
sidebarDepth: 2
---

# Deployment & drift detection

## Deployment

The idea with the module is that third party software and pipelines are used to deploy docker image with. Unless configured different Terraform will only deploy the bootstrap_container_image the moment the ECS Service Module is being applied for the first time.

Popular tools for deploying Docker images are:

* [ECS Deploy](https://github.com/silinternational/ecs-deploy)
* [AWS Codepipeline](https://aws.amazon.com/codepipeline/)
* [Deploy fish](https://github.com/caltechads/deployfish)

The parameter `bootstrap_container_image` defines the container image for the container definition for the first time. After the service has been deployed it will not be used anymore unless `force_bootstrap_container_image` is set to true.
```json
  # force_bootstrap_container_image to true will force the deployment to use var.bootstrap_container_image as container_image
  # if container_image is already deployed, no actual service update will happen
  # force_bootstrap_container_image = false
  bootstrap_container_image = "nginx:stable"
```

<mermaid/>

## Drift Detection

*A diagram of the interaction between the submodules with the ECS Service Module.*

<div class="mermaid">
sequenceDiagram
    ECS Module->>live_task_lookup: Retrieve image of running ECS Task
    live_task_lookup->>live_task_lookup: Invoke lambda to check for current live task
    live_task_lookup-->>ECS Module: live_image
    ECS Module->>ecs_container_definition: create container def with live image or parameter image
    ecs_container_definition-->>ECS Module: return container definition
    ECS Module->>ecs_task_definition: create task definition with new container definition
    ecs_task_definition-->>ECS Module:task version
    ECS Module->>ecs_task_definition_selector: return the live task definition when no change has been made
    ecs_task_definition_selector-->>ECS Module: live or new task definition version
    ECS Module->>ecs_service: Update Service with given task definition version
</div>

When using the module for the first time, a Task Definition is created with a container definition. This container definition has the `bootstrap_container_image`, cpu and memory capacity, environment variables and other params defined inside the submodule : ecs_container_definition.

These deployment tools create a new Task Definition, by copying the current Task Definition in use and replacing the image with what is given as parameter. After creation of the new Task Definition, the ECS Service task definition attribute will be set to the newly created ECS Task definition. ECS takes care of the deployment without downtime, this can either be configured as rolling or something similar to a green/blue deployment.

As updates happen outside of the Terraform State a so called drift takes place. The ECS Service in Terraform is still pointing to an older version of the Task definition. The ECS Module takes care of that by looking up the current active ECS Task definition. It grabs the running image from the live container definition and it creates a new Task Definition with the updated image. If there are no changes between the live task definition and the newly created one. The ECS Service will keep pointing to the live definition and no actual update takes place.

## Policy for deployment

The IAM User or IAM Role which updates the ECS Service with new Task Definitions need the following IAM Policy.
```json
data "aws_iam_policy_document" "ecs_deploy_permissions" {
  statement {
    effect = "Allow"

    actions = [
      "ecs:DeregisterTaskDefinition",
      "ecs:DescribeServices",
      "ecs:DescribeTaskDefinition",
      "ecs:DescribeTasks",
      "ecs:ListTasks",
      "ecs:ListTaskDefinitions",
      "ecs:RegisterTaskDefinition",
      "ecs:StartTask",
      "ecs:StopTask",
      "ecs:UpdateService",
      "iam:PassRole",
    ]

    resources = ["*"]
  }
}
```


text:
# Sampling Methods

* **Sampling** is a *process used in statistical analysis in which a predetermined number of observations are taken from a larger population.*

---

## Simple Random Sampling
* **Simple random sampling** is the *basic sampling technique where we select a group of subjects (a sample) for study from a larger group (a population).* Each individual is chosen entirely by chance and each member of the population has an equal chance of being included in the sample. Every possible sample of a given size has the same chance of selection.

![Simple random sampling of a sample “n” of 3 from a population “N” of 12. Image: Dan Kernler |Wikimedia Commons](https://www.statisticshowto.datasciencecentral.com/wp-content/uploads/2014/12/Simple_random_sampling-300x231.png)
*Simple random sampling of a sample “n” of 3 from a population “N” of 12. Image: Dan Kernler |Wikimedia Commons*

* Technically, a simple random sample is a set of n objects in a population of N objects where all possible samples are equally likely to happen. Here’s a basic example of how to get a simple random sample: put 100 numbered bingo balls into a bowl (this is the population N). Select 10 balls from the bowl without looking (this is your sample n). Note that it’s important not to look as you could (unknowingly) bias the sample. While the “lottery bowl” method can work fine for smaller populations, in reality you’ll be dealing with much larger populations.

![](https://research-methodology.net/wp-content/uploads/2015/04/Simple-random-sampling2.png)

```python
import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.randn(5000, 4), columns=list('ABCD'))
```

```python
sample_df = df.sample(100)
```

```python
sample_df.shape
```

    (100, 4)

## Stratified Sampling

---

* **Stratified random sampling** is a method of sampling that *involves the division of a population into smaller sub-groups known* as **strata** In stratified random sampling or stratification, the strata are formed based on members' shared attributes or characteristics such as income or educational attainment.

* **Stratified random sampling** is also called *proportional random sampling or quota random sampling.*

![](https://image.slidesharecdn.com/sampling-stratifiedvscluster-170115160432/95/sampling-stratified-vs-cluster-2-638.jpg?cb=1484496290)

##### Assume that we need to estimate the average number of votes for each candidate in an election. Assume that the country has 3 towns:
* Town A has 1 million factory workers,
* Town B has 2 million workers, and
* Town C has 3 million retirees.
* We can choose to get a random sample of size 60 over the entire population but there is some chance that the random sample turns out to be not well balanced across these towns and hence is biased causing a significant error in estimation.
* Instead, if we choose to take a random sample of 10, 20 and 30 from Town A, B and C respectively then we can produce a smaller error in estimation for the same total size of the sample.

### Method

```python
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y,
                                                    stratify=y, ## we need one categorical variable for that
                                                    test_size=0.25)
```

## Reservoir Sampling

---
![](https://kapilddatascience.files.wordpress.com/2015/06/reservoir.jpg)

* **Reservoir sampling** is a *family of randomized algorithms for randomly choosing k samples from a list of n items, where n is either a very large or unknown number.* Typically n is large enough that the list doesn’t fit into main memory. For example, a list of search queries in Google and Facebook.

![](https://image.slidesharecdn.com/t10part1-141208215154-conversion-gate02/95/sampling-for-big-data-1-21-638.jpg?cb=1418075560)

```python
import random
def generator(max):
    number = 1
    while number < max:
        number += 1
        yield number
# Create as stream generator
stream = generator(10000)
# Doing Reservoir Sampling from the stream
k=5
reservoir = []
for i, element in enumerate(stream):
    if i+1<= k:
        reservoir.append(element)
    else:
        probability = k/(i+1)
        if random.random() < probability:
            # Select item in stream and remove one of the k items already selected
             reservoir[random.choice(range(0,k))] = element
print(reservoir)
```

    [6859, 7151, 2308, 4500, 4533]

It can be mathematically proved that in the sample each element has the same probability of getting selected from the stream.

## Random Undersampling and Oversampling

---

![](https://miro.medium.com/max/700/0*u6pKLqdCDsG_5kXa.png)

* A widely adopted technique for dealing with highly imbalanced datasets is called resampling. It consists of *removing samples from the majority class* (**under-sampling**) and/or *adding more examples from the minority class* (**over-sampling**).

```python
from sklearn.datasets import make_classification
X, y = make_classification(
    n_classes=2, class_sep=1.5, weights=[0.9, 0.1],
    n_informative=3, n_redundant=1, flip_y=0,
    n_features=20, n_clusters_per_class=1,
    n_samples=100, random_state=10
)
X = pd.DataFrame(X)
X['target'] = y
```

We can now do random oversampling and undersampling using:

```python
num_0 = len(X[X['target']==0])
num_1 = len(X[X['target']==1])
print(num_0,num_1)
# random undersample
undersampled_data = pd.concat([ X[X['target']==0].sample(num_1) , X[X['target']==1] ])
print(len(undersampled_data))
# random oversample
oversampled_data = pd.concat([ X[X['target']==0] , X[X['target']==1].sample(num_0, replace=True) ])
print(len(oversampled_data))
```

    90 10
    20
    180

## Undersampling and Oversampling using imbalanced-learn

* imbalanced-learn(imblearn) is a Python Package to tackle the curse of imbalanced datasets.
It provides a variety of methods to undersample and oversample.

#### A. Undersampling using Tomek Links:
One of such methods it provides is called Tomek Links. Tomek links are pairs of examples of opposite classes in close vicinity.
In this algorithm, we end up removing the majority element from the Tomek link which provides a better decision boundary for a classifier.

![](https://miro.medium.com/max/700/0*huy_9J15wzYJ2o5S)

```python
from imblearn.under_sampling import TomekLinks

tl = TomekLinks(return_indices=True, ratio='majority')
X_tl, y_tl, id_tl = tl.fit_sample(X, y)
```

    Using TensorFlow backend.

#### B. Oversampling using SMOTE:

In SMOTE (Synthetic Minority Oversampling Technique) we synthesize elements for the minority class, in the vicinity of already existing elements.

![](https://miro.medium.com/max/700/0*UrGYcz_Ab-HTo4-B.png)

```python
from imblearn.over_sampling import SMOTE

smote = SMOTE(ratio='minority')
X_sm, y_sm = smote.fit_sample(X, y)
```

#### There are a variety of other methods in the imblearn package for both undersampling(Cluster Centroids, NearMiss, etc.) and oversampling(ADASYN and bSMOTE) that you can check out.

* For more about [**imblearn**](https://imbalanced-learn.readthedocs.io/en/stable/index.html)


text:
## Introduction

Neat-Converter is an IOS app. The App simple calculator
with unit conversion such as currency, area, length, speed
and more. Furthermore, app record any calculation you have
done in calculator as history.

Apart from these features, app has pre-build theme for user
to select from.

## Technology

| framework |
| --------- |
| IOS native |

## Role

- IOS developer

## Video

<iframe width="560" height="315" src="https://www.youtube.com/embed/8EPBZrJRv84" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

repository: NPPersonal/PersonalWeb

repo_name: NPPersonal/PersonalWeb


text:
# ship
"ship" is a small program that automates the three git commands (add/commit/push) needed to submit for grading.
Should run on any macOS or Linux OS with git installed, just navigate to your git repo and run the command.

Command:
ship "my commit message"

To install:
1. clone/download the repo.
2. navigate to the "ship" folder and run "chmod +x ship" to make the program executable.
3. copy the "ship" executable to your $PATH, usually /usr/local/bin (you can find it by running "echo $PATH").

The program is already compiled, but if you want to edit and recompile it, just navigate to the folder main.c is in and run "gcc -o ship main.c" (you'll still have to chmod it and copy it to your $PATH).

repository: noahthurston/ship

repo_name: noahthurston/ship


text:
---
layout: post
author: scribu
title: Version 0.12.1 released
---
Hot on the heels of the [0.12 release](/blog/version-0.12.html) comes a minor release with a few fixes:

* fixed `wp plugin delete` when plugin is not in its own directory
* show warning when an HTTPS request fails
* added `--field=` parameter to `wp plugin search` and `wp theme search`
* made the `--post__in=` parameter in `wp post list` work
* added `--match=` argument for `wp rewrite list` + other improvements

You can browse the full list of [resolved issues](https://github.com/wp-cli/wp-cli/issues?milestone=18&page=1&state=closed) on GitHub.

Contributors to this release: [danielbachhuber](https://github.com/danielbachhuber), [mattes](https://github.com/mattes), [scribu](https://github.com/scribu)


text:
# A primer on ADOL-C

## Introduction

This is an unofficial repository that aims to provide a primer on how to install and use the C++ library ADOL-C.

 From the [ADOL-C project homepage](https://projects.coin-or.org/ADOL-C)

> The package ADOL-C (Automatic Differentiation by OverLoading in C++) facilitates the evaluation of first and higher derivatives of vector functions that are defined by computer programs written in C or C++.
The numerical values of derivative vectors are obtained free of truncation errors at a small multiple of the run time and randomly accessed memory of the given function evaluation program.

In short, ADOL-C is a powerful C++ library that allows to compute first and higher order derivatives of your C/C++ code in forward and reverse modes This information is essential for gradient-based optimization in fields such as aerodynamic shape optimization or model predictive control.

## Contents

The repository is organized as follows:

- [Detailed installation instructions](docs/adolc_installation.md) for Linux
- [A minimal working example](docs/adolc_minimal_working_example.md) to check if the installation was sucessful
- [A step-by-step explanation](docs/adolc_minimal_working_example_explanation.md) of the minimal working example to help you understand how ADOL-C works
- [A set of demonstration projects](adolc_demos/) showing some of the ADOL-C capabilities including the
	- Easy-to-use drivers for optimization
	- Trace_based forward and reverse functions
	- The traceless forward mode functions

**We hope that this repo can be useful to ADOL-C newcomers!**

Roberto Agromayor, PhD candidate at NTNU


text:
# Tilesaw

[![Tiled Arch, Artist Unknown, Pakistan, 18th
century](./tiles.jpg)](https://collections.artsmia.org/index.php?page=detail&id=99789)

Builds off [jcupitt/libvips](//github.com/jcupitt/libvips) and
[mapbox/mbutil](//github.com/mapbox/mbutil) to cut images
into map tiles.

## Components

### tilesaw.sh

A shell script for cutting a large image into "map" tiles suitable for
leaflet. It uses `vips` for the tiling, `exiftool` to ensure `{width: …,
height: …}` exist in the resulting `metadata.json`, and `mb-util` to
package the tiles as `.mbtiles`.

I've built my own [`vips`]() that tiles images `(z/x/y)` (instead of
`(z/y/x)`) and doesn't pad non-square tiles.

### index.js

An `express.js` app that brokers (a) serving and (b) downloading and
tiling new images, to then be served.

* `index.js`  takes the name of an image and checks whether it's been
  tiled yet. If it has (indicated by an affirmative response from
  `tilestream`, serve the [`tilejson`][] for that image. If not, it
  attemts to download the full-res image and tile it.
* [`tilestream`][] serves tiles that have already been converted

The tilesaw server has two methods:

* `/`: list all available, tiled images.
* `/:image`: return `tileJson` for `:image`. If the image hasn't been
  tiled yet, attempt to retrieve it and process it into tiles.

The app uses 'adapters' to find images to tile. When `tilesaw` can't
find tiles for an image, it will try each adapter to find a suitable
image. If the adapter succeeds, it's responsible for tiling the image
and indicating its success. If not, the next adapter gets a try.

Each adapter is a `function(imageName, options, callback)`. The `node` callback
style is `function(err, data)`: if `err` is non-null, something went
wrong. Otherwise that adapter found an image matching `imageName` and
tiled it.

Example adapters:

* `adapters/noop.js` doesn't do anything. It logs a message to the
  console and returns an error.
* `adapters/directory.js` checks for a matching image in a predetermined
  directory. If one exists, it's tiled and passed back to the client.
* `adapters/mia-api.js` pulls images from our API.

[`var adapters = '…'`](https://github.com/artsmia/tilesaw/blob/91069061668886cf0e195f71486b428a79b7e951/index.js#L22) is a space-delimited list of adapters to try. If all the listed adapters fail, `tilesaw` will return a `404` with the error message from the latest adapter.

## Installation

### Ubuntu, by hand

It's not too tough to install by hand, but you have to know what you're
doing.

First, install vips.

```
sudo apt-get update
sudo apt-get install build-essential gettext-base libglib2.0-dev libxml2-dev pkg-config pkg-config swig gtk-doc-tools automake gobject-introspection make libtiff-dev libjpeg-dev libpng-dev libexif-dev
git clone http://github.com/kjell/libvips.git
cd libvips
git checkout dzsave-zxy-no-padding
./bootstrap.sh
autoconf
./configure
make
sudo make install
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
echo 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH' >> ~/.profile
```

Test it with `vips --version`. If you see `vips: error while loading
shared libraries`, that means `vips` can't find its shared libraries.
This is most likely because `LD_LIBRARY_PATH` isn't set in your shell.

Next, install nodejs and python:

```
sudo apt-get install python-software-properties python python-setuptools g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install libsqlite3-dev sqlite3 nodejs-dev npm libimage-exiftool-perl
```

Finally, install `mb-util` and `tilesaw`.

```
git clone https://github.com/mapbox/mbutil ~/tmp/mbutil
cd ~/tmp/mbutil
sudo python setup.py install

git clone https://github.com/artsmia/tilesaw ~/tmp/tilesaw
cd ~/tmp/tilesaw
npm install
```

Now you can start tilesaw (`npm start`).

By default it runs on port 8887, with tilestream on 8888. To run it
you'll need to set a few environment variables:

| environment variable | default | note |
| --- | --- | --- |
| PORT | 8887 | |
| IMAGEDIRECTORY | ~/tmp/tilesaw/data/images | the directory to look for untiled images |
| TILEDIR | ~/Documents/MapBox/tiles | Where to put the tiles |
| TILESAW | ~/tmp/tilesaw | Where is the tilesaw script? |

### Docker

So far the nodejs parts are should be easily replicable using Docker. If
that's not your thing, the `Dockerfile` lays out what needs to happen to
make everything work.

The vips installation isn't covered yet, that's coming soon.

## Domain names

Then these servers should be reverse proxied by `nginx` to a subdomain.
We're using `tilesaw.dx.artsmia.org` and `tiles.dx.artsmia.org`.

[`vips`]: https://github.com/kjell/libvips/commits/dzsave-zxy-no-padding
[`tilestream`]: https://github.com/mapbox/tilestream
[`tilejson`]: https://github.com/mapbox/tilejson-spec

repository: itbidhan/tilesaw

repo_name: itbidhan/tilesaw