Dotnet + Certificado SSL + Docker

# Power
`dotnet dev-certs https --clean`

`dotnet dev-certs https --trust -ep <folder>\aspnetapp.pfx -p <senha>`

*Colocar na raiz do projeto*

## Dockerfile
`ENV ASPNETCORE_ENVIRONMENT=Development`

`ENV ASPNETCORE_URLS=https://+:443;http://+:80`

`ENV ASPNETCORE_Kestrel__Certificates__Default__Password=<senha>`

`ENV ASPNETCORE_Kestrel__Certificates__Default__Path=/.../aspnetapp.pfx`

Link To Google Map for Direction

You obviously need to make sure your fields match up - but this will take an address and turn it into a link to a google map.
{{ entry.eventLocation.streetAddress1 }}<br>
{% if entry.eventLocation.streetAddress2 | length %}{{ entry.eventLocation.streetAddress2 }}<br>{% endif %}
{% if entry.eventLocation.city %}{{ entry.eventLocation.city }}, {% endif %}{% if entry.eventLocation.state %}{{ entry.eventLocation.state }}{% endif %}{% if entry.eventLocation.zipCode %} {{ entry.eventLocation.zipCode}}{% endif %}</p>
<a class="link" href="https://www.google.com/maps/search/?api=1&query={{ entry.eventLocation.streetAddress1|escape('url')}}{% if entry.eventLocation.city %}%20{{ entry.eventLocation.city|escape('url') }}{% endif %}{% if entry.eventLocation.state %}%20%2C{{ entry.eventLocation.state|escape('url') }}{% endif %}{% if entry.eventLocation.zipCode %}%20{{ entry.eventLocation.zipCode|escape('url') }}{% endif %}" rel="nofollow" target="_blank">Get Directions</a>

modules nodeJs

Console commands to install nodeJs modules
# NodeJs modules command lines install
### Install NodeJS
```sh
sudo apt-get update
sudo apt-get install nodejs
```
### Main modules
##### NodeJS
```sh
npm install express --save # Installe et ajoute express à la liste des dépendences
npm install express # Installe Express de façon temporaire et ne l’ajoute pas à la liste des dépendances
```
##### TypeScript
```sh
npm install --save-dev typescript // Pour la dernière version stable
```
##### Dotenv
```sh
npm install dotenv
```
```js
require('dotenv').config()
```
##### bcrypt
```sh
npm install bcrypt
```
##### JwtWebToken
```sh
npm install jsonwebtoken
```
##### MySql
>Sql  bdd
```sh
npm install mysql
```
##### MongoDb
> noSql bdd
```sh
npm install mongodb --save
```
##### Concurrently
> Exécutez plusieurs commandes simultanément en temps réel
```sh
npm install concurrently --save-dev
```
##### Jest
```sh
npm i --save-dev-jest 
```

TypeScript

Some useful commands to use TypeScript
# Typescript
#### Installation
```sh
npm install --save-dev typescript
```
#### tsconfig.json
```js
{
  // Options de typescript
  "compilerOptions": {
    "module": "commonjs", // permet d'utiliser require('')
    "esModuleInterop": true,// permet d'utiliser import * from ...
    "target": "ES2020", // Compile au format ES2020
    "strict": true, // Forcer à typer certains paramètres, permet d'avoir un code plus propre
    "pretty": true, // Stylize errors and messages using color and context
    "outDir": "./dist" // Destination des fichiers compilés

  },
  // Fichiers et dossiers à compiler
  "include": [
    "src/**/*"
  ],
  // Fichiers à exclure de la compilation
  "exclude": [
    "node_modules"
  ]
}

#### Installer les types
```sh
npm i --save-dev @types/express
npm i --save-dev @types/node
npm i --save-dev @types/jest ts-jest
```

BTree Annotation

BTree Annotation
``` java
/*
 * Copyright (c) 2006 and onwards Makoto Yui
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
 * Copyright 1999-2004 The Apache Software Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed un

Mac disable gatekeeper xattr firewall anti virus

xattr -cr /Applications/Signal.app

Remove sound from a bunch of videos

# Remove sound with FFMPEG

```
find *.mp4 -print0 | xargs -I '{}' ffmpeg -i '{}' -c copy -an ns_'{}'
```

SpringBoot2+Java+Kotlin

        <properties>
            <kotlin.version>1.3.61</kotlin.version>
        </properties>
    
      <dependencies>
        <!--  kotlin dependencies     -->
        <dependency>
            <groupId>com.fasterxml.jackson.module</groupId>
            <artifactId>jackson-module-kotlin</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib-jdk8</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-reflect</artifactId>
        </dependency>
      </dependencies>
      
      <build>
        <plugins>
          <!--   kotlin plugin (not support JPA here)    -->
            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <configuration>
                    <args>
                        <arg>-Xjsr305=strict</arg>
       

NPM Error:gyp: No Xcode or CLT version detected!修复

$ sudo rm -rf $(xcode-select -print-path)
$ xcode-select --install

Log PHP variables to Chrome console

<?php

/**
 * @file
 *
 * Very simple logger, log to console.log().
 */

namespace App;

class Logger {
  public static function log($response) {
    if (is_object($response) || is_array($response)) {
      $response = json_encode($response);
      echo '<script>console.log(JSON.parse(\'' . $response  . '\'));</script>';
    }
    else {
      echo '<script>console.log(\'' . $response  . '\');</script>';
    }
  }
}

Capitalizer

Saved from https://stackoverflow.com/questions/1026069/how-do-i-make-the-first-letter-of-a-string-uppercase-in-javascript
function capitalizeFirstLetter(string) {
  return string.charAt(0).toUpperCase() + string.slice(1);
}

scale spine to fit sprite size

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Spine.Unity;

public class ScaledSpineEffect : MonoBehaviour {
    [SerializeField] SkeletonAnimation effectAnim;

    public void Play(SpriteRenderer target) {
        effectAnim.gameObject.SetActive(true);
        float targetWidth = target.size.x;
        float selfWidth = effectAnim.GetComponent<MeshRenderer>().bounds.size.x;
        float scale = Mathf.Clamp(targetWidth / selfWidth, 0.5f, 1f);
        transform.localScale = Vector3.one * scale;
        transform.position = target.transform.position;
        effectAnim.AnimationState.SetAnimation(0, "animation", true).Complete += delegate {
            effectAnim.gameObject.SetActive(false);
        };
    }

    public void DelayPlay(SpriteRenderer target, float del) {
        StartCoroutine(delayRoutine(target, del));
    }

    IEnumerator delayRoutine(SpriteRenderer target, float del) {
        yield return new WaitForS

get all rds-log

#!/bin/bash

#USAGE:sh 30_get_all_rdslogs.sh oms-inventory-dev-v10-01

DB_INSTANCE_IDENTIFIER=$1
PROFILE_NAME=$2
OUTPUT="."

now=`date +'%Y-%m-%d-%H%M'`
mkdir ${now}
logs_json=`aws rds describe-db-log-files --db-instance-identifier ${DB_INSTANCE_IDENTIFIER} --region ap-northeast-1 --profile ${PROFILE_NAME} | jq ".DescribeDBLogFiles"`

len=$(echo $logs_json | jq length)
for i in $( seq 0 $(($len - 1)) )
do
        row=$(echo $logs_json | jq .[$i])
        logfilename=`echo $row | jq -r ".LogFileName"`
        size=`echo $row | jq -r ".Size"`
        if [ ${size} -gt 1000000 ]; then
                echo ""
                echo "WARN: ${logfilename} is over 1M ${size}. Please check this logfile is copmletion."
                echo ""
        else
                echo ${logfilename}
        fi

        # 保存用のファイル名用意
        savefile=`echo ${logfilename}| sed -e "s/\//-/g"`

        aws rds download-db-log-file-portion --db-instance-identifier ${DB_INSTANCE_IDENTIFIER} \
        --log-file-

get rds-log

# describe logs
aws rds describe-db-log-files --db-instance-identifier aaa --region ap-northeast-1 --profile aaa

#download
aws rds download-db-log-file-portion --db-instance-identifier aaa --log-file-name "error/postgresql.log.xx"  --output text --region ap-northeast-1 --profile aaa --cli-input-json '{ "Marker": "0" }'

Add a link which can quick jump to a certain position on a page

Use `id`

```html
<!--The page linking to another page-->
<!--https://iride.net.nz/pages/delivery-->
<p>We offer a flat-rate $8 freight on all orders under $99. You can find out more <a href="https://iride-store.myshopify.com/pages/website-policies-terms-and-conditions#orders-and-delivery" target="_blank">here</a>.</p>
```

```html
<!--The page where the above code links to-->
<!--https://iride.net.nz/pages/website-policies-terms-and-conditions#orders-and-delivery-->
<h4 id="orders-and-delivery">Orders and Delivery</h4>
```

aws - textract - document analyse - in website (not s3 hosted)

<?php

include 'aws_init.inc';

// The file in this project. not S3 hosted
// not working with pdf (?)

$filename = "tst.jpg";
$file = fopen($filename, "rb");
$contents = fread($file, filesize($filename));
fclose($file);
$options = [
    'Document' => [
        'Bytes' => $contents
    ],
    'FeatureTypes' => ['FORMS'], // REQUIRED
];
$result = $teClient->analyzeDocument($options);
echo "analyzeDocument result=<pre>";
//print_r($result);

// If debugging:
// echo print_r($result, true);
$blocks = $result['Blocks'];
// Loop through all the blocks:
foreach ($blocks as $key => $value) {
    if (isset($value['BlockType']) && $value['BlockType']) {
        $blockType = $value['BlockType'];
        if (isset($value['Text']) && $value['Text']) {
            $text = $value['Text'];
            if ($blockType == 'WORD') {
                echo "Word: " . print_r($text, true) . "\n";
            } else if ($blockType == 'LINE') {
                echo "Line: " . p