Search

Get IP from command line

To retrieve the IP address from the command line, you can use the following methods based on your operating system:

Get path of bash script

Obtaining the path of a bash script can be useful in various scenarios.

Disk usage statistics in linux

In Linux, you can use various commands and tools to obtain disk usage statistics, like df or du.

PHP Iterator class example

Iterator interface

Vim development environment

Vim (Vi Improved) is a highly configurable, powerful, and widely used text editor available on various platforms, including Linux, macOS, and Windows. It is based on the older Vi editor, which was originally created for the Unix operating system.

Container runtime and alternatives

A container runtime, also known as a container engine, is a software component responsible for running and managing containers on a host system. It is a crucial part of containerization technologies like Docker and Kubernetes. The container runtime provides the necessary infrastructure and functionality to create, deploy, and manage containers efficiently.

Distribute Your Program via Homebrew

What is Homebrew

PHP8.1 new feature

https://www.zend.com/blog/php-8-1

Best database for a chat application

When building a chat application, you typically need a database to store and manage the chat messages, user information, and other relevant data. Here are some common database options for chat applications.

Delete local Time Machine snapshots

Time Machine

How to Create a Bootable Win 10 USB

Booting Windows from a USB device provides flexibility, enables troubleshooting and repairs, facilitates system installations and upgrades, and allows for testing and data recovery. It offers an alternative way to access and work with Windows, especially in situations where the computer’s internal storage or operating system is unavailable or problematic.

PXE netboot resources

PXE netboot linux live

MacOS time machine diagnostics

Time Machine failing: “an error occurred while copying files” 1

Delete files in a date condition

Delete files before 1st of previous month.

Between data lake and data warehouse in enterprise use case

  Data Warehouse Data Lake
Data type Only structured data AUnstructured or raw
Schema On-Wirte On-Read
User Business user Data professionals
Data Processing Extract, Transform, Load Extract, Load, Transform
Application Business Report/Record AI/ML, Data science
Accessibility More complicated and costly to make changes Highly accessible and quick to update
Storage Only required data is kept Can keep any data
Cost High Low

Laravel development with xdebug 3

Development env background

Typesense working with CJK languages

HTML main textual content extraction

boilerpipe 1

Mac OS hardware information

```bash

ffmpeg

ffmpeg - Convert MP4 to WebM, poor results

Full-text search services

  • Elastic
  • Algolia
  • Typesense
  • Swiftype
  • yext.com
  • coveo.com

Firebase development resources

Realtime Database

Time series database

A time series database (TSDB) is a software system that is optimized for storing and serving time series through associated pairs of time(s) and value(s).[1] In some fields, time series may be called profiles, curves, traces or trends.[2] Several early time series databases are associated with industrial applications which could efficiently store measured values from sensory equipment (also referred to as data historians), but now are used in support of a much wider range of applications. – wiki

Production grade CICD workflow

graph TB
B((Source code storage)) -- pull/checkout/clone --> C(Pipeline)
C(Pipeline) -- Test & build --> D[Application]
D[Application] -- store --> E((Distribution))
A((Infrastructure)) -- provisioning --> G(Instance)
E((Distribution)) -- load --> F(Deployment)
F(Deployment) -- deploy --> G(Instance)

Colored text in linux shell script

Other variables you can define as follows:

txtgrn=$(tput setaf 2) # Green
txtylw=$(tput setaf 3) # Yellow
txtblu=$(tput setaf 4) # Blue
txtpur=$(tput setaf 5) # Purple
txtcyn=$(tput setaf 6) # Cyan
txtwht=$(tput setaf 7) # White
txtrst=$(tput sgr0) # Text reset.

Boost PHP Script Performance

PHP interview questions

  • https://learnku.com/articles/47202

PHP swoole and coroutine

Laravel and swoole

Symfony DomCrawler example

Compont 5.0 Document

Smart commint with JIRA

When you manage your project’s repositories in Bitbucket or GitHub, or use Fisheye to browse and search your repositories, you can process your Jira Software issues using special commands, called Smart Commits, in your commit messages.1

PDF Calendar

Online calendar generater

Raspberry pi use cases

PHP8 new features

  • https://pociot.dev/32-php-8-try-out-all-new-features
  • https://stitcher.io/blog/new-in-php-8
    • https://learnku.com/php/t/44904

openfaas

Install and deploy 1

Get started Kafka with Docker

Zookeeper 1

Self hosted online IDE

Code server, also coder.com/. 1

Laravel 8.x new features

Laravel 8 released on September 8th, 2020, bug fixes until April 6th, 2021, and security fixes until September 8th, 2021. 1

anaconda conda CLI

update Updates conda packages to the latest compatible version. upgrade Alias for conda update.

Laravel login auth mapping

Symfony component Ldap

SSH Passwordless by SSH key

https://www.tecmint.com/ssh-passwordless-login-using-ssh-keygen-in-5-easy-steps/

25GB+ Sound Effects giveaway

https://wesoundeffects.com/we-sound-effects-bundle-2020/

Go-lang crawler

PHP 7.4 new features

New feature

Laravel 7.x new features

Laravel 7 released on March 3rd 2020, bug fixes until September 3rd 2020, and security fixes until March 3rd 2021 1

Laravel 6.x new features

  1. Laravel 6 is LTS, release at September 3rd, 2019, Bug Fixes Unti September 3rd, 2021 and Security Fixes Until September 3rd, 2022.
  2. Semantic Versioning
  3. The extraction of frontend Laravel/UI
  4. Improved authorization responses:
  5. Lazy Collections
  6. Job Middleware and Laravel Spark
  7. Eloquent Subquery Enhancements
  8. Improved Exceptions Via Ignition
  9. Laravel Vapor Compatibility

Getting started with Firebase tools

Install

Linux system clean up

Ubuntu/Debian apt

apt-get clean && rm -rf /var/lib/apt/lists/*

Jupyter docker stacks

Repo: https://github.com/jupyter/docker-stacks

Laravel model

Event

There are 3 events around a Model being saved in the database. 1

Laravel Design Patterns

Design patterns in Laravel 1

Selenium PHP and webdriver

Laravel with opcache

Logging to syslog in Python

```python import logging import logging.handlers

Mysql add new user

```sql

Codeception with webdriver

```bash

install codeception framework

composer require –dev codeception/codeception

Create Win 10 disk partition image on Linux

Backup MBR

Raw-mode is unavailable courtesy of Hyper-V

Result Code: E_FAIL (0x80004)
Component: ConsoleWrap
Interface: IConsole {872da645-bee2}

Self hosted GIT server

Request

  • issue, branch on issue #no
  • 3rd party integrate, CICD
  • readme.md file
  • code review at least PR
  • Project management (optional)

Quick setup Pi

Initial

Load balance

Hardware 1

Cloud infrastructure

Core

Serverless principal

  1. There are at least one task need to be done when certain events occur. (Event driven)
  2. We do nothing until event occur. (No deamon)
  3. People can wait until tasks have been done. (Queue)

Python Design Patterns

pyinstaller

ubuntu

Install Graylog Collector Sidecar on Alpine linux

Basicly, download binary package from repo.

Alpine linux telnet

Install busybox-extras 1

Google Cloud Platform

Regions and Zones 1

Frontend trending

Svelte 1

PHP version in alpine linux

3.7

  • php5-5.6.40-r0
  • php7-7.1.32-r0

NAS

NAS

Develop PHP helper functions

Linux dd command

Creating an image file with dd command 1

gcloud cli

Before start

JQuery works with HTML table

  • https://api.jquery.com/category/selectors/jquery-selector-extensions/
  • https://www.jquery-az.com/how-to-use-jquery-hide-show-methods-with-div-table-lists-demos/
  • https://www.jquery-az.com/jquery/demo.php?ex=18.0_4
  • https://jsfiddle.net/vb7kx0mf/
  • jQuery: select the first five rows of a table

Hash file

In Windows PowerShell 1

Yaml example

Online YAML editor

Online editor

Setup docker on Windows Server 2016

Install Docker Engine - Enterprise

Data structure - list

List

Serverless - AWS Lambda

Handler

jQuery HTML

jQuery

Kafka in docker

Kafka docker image repo

Atlassian platform plugin development

alpine install php5 redis

alpine:3.8

Kubernetes get started

Linux sed command

sed is a Unix utility that parses and transforms text, using a simple, compact programming language. sed was developed from 1973 to 1974 by Lee E. McMahon of Bell Labs, and is available today for most operating systems. 1

Physical Or Virtual Machine

How To Check If A Linux System Is Physical Or Virtual Machine

Google cloud certifications

Classification Title Fee Length
Associate ~ Cloud Engineer US$125 2h
Professional ~ Cloud Architect US$200 2h
Professional ~ Data Engineer US$200 2h
Professional ~ Cloud Developer US$200 2h
Professional ~ Cloud Network Engineer US$200 2h
Professional ~ Cloud Security Engineer US$200 2h
Professional ~ Collaboration Engineer US$120 4h

Machine Learning APIs

Overview

APIs (Application Programming Interfaces) are software programs that give developers access to computing resources and data. Companies from many different fields offer publicly available APIs so that developers can integrate specialized tools, services, or libraries with their own applications and codebase.

Kubernetes Solutions

Managing Deployments Using Kubernetes Engine

Kubernetes in the Google Cloud

Kubernetes Engine: Qwik Start

Setting a default compute zone

Google cloud study

http://bit.ly/2Wvk5Au class note

Bootstrap 4 Admin Template

https://github.com/puikinsh/Adminator-admin-dashboard https://hackerthemes.com/bootstrap-templates/spur/ https://colorlib.com/wp/free-admin-templates/

Find PHP short open tags

Using PHPStorm1

<\?(?!php|xml)

Laravel Illuminate DB With Eloquent as package

Using Illuminate Database With Eloquent in Your PHP App Without Laravel1, and source code2

Update .env file by bash shell script

ini file or .env file

PHP simple webhook

A simple php script for deploy using bitbucket webhook 1

Stock Trading Data API

Data

Apache Flink

About

Apache Flink is a framework and distributed processing engine for stateful computations over unbounded and bounded data streams. Flink has been designed to run in all common cluster environments, perform computations at in-memory speed and at any scale. 1

Data structure - stack

Data structure type

Publish python package

Linux user and group

List all user

Docker in centos 7

Docker needs at least CentOS 7 (CentOS Linux release 7.5.1804 (Core)) 1

Gitlab runner in centos 7

Install into CentOS 7 1

MS SQL server cache

The best practices for docker

Restful API design

Follow Github’s Restful HTTP API design

Python localization

Python and pip

The best practices for Kubernetes

9 Principles for k8s security 1

  1. always upgrade to new version for k8s
  2. Using RBAC
  3. Using namespace kubectl get ns
  4. isolate sensitive work load
  5. keep meta data safty on cloud
  6. create and identify cluster network security strategy gcloud container clusters list
  7. pod security strategy
  8. node security strategy
  9. log

Bash HTTP server

5 lines code make a HTTP server 1

Principles of a Good Research Report

12 principles 1 :

PHP Data Analysis

php execute linux shell command

  • exec : returns the last line of the output by default, but can provide all output as an array specifed as the second parameter.
  • shell_exec : returns all of the output stream as a string. 1
  • system() : displays output directly without using echo or print. 2
  • passthru() : when the output from the Unix command is binary data 3
  • proc_open(): proc_open — Execute a command and open file pointers for input/output 4

PhantomJS

centos 7

``` yum install epel-release -y yum install nodejs npm bzip2 fontconfig -y

Chrome headless

Mac OS 1

GIT SSH key

Generate key 1

Linux DNS

Using network-manager 1.

apt-get install network-manager
nmcli dev show | grep DNS
nm-tool | grep DNS

Compress and extract files

Command line

Docker in Raspberry Pi 3

Remove Docker 1.8

apt-get remove docker.io
apt-get autoremove
apt-get clean

LDAP

```bash docker pull osixia/openldap

Codeception test DB with .env file

In file codeception.yml add 1

params:
	- .env

Laravel package development

Run bash script in Windows 10

@ECHO OFF
setlocal DISABLEDELAYEDEXPANSION
SET BIN_TARGET=%~dp0/../agilekeys/cans/bin/cans
bash "%BIN_TARGET%" %*

Flutter - Mobile UI

Flutter allows you to build beautiful native apps on iOS and Android from a single codebase.1

Keycloak SSO solution

Using OPcache in Docker

Opcache and JIT

HTTPS on local env

Using OpenSSL to generate all of our certificates.[^1] [^1]: How to get HTTPS working on your local development environment in 5 minutes

The Twelve-Factor App

In the modern era, software is commonly delivered as a service: called web apps, or software-as-a-service.

TravisCI deploy website to firebase

Use ubuntu docker image

docker pull ubuntu

Mysql get current user privileges

SHOW GRANTS Syntax 1

SHOW GRANTS;
SHOW GRANTS FOR CURRENT_USER;
SHOW GRANTS FOR CURRENT_USER();

Default php.ini files

Default php ini files 1

Use laravel view(blade) as a package

Three blade packages

Use Eloquent as a package

SQL server on docker

docker hub

Linux Package solution for PHP

Docker notes

  • What docker is
  • What docker does
  • Why docker better.

IntelliJ with docker in simple example

Symfony 4

Install

composer self-update

Color schema for PHP

docker #0091e2 php #8892BF laravel #e74430 https://www.shutterstock.com/image-vector/soft-drink-can-top-view-icon-462004963 http://www.whitehouse51.com/best-logo-designs-2016/1/50-best-logos-of-2016-logos-graphic-design-junction/

Oh my zsh on MacOS

  1. Use brew install zsh zsh-completions install zsh 1
  2. Install oh-my-zsh by using sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" 2
  3. Edit file ~/.zshrc
  4. Change your default shell chsh -s /bin/zsh
  5. Setup font 3, Set this font in iTerm2 (14px is my personal preference) (iTerm → Preferences → Profiles → Text → Change Font).

GIT Graph Drawing Tool

Bit-Booster is an offline commit graph dawing tool 1

PHP command line

PHP Cli

Package Should Be Installed For Laravel Project

Package libraries [^5] [^5]: Larlibs

Data Transfer Object

Shift-Left Performance Testing

Shift-Left Performance Testing

PHP Code Standards

Extend PSR-1 RAW

1. Overview

  • Files MUST use only <?php tag only.

Spring Boot

Spring Boot 2: Building a RESTful Web Service

Laravel Echo server and braodcasting

Ansible resources

Ansible (GitHub) is an open-source software platform for configuring and managing computers.1

Bash programming

File header

Lucid Architecture

There’s the problem with DDD, it’s not orientated to technical considerations.1

Domain Driven Design (DDD) approach

DDD helps build scalable web applications, and keeps business logic easier to maintain.1. A Domain Driven Design (DDD) approach to the Laravel Framework.2

Laravel bind vs singleton

Container::singleton is the same as Container::bind with the third parameter set to true. 1

SOLID principles

SOLID is a common acronym in the software development world. It’s useful to remeber five best practices to design classes in a object oriented language.1

Awesome PHPStorm

PHP code quality tools

PHP non-thread safe vs thread safe

Detail Non thread safe thread safe
Thread single thread is used multi-processing
Env CGI binary, command line env need multiple PHP threads
Web server Nginx/Lighttpd Apache MPM

Bug Mailer

Design

PHP self vs static

self

PHP jupyter

Start from jupyter

Join query in laravel eloquent

$posts = App\Post::whereHas('comments', function ($query) {
    $query->where('content', 'like', 'foo%');
})->get();

PHP 7.1 Iterables

Iterable is a pseudo-type introduced in PHP 7.1.

awesome cli

The hospital administrator is cheating!

The hospital administrator is cheating!

Laravel passport

Prepare

If it’s new laravel project and you are running mysql < 5.7. You need fix this. ``` composer require laravel/passport

PHP symbol

What does this symbol mean in PHP? 1

Free polygon Fonts

API Design Patterns

https://www.moesif.com/blog/api-guide/api-design-guidelines/

Python tracebacks

Common traceback errors:1

Binary tree

Binary tree

The API Platform Framework

Framework

REST and GraphQL framework to build modern API-driven projects

Pipenv

Pipenv — The officially recommended Python packaging tool from Python.org1

Ubuntu date time

update timezone

sudo dpkg-reconfigure tzdata

Apache OpenWhisk

Apache OpenWhisk (Incubating) is a serverless, open source cloud platform that executes functions in response to events at any scale.1

Get Awesomeness

A collection of many awesomen code, tools, project and application1.

Algorithmia

Algorithmia is a serverless algorition hosting and marketplace. You can deploy your algorition to a serverless AI Layer. If you have a good idea, Algorithmia allow you to implement your idea as quick as possible1.

Serverless framework

PHP OAuth Server

Background

PHP Dependency Injection

Keyword: PHP-DI, PSR-11, Autowriing

Laravel Ecosystem

Framework/Backend

Laravel and Lumen face to application and API

EasyAdmin vs Nova

EasyAdmin1 is developed in programmer mindset.

How to study

Two way to quick study a new stuff.

Dynamic function call in Go

Two ways to do it

  • interface1
  • map2
  1. https://mikespook.com/2012/07/function-call-by-name-in-golang/ 

  2. https://mikespook.com/2012/07/function-call-by-name-in-golang/ 

Artisan commands

input

Substring before and after in Golang and PHP

```php

Stress test

  • https://github.com/JoeDog/siege

Go live stream

  • https://github.com/gwuhaolin/livego
  • https://github.com/nareix/joy4

Python

Start

PHP 7.2 new features

Parameter type change between parent class and child class

class Parent{
	public function sum($numbers){}
}
 
class Child extends Parent{
	public function sum(array $numbers){}
}

Programmer Career

  • https://kb.cnblogs.com/page/522513/
  • https://kb.cnblogs.com/page/597877/
  • https://kb.cnblogs.com/page/598963/

ML Similarity Measurement

Distance

GPU hosting

  • http://www.redstation.com/gpu-server
  • https://www.serverroom.net/dedicated/gpu/pricing/

AWS tools

  • https://cloudcraft.co/signup
  • HashiCorp Terraform
  • aws cli

Lambda with SQS

  • https://cloudonaut.io/integrate-sqs-and-lambda-serverless-architecture-for-asynchronous-workloads/
  • https://docs.aws.amazon.com/zh_cn/lambda/latest/dg/with-sqs.html

recommdation system

Book

  • https://wizardforcel.gitbooks.io/guide-to-data-mining/content/index.html
  • http://guidetodatamining.com/

Golang excel lib

  • https://github.com/360EntSecGroup-Skylar/excelize
  • https://github.com/tealeg/xlsx

terraform

Source code

  • https://github.com/hashicorp/terraform

runC and runV

  • https://www.binss.me/blog/what-is-kata-containers/
  • http://cizixs.com/2017/11/05/oci-and-runc
  • https://github.com/hyperhq/runv
  • https://www.jianshu.com/p/e1955647a9a4

Docker security

  • https://linux.cn/article-5537-1.html
  • https://www.ithome.com.tw/news/113303
  • http://dbaplus.cn/news-72-1333-1.html
  • https://legacy.gitbook.com/book/yeasy/docker_practice/details
  • https://yeasy.gitbooks.io/docker_practice/security/daemon_sec.html
  • https://juejin.im/entry/5953111e6fb9a06bbc4ad665

about serverless

  • https://read.acloud.guru/six-months-of-serverless-lessons-learned-f6da86a73526
  • https://read.acloud.guru/event-driven-architecture-with-sqs-and-aws-lambda-cf2ebd529ae3

The best article about golang

ref

  • https://tonybai.com/2017/04/20/go-coding-in-go-way/

golang web frameworks

  • How to create a project
  • a/b testing
  • how to deploy a project
  • has easy document
  • test case coverage
  • codebeta/scrutinizer
  • community bbs, blog, and project

link golang to mysql via ssh

```go package main

check python module version

python -c "import openpyxl; print(openpyxl.__version__)"
python -c "import numpy; print(numpy.__version__)"

deas gairme

A SNS force on job.

Link python

lrwxrwxrwx    1 root     root          12 Jan  9 19:37 passwd -> /bin/busybox
lrwxrwxrwx    1 root     root          12 Jan  9 19:37 paste -> /bin/busybox
lrwxrwxrwx    1 root     root          12 Jan  9 19:37 patch -> /bin/busybox
lrwxrwxrwx    1 root     root          12 Jan  9 19:37 pgrep -> /bin/busybox
-rwxr-xr-x    1 root     root         208 Nov 21  2017 pip3
-rwxr-xr-x    1 root     root         208 Nov 21  2017 pip3.6
lrwxrwxrwx    1 root     root          12 Jan  9 19:37 pkill -> /bin/busybox
lrwxrwxrwx    1 root     root          12 Jan  9 19:37 pmap -> /bin/busybox
lrwxrwxrwx    1 root     root          12 Jan  9 19:37 printf -> /bin/busybox
lrwxrwxrwx    1 root     root          12 Jan  9 19:37 pscan -> /bin/busybox
lrwxrwxrwx    1 root     root          12 Jan  9 19:37 pstree -> /bin/busybox
lrwxrwxrwx    1 root     root          12 Jan  9 19:37 pwdx -> /bin/busybox
lrwxrwxrwx    1 root     root           8 Jul  4 00:26 pydoc3 -> pydoc3.6
-rwxr-xr-x    1 root     root          78 Nov 21  2017 pydoc3.6
lrwxrwxrwx    1 root     root           9 Jul  4 00:26 python3 -> python3.6
-rwxr-xr-x    2 root     root        5.7K Nov 21  2017 python3.6
-rwxr-xr-x    2 root     root        5.7K Nov 21  2017 python3.6m
lrwxrwxrwx    1 root     root          10 Jul  4 00:26 pyvenv -> pyvenv-3.6
-rwxr-xr-x    1 root     root         435 Nov 21  2017 pyvenv-3.6

Online HR

https://breezy.hr/

Python OCR

  • https://www.ctolib.com/deep_ocr.html
  • http://cwiki.apachecn.org/pages/viewpage.action?pageId=11534613
  • https://python.freelycode.com/contribution/detail/344
  • https://hackernoon.com/how-did-i-hack-aws-lambda-to-run-docker-containers-7184dc47c09b
  • https://github.com/JinpengLI/deep_ocr/blob/master/README_en.md
  • https://www.wenji8.com/p/4744TBs.html
  • https://github.com/facebookresearch/fastText

With Go language

Resources

virtualgo

Virtualgo (or vg for short) is a tool which provides workspace based development for Go. Its main feature set that makes it better than other solutions is as follows:

python virtualenv

A virtual environment is a self-contained Python environment that allows you to isolate Python packages and dependencies for different projects. It provides a way to create a separate environment with its own installed packages, Python interpreter, and configuration settings, independent of the system-wide Python installation.

Playing ML with real data

Popular open data repositories:

ML persistence

Scikit learning

ML Math

scalar, vector and tensor

ML training model

become good programer

become-good-programer https://juejin.im/post/5b320a9a6fb9a00e9b3a0d41

ML model

Amazon SageMaker Build, train, and deploy machine learning models at scale sagify video tutorial A command-line utility to train and deploy Machine Learning/Deep Learning models on AWS SageMaker in a few simple steps!

sphinx

``` brew install sphinx-doc

Simple logo design with emoji

emoji

Energy saving

  • https://compare.energy.vic.gov.au
  • https://www.sumo.com.au/sign-up/#/
  • http://tangoenergy.com/forhome/home-select
  • https://www.news.com.au/lifestyle/home/government-to-hand-50-every-to-every-victorian-household-for-visiting-this-website/news-story/4477fe3c41e36171c45c6490d1329143
  • https://www.victorianenergysaver.vic.gov.au
  • https://www.theage.com.au/national/victoria/50-energy-comparison-payments-an-election-stunt-says-opposition-20180422-p4zazv.html

Laravel job traits

Ref https://blog.tiger-workshop.com/laravel-queue-job-class-demystified-shouldqueue-dispatchable-interactswithqueue-queueable-serializesmodels/

block chain

A blockchain includes a group of serilized blocks. The start block is called the genesis block.

Confluence Alternative

  • https://www.bitrix24.com/prices/
  • https://www.nuclino.com/product
  • https://www.learnbee.co/
  • https://www.tiphive.com/
  • https://honey.is/
  • https://documize.com/

Tensorflow components

1.TensorFlow API 2.TensorBoard 3.TensorFlow

IDE shortcuts

Template

line move up/down line replication remove line select next select all

Gocker run command

Main

Setup CLI command instance by using github.com/urfave/cli.

Python impliment simple neural network

Input x1 Input x2 Input x3 Output Y
0 0 1 0
0 1 1 1
1 0 1 1
1 1 1 0

PHP neural network

Repos

  • https://github.com/gabrielrcouto/php-simple-neural-network

Turning business logic to services

```mermaid graph TB

golang resources

Docs

  • How to Write GO Code en cn
  • studygolang.com
  • https://studygolang.com/articles/2989?fr=sidebar

go test case

Command

  • go test ./...: run all test cases in correct directory
  • go test -cover: display test case coverage
  • go test -run Name: run specific golang test case

Composer versions and constraints

  • ~1.2.3 means 1.2.3 <= version < 1.3.0
  • ^1.2.3 means 1.2.3 <= version < 2.0.0

go dep

``` apk add git nano go musl-dev

Gocker

```mermaid sequenceDiagram

Linux proc file system

Directory and file Comment
/proc/N process PID is N
/proc/N/cmdline command start process
/proc/N/cwd link to process current word directory
/proc/N/environ Env var list for process
/proc/N/exe link to process executable command file
/proc/N/fd includes all file desc of process related file
/proc/N/maps process related memory info
/proc/N/mem memory space of current process, not readable
/proc/N/root root directory of process
/proc/N/stat status of process
/proc/N/statm memory status of process
/proc/N/status process status, better than stat and statm
/proc/self/ current process

Union file system

copy-on-write CoW.

Test prestissimo speed up composer

Without prestissimo

Run docker env

``` docker run -it –rm dockercraft/composer

Teamcity

docker run -it --rm --name teamcity \
    -v /var/teamcity/datadir:/data/teamcity_server/datadir \
    -v /var/teamcity/log:/opt/teamcity/logs  \
    -p 8111:8111 \
    jetbrains/teamcity-server

phpunit test guideline

Pattern

php artisan optimize command eat all ram space

Solution 1

Working try first command, not use second one

composer update --no-scripts
composer dump-autoload -o

Interview practice

Laravel frontend setup

Install laravel composer create-project --prefer-dist laravel/laravel project

Laravel codedeploy

Ref

Frontend resources

Larave with docker

Ref

  • https://learnk8s.io/blog/deploying-laravel-to-kubernetes
  • http://laradock.io/
  • https://medium.com/@shakyShane/laravel-docker-part-1-setup-for-development-e3daaefaf3c
  • https://medium.com/@shakyShane/laravel-docker-part-2-preparing-for-production-9c6a024e9797

[IDEA]A blog based on larave

Requirement

  • Front-end
  • Back-end
    • user can login
    • user can create website
    • user can link domain(s) to webiste.
    • user can see posts of website

Docker Let's Encrypt

Ref:

  • https://manas.tech/blog/2016/01/25/letsencrypt-certificate-auto-renewal-in-docker-powered-nginx-reverse-proxy.html
  • https://miki725.github.io/docker/crypto/2017/01/29/docker+nginx+letsencrypt.html
  • https://hub.docker.com/r/linuxserver/letsencrypt/
  • http://www.automationlogic.com/using-lets-encrypt-and-docker-for-automatic-ssl/
  • https://community.letsencrypt.org/t/tutorial-how-to-automate-lets-encrypt-using-docker-and-nginx/49917

Where to buy

ple

[HowTo]Mysql migration

``` sudo docker run -it –rm -v /home/www-user/tmp:/backup dockercraft/mysql-client /bin/sh

DB table entity with json to csv

```php $entities = DB::table(‘temp’)->get()->toArray();

[HowTo]sysbench

find . -name 'oltp*'*

[HowTo]Mysql docker

``` sudo docker run -it –rm -v ./mysql:/mysql mysql:5.6 /bin/bash sudo docker run -it –rm -v /home/www-user/mysql:/mysql mysql:5.6 /bin/bash sudo docker run -d –rm -v /home/www-user/mysql:/var/lib/mysql mysql:5.6 /bin/bash sudo docker run -it –rm -v /home/www-user/mysql:/mysql -v /home/www-user/etc/mysql:/etc-mysql mysql:5.6 /bin/bash sudo docker run -d –rm -v /home/www-user/mysql:/mysql -v /home/www-user/etc/mysql:/etc/mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=simplepassword mysql:5.6

AWS Cloud9

     ___        ______     ____ _                 _  ___  
    / \ \      / / ___|   / ___| | ___  _   _  __| |/ _ \ 
   / _ \ \ /\ / /\___ \  | |   | |/ _ \| | | |/ _` | (_) |
  / ___ \ V  V /  ___) | | |___| | (_) | |_| | (_| |\__, |
 /_/   \_\_/\_/  |____/   \____|_|\___/ \__,_|\__,_|  /_/   ----------------------------------------------------------------- 

Linux Control Groups

Three components

  • Cgroup
  • Linux subsystem
  • Hierarchy

Linux Namespace

  • UTS Namespace
    • seprate nodename and domainname, every namespace has own hostname
    • CLONE_NEWUTS create new UTS namespace
  • IPC Namespace
    • seprate System V IPC and POSIX message queues, every IPC namespace has own System V IPC and POSIX message queues
    • CLONE_NEWIPC create new IPC Namespace
  • PID Namespace
    • CLONE_NEWPID create new PID namespace
  • Mount Namespace
    • CLONE_NEWNS
  • User Namespace
  • Network Namespace

PHP code quality tools

  • unit test (para)
  • phpcs
  • phpmd
  • phpcpd
  • phpstan

PHP code style

“symplify/coding-standard”: “^4.4”, “symplify/easy-coding-standard”: “^4.4”,

Nginx+PHP docker compose

``` location ~ .php$ { proxy_intercept_errors on; fastcgi_keep_conn on; client_max_body_size 1024M; try_files $uri =404;

Nginx docker

/Users/DHome/Dockercraft/nginx/ningx

Jekyll algolia

ENV

Make sure your OS support zlib (linux package) Example of alpine linux

apk add zlib-dev

PHP docker

``` FROM dockercraft/alpine:3.7 MAINTAINER Daniel daniel@topdevbox.com

Laravel project standards

\ for php function

``` \isset($var);

Make product import easy

```mermaid graph LR

Laravel Incremental APIs

VOS VOIP keyword index

VOS

Hugo config

Create new website hugo new site .

AWS Machine Learning Services

Amazon SageMaker

It is a fully-managed platform that enables developers and data scientists to quickly and easily build, train, and deploy machine learning models at any scale.

Automatically deploy static website

```bash FROM ubuntu:18.04

AWS CLI

AWS Regions

[PHP]Convert JSON to class instance

https://johannespichler.com/from-json-to-model-instances-in-php/

PHP 7.1 new features

Nullable Types

// return null|int
function checkAge($age): ?int
{
	if($age > 12){
		return $age;
	}else{
		return null; 
	}
}

PHP extensions for Laravel

  • php7.1
  • php7.1-common
  • php7.1-cli
  • php7.1-fpm
  • php7.1-mysql
  • php7.1-mcrypt
  • php7.1-mbstring
  • php7.1-xml
  • php7.1-gd
  • php7.1-curl
  • php-xdebug
  • php7.1-bcmath

Travis CI

https://docs.travis-ci.com/user/docker/ https://docs.travis-ci.com/user/languages/ruby/#stq=&stp=0 https://docs.travis-ci.com/user/deployment/s3/

Execute Artisan Command

```php \Illuminate\Support\Facades\Artisan::call(‘command’, [ ‘param1’ => ‘value’, ‘–param2’ => ‘value’, ]);

Host static website on AWS S3

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PublicReadGetObject",
            "Effect": "Allow",
            "Principal": "*",
            "Action": [
                "s3:GetObject"
            ],
            "Resource": [
                "arn:aws:s3:::example-bucket/*"
            ]
        }
    ]
}

Lactation Cookies

Cookies recipes

  • 1 cup self raising wholemeal flour (if you have plain flour, add 1/2 teaspoon baking powder)
  • 1/2 cup butter (you can use organic virgin coconut oil instead if you prefer)
  • 3/4 cup brown sugar (if you want to reduce sugar, you could try just 1/2 cup)
  • 2 tablespoons flaxseed meal
  • 1 egg
  • 2-3 tablespoons of water (depends on how moist you prefer the cookies to be)
  • 1 tablespoon vanilla extract (optional, for flavour)
  • 1 teaspoon cinnamon (optional, for flavour)
  • 1-2 tablespoons of brewers yeast – do not substitute with bakers yeast or any other yeast
  • 1/2 teaspoon salt
  • 1 & 1/2 cups oats – organic, steel cut oats are best for you, but rolled oats are fine
  • OPTIONAL: 1/2 cup of your favourite biscuit ingredients (see suggested list below) -

Crontab schedule

Description Example
Every minute * * * * *
Every 2nd minute * /2 * * *
At minute 30. 30 * * * *
At 00:00. 0 0 * * *

Deletion Distance

Overview

The deletion distance of two strings is the minimum number of characters you need to delete in the two strings in order to get the same string. For instance, the deletion distance between heat and hit is 3:

[PHP]Calling dynamic method by name

```php

[PHP]Creating instance of dynamic class

```php $classPath = \explode(“\”, NAMESPACE); \array_pop($classPath); $newPath = \implode(“\”, $classPath) . “\Drivers\”; $className = $newPath . Str::studly($this->driver); if (!\class_exists($className)) { throw new DriverException(‘Could not find driver’); }

[SQL] Deleting and updating data from multiple related tables(On Delete)

On Delete

  • Set null
  • Cascade
  • No action
  • Restricct

PHP Bitmask

```php const FLAG_1 = 0b0001; // 1 const FLAG_2 = 0b0010; // 2 const FLAG_3 = 0b0100; // 4 const FLAG_4 = 0b1000; // 8 // Can you see the pattern? ;-)

Task flow chat

```mermaid graph TB

Simple Store

Element

PHP-ML Apriori example

Initial

PHP natural Language Processing Tools

Classification Models

PHP Machine Learning Algorithms

Machine Learning Frameworks

Name By Desc Website
Tensorflow Google Machine learning framework Website
Pytorch Facebook Tensors and Dynamic neural networks Website
MXnet Amazon A Scalable Deep Learning Framework Website
SNTK Microsoft Microsoft Cognitive Toolkit GitHub

Global space

In PHP, the global space refers to the highest level of the PHP namespace hierarchy. It is also known as the global scope or global namespace. When you define variables, functions, classes, or constants outside of any namespaces, they are considered to be part of the global space.

Laravel test eloquent observer

Observer design pattern

No Offset Query

What is Offset in SQL query

Welcome to Jekyll!

You’ll find this post in your _posts directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run jekyll serve, which launches a web server and auto-regenerates your site when a file is updated.

No result