Basically you need to add highlight.js into your blogger template. Then wrapper your code. See highlight.js usage
Here is a good tutorial about that: https://www.youtube.com/watch?v=APNWCe56cQA
Basically you need to add highlight.js into your blogger template. Then wrapper your code. See highlight.js usage
Here is a good tutorial about that: https://www.youtube.com/watch?v=APNWCe56cQA
We can create a REST API using AWS API Gateway and AWS Lambda by Proxy integration.
For Proxy integration, when API Gateway receives the request, it sends proxy resources such as path information and request body to Lambda function. Lambda function generates a responses based on information sent by API gateway. This response is sent back to API Gateway which send this response back to API user. In Lambda function, you can call other aws services such as store data in s3 bucket and send message to sqs before send back the response.
Step 1: Create a AWS Lamda function
Use Python as example. After create function, need to edit lambda_hander
import json
def lambda_handler(event, context):
# event has info of request passed by API Gateway
userId = event['queryStringParameters']['userId']
# build response body
body = {"user_id": userId, "message": "processed by Lambda"}
# build response
response = {'statusCode': 200, 'headers': {}}
# let API caller know that our body is in json format
response['headers']['content-type'] = 'application/json'
response['body'] = json.dumps(body)
return response
Note for node.js. In node.js, you can do
exports.myhandler = {event, context, callback) => {
//get path parameters
event.pathParamters...
//get body
event.body
//get query string
event.queryStringParameters ...
}
Note for debug:
For Python, use print something
For node.js, console.log something
Then we can see these debug info in cloudwatch
Step 2: Create a API Gateway
1. Pick Rest type
2. Create resource. Give it a name
3. Create method. We choose GET for this example.
4. In Get set up. Choose Integration type: Lambda Function. Also check "Use Lambda Proxy integration". Link the lambda function just created.
Step 3: deplay this API Gateway
Step 4: try it
find the api url and append a user id such as ?user_id=1
Step 5: add custom domain
You may want to add custom domain for this api.
Here is a good youtube video about setting up custom domain for API gateway
Here is a good youtube video about Gateway API and lamda function.
Redux store like a React state database. To display a component, we need retrieve states from store. When we take some actions on component, some states will be updated and we need to save these states in store. How do we connect all these pieces together? We will use Redux connect API!
To display a component, we need props. These props comes from states. We need a mapping between component's props and store's states. This function take state as parameter and return a mapping object.
const mapStateToProps = (state) => {
return {
user: state.app.user,
name: getName(state),
....
}
};
Noted we can do a direct mapping. Also we can call a function in reducer to do mapping.
These props can be used in function component directly
function myfuncComponent({user, name}) {
...
}
Also can access prop using the syntax below
this.props.user
Also noted we can access props generated by step two in the same way.
There is another pattern to do mapStateToProps. Map some props to states by modify states. Then copy all left states as props. See below
const mapStateToProps = (state) => {
const values = {
user: state.app.user,
name: getName(state),
....
};
//the first parameter is target. Here merge values
//with state. Then copy to the target and return target
return Object.assign({}, state, values);
//may do. only overwrite counut property and leave other properties intact
return {...state, count:state.count+1}
};
This function uses dispatch as a paramter. It defines mapping between user action and redux action by dispatch user action. Reduct action will pass the action event to reducer. Reducer will change states. States will map props, and component display will be changed.
const mapDispatchToProps = (disptach, ownProps) => {
return {
//when use handleSubmit, we can pass values
handleSubmit: values => dispatch(saveValues(values))
...
}
}
Example to use ownProps of mapDispatchToProps
const mapDispatchToProps = (dispatch, ownProps) => {
return {
toggleTodo: () => dispatch(toggleTodo(ownProps.todoId))
}
}
export default connect(
mapStateToProps,
mapDispatchToProps
)(ComponentName)
connect is a high order component. After call connect, it returns a new function. This new function will accept a component as argument and return an enchanced component. To understand this, we can do this in two step.
const newfunction = connect(mapStateToProps, mapDispatchToProps)
export default newfunction(ComponentName)
When write a component, we need some props and some event handlers. This is why we need to do state mapping and dispatch mapping.
Use provider to provide store and put our container into provider. Our app will render provider in root element. By far, things are put together.
import {Provider} from 'react-redux'
import store from './redux/store'
//we export container as default in myComponent
import container from './myComponent'
//create a store. To create a store, you should
//have written a reducer
import reducers from 'yourReducer'
import {createStore} from 'redux'
const store = createStore(reducers)
const root = document.getElementById('root')
ReactDOM.render(
<Provider store={store}>
<container />
</Provider>, root
);
Some nice explanation from stackoverflow
To see states of store
store.subscribe(() => console.log("state", store.getState()))
Once I find that state is updated, but component is not updated. Eventually, I figured out that was caused by shouldComponentUpdate. The following prograph comes from React documentation.
Use shouldComponentUpdate() to let React know if a component’s output is not affected by the current change in state or props. The default behavior is to re-render on every state change, and in the vast majority of cases you should rely on the default behavior. shouldComponentUpdate() is invoked before rendering when new props or state are being received. Defaults to true. This method is not called for the initial render or when forceUpdate() is used.
To create a redux form
//create a normal react component.
//It can be a function component or class component
let myComponent = (props) => {
return <form onSubmit={props.handleSubmit}> .... </form>
}
//convert to a redux-form component.
//Noted that reduxFormCreator is a function
let reduxFormCreator = reduxForm({form: 'my-form'})
myComponent = reduxFormCreator(myComponent)
//we can combine the above two lines into one line
myComponent = reduxForm({form: 'my-form'})(myComponent)
//redux form provide a Field component.
//Form elements like input or select needs to be replaced by Field
//this field component to make input to connect to redux store
<Field name="my_input_name" component="input" type="text"
onChange={some function}/>
//another Field example
<Field name="group_by_session" onChange={this.updateAndFetch.bind(this, "group_by_session")}
id="group_by_session" component="input" type="checkbox" />
The value from component prop of Field can be a stateless or stateful component. It can access these props
How to set intial values in Fields of Redux Form
submit form
//Redux-Form decorates your component with handleSubmit prop
let MyForm = ({
handleSubmit, handleCloseRequestChangeModal, error, handleCloseRequestChangeModalError, formErrors
}) => {
return (<>
<Field
name="storeName"
label = "Store Name"
component="input"
validate={[formFieldValidator.required, formFieldValidator.notEmpty]}
/>
<button className={"btn btn-success margin-right-3"} onClick={handleSubmit}>Save</button>
</>)
}
When use this redux form, we need to pass a function for onSubmit
<MyForm onSubmit={saveIntegration}/>
Add a hidden field in redux form and fill the hidden field dynamically
<Field
name="recaptchaToken"
component="input"
type="hidden"
/>
handleRemoteSubmit: (token) => {
dispatch(change('checkoutForm', 'recaptchaToken', token));
dispatch(submit('checkoutForm'))
}
If a component only needs render function and props, we can write it in function component.
//create one
function Square(props) {
return (
<button className="square" onClick={props.onClick}>
{props.value}
</button>
);
}
//to use it, we do NOT do a function call. Use it as normal component.
//pass two props. one is called value and the other is called onClick
<Square
value={this.state.squares[i]}
onClick={() => this.handleClick(i)}
/>
The Redux store has a method called dispatch. The only way to update the state is to call store.dispatch() and pass in an action object. The store will run its reducer function and save the new state value inside.
//here is how to apply this tech
//in the action.js, create a action creator
export const CHANGE_RESULTS_VIEW = 'CHANGE_RESULTS_VIEW';
export function changeResultsView(view) {
return { type: CHANGE_RESULTS_VIEW, view: view}
}
//in container, import that action creator. When do mapDispatchToProps,
//use action creator to create a action, and this action is passed into
//dispatch. dispatch will change state of store using logic defined
//in reducer.
const mapDispatchToProps = (dispatch, ownProps) => {
return {
changeResultsView: view => dispatch(changeResultsView(view)),
...
}
}
can use js logical && to add a element based on some condition
{books.length > 0 &&
<h2>
You have {books.length} books.
</h2>
}
Use update to keep the original object unchanged. Then create a upated new object. Here we use $set to set new value. Update has other commands such as $push
var update = require('immutability-helper');
const obj = {a:5, b:3}
const newObj = update(obj, {b: {$set:10}})
console.log("new obj:", newObj)
//newObj is {a:5, b:10}
//the below is example for $merge. use to update multiple values
update(state, {$merge:{details: '', showModal: false}})
properties with two names, like background-color, must be written with camel case syntax
<h1 style={{backgroundColor: "white"}}>Hello World!</h1>
//this css will keep spaces.jsx will remove space as default
<div style={{ whiteSpace: 'pre-wrap' }}>some text <div>
step one: define a function in mapDispatchToProp
const mapDispatchToProps = (dispatch, ownProps) => {
return {
handleCloseDetailsModal: () => dispatch({ type: CLOSE_DETAILS_MODAL })
}
};
step two: in render function, use object spread to get the function from props
step three: use that function in component. Note we put a function name. NOT call the function.
render() {
const {handleCloseDetailsModal } = this.props;
return (
<div><DetailsModal
isOpen={showModal}
closeDetailsModal={handleCloseDetailsModal}
details={details}
/></div>
);
}
//create a context object. Then create a function to return provider
const MyContext = createContext();
const GlobalContext = ({ children }) => {
//define some state here
var states = {...}
//if it is class component, use this.props.children
return (<MyContext.Provider values={...states}> {children}
</MyContext.Provider>)
}
There are several different ways. By now the most popular is to use useContext
//here useGlobalContext has values and we can put this
//line in any component. Therefore, this is just another way to share
//states between different components. Now useGlobalContext has values
//defined in the provider
const useGlobalContext = useContext(Context)
import {useState} from 'react';
function TestB() {
const [state, setState] = useState(0)
return (
<div>
<p>{state}</p>
<button onClick={() => setState(state + 1)}>More</button>
</div>
)
}
We can use setState() to change the state of the component directly as well as through an arrow function.
//change directly by passing an object
setState({ stateName : updatedStateValue })
//use function to change state
setState((prevState) => ({
stateName: prevState.stateName + 1
}))
export default class GooglePay extends React.Component {
constructor(props) {
super(props);
//Google payment client
this.paymentsClient = new google.payments.api.PaymentsClient({
environment: props.cardInfo.googlePayEnv // 'TEST' Or 'PRODUCTION'
});
//request sent to Google
this.paymentDataRequest = null;
//need this method to create payment data request
this.cardPaymentMethod = null;
//create Google Pay Button
this.createGooglePayButton();
}
state = {
isLoading: false
}
......
If parent component render multiple time and the child component is class component, the child component renders only once. However, if child component is function component, it will render the same time as parent component.
import { Container, Row, Col } from "react-bootstrap";
return (
<div className="App">
<Container>
<Row>
<Col className="bg-primary p-2">1 of 2</Col>
<Col className="bg-success p-2">2 of 2</Col>
</Row>
<Row>
<Col className="bg-success p-2">1 of 3</Col>
<Col className="bg-secondary p-2">2 of 3</Col>
<Col className="bg-danger p-2">3 of 3</Col>
</Row>
</Container>
</div>
);
need to add bootstrap css
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.4.1/dist/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
The below should work too. But I found it did not work. Have not figured out.
import 'bootstrap/dist/css/bootstrap.min.css';
If you have created a folder already, do not put my_app and instead use "."
npx create-react-app . --template typescript
function MyButton() {
function handleClick(event) {
let button = event.target;
alert(button.id);
}
return (
<button id="leo" onClick={handleClick} className="my-button">
Click Me
</button>
);
}
//three ways to write function component
function Welcome({name, ...props}) {
return <h1>Hello, {name}, yau are {props.age} old</h1>
}
function Welcome({name, age}) {
return <h1>Hello, {name}, yau are {age} old</h1>
}
function Welcome(props) {
return <h1>Hello, {props.name}, yau are {props.age} old</h1>
}
//use component
<Welcome name="smith" age="51" />
They are exactly the same. docker container run is new syntax introduced in Docker 1.13.
Because there are so many docker commands, docker has put these commands in different groups. docker run is put into the group of docker container.
Here is a list of docker container command:
It is encouraged to use the new syntax. Therefore, let us do:
docker container run
There should be only one default value in a module. There are two ways to export it.
export default function(n, m) {
return n + m;
}
another way
function add(n, m) {
return n + m;
}
export default add;
Assume the module name is math.js. To import it,
import sum from "./math.js";
Noted that we can give any name for default value when import it. Also do not need curly braces. For not default values, need curly braces.
For no default function export or import, need curly braces
import {mymethod} from '../../utilities/actions'
......
export {foo, awesom, check}
Import multiple functions from a module
import {get, set} as moduleName from 'module-name'
moduleName.get();
//or can do
import * as moduleName from 'module-name';
moduleName.get();
//or can do. But this may cause name collision
import {get,set} from 'module-name';
get()
//real life example
import * as yup from "yup";
username: yup.string().required("Username is required"),
(node:46383) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
If get the above error when use node to run the script. The warning message you are encountering indicates that you are trying to load an ES (ECMAScript) module in a Node.js environment, but your current setup is not configured to recognize it as such.
node use commonjs module format
To solve it, one: Use "type": "module" in package.json. The alternative way is: rename your JavaScript files to use the .mjs extension instead of .js.
When using ssh, you may need to remember lots of things such as host names, the sequence of servers to log into if you use proxy. However, you may use ssh config file to make life easy.
Here is an example. The file should be put in .ssh folder and named config
Host middle-server
StrictHostKeyChecking ask
HostName 123.35.678.12
User frank
Host target-server-name
ProxyJump middle-server
StrictHostKeyChecking ask
HostName 99.88.77.32
After create this config file, you can connect to target server by typing
ssh target-server-name
//also can use pem file
ssh -i NOC.pem ec2-user@target-server-name
Here is another example. It uses public and private key to log into jumpbox
host mm-jumpbox
HostName 123.213.58.123
User ec2-user
IdentityFile /Users/mark/.ssh/id_rsa
Host target-server-name
ProxyJump mm-jumpbox
StrictHostKeyChecking ask
HostName 10.123.44.44
Also can use pem file to log into jumpbox
Host mm-jumpbox
HostName 55.22.33.44
User ec2-user
IdentityFile ~/.ssh/NOC.pem
//then
ssh mm-jumpbox
Assume that jump box can connect to MySql server. However, your local can not connect to MySql server directly, but you can connect to jump box. You want to connect to MySql server from local. In this case, we can use port forward to solve the problem.
Here is config file:
# assume your jump box has ip 55.22.33.44
# assume MySql server has ip 10.10.44.43
Host mm-jumpbox
HostName 55.22.33.44
User ec2-user
IdentityFile ~/.ssh/NOC.pem
LocalForward 3308 10.10.44.43:3306
After you put the config into .ssh, you can
#step one
ssh mm-jumpbox
#step two, in another terminal. here 3308 match 3308 in config.
#Therefore called port forward
mysql -h 127.0.0.1 -P 3308 -u mysql-user-name --password='abdbbdbbd'
You have a existing PHP project and you have installed lots of libraries using composer. There are composer.json and composer.lock already.
use phpunit library as example
1. To install new one (--dev flag is used to put this library in require-dev section of compose.json)
composer require --dev phpunit/phpunit ^8
2. To remove old one
compose remove phpunit/phpunit
3. To update one
//without depency update
composer require --dev phpunit/phpunit ^9
We can check phpunit version
// go to vendor/bin
./phpunit --version
//with depency update
./composer.phar -W require guzzlehttp/guzzle 7.4.5
4. To install or update for all libraries
Davey Shafik has a good explanation. Composer: It’s All About the Lock File
Tilde Version Range (~) - ~1.2.3 is equivalent to >=1.2.3 <1.3.0
Caret Version Range (^) - ^1.2.3 is equivalent to >=1.2.3 <2.0.0
Once I got Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.3.0". You are running 7.2.24-0ubuntu0.18.04.9.
some libraries have platform requirement. In the vendor composer directory, there is a file called platform_check.php. This file will be updated when you install some libraies.
use this flag --ignore-platform-reqs when do compose install to avoid update that file. Also, composer will not check php version when install. Be sure you know what you are doing.
composer install --ignore-platform-reqs
./composer.phar require --ignore-platform-reqs -W google/cloud ^0.257
Another option is set a flag in the compose.json. Then that file will not be generated.
"config": {
"platform": {
"php": "8.0.22"
},
"platform-check": false
},
After a new libray is installed using composer, system seems not find the library. It may be because of cache. Can clear cache by the command below
composer clearcache
composer show --tree
If new classess are added to classmap package, need to run the command below to update autoload. It will update vendor/composer/autoload_classmap.php
composer dump-autoload
A use case is with PHP Propel 2. In compose.json, we need to add classmap directory.
autoload": {
"classmap": ["src/lib/Propel/generated-classes/"]}
After generated class using propel model:build, we need to run composer dump-autoload. Otherwise, may not be able to auto load these generated classes.
Propel class inherit debug for class not found
step one: om
step two: convert-conf
I want to update aws sdk for PHP to the latest version. Because there is a lock file, I can not remove the old version of aws sdk for PHP. If I remove the lock file first and do a composer install,I can install the latest version of aws PHP sdk. However, some functions of our project do not work. The following is how I solved this problem.
composer show aws/aws-sdk-php
To start:
sudo service jenkins start
To stop:
sudo service jenkins stop
To restart:
sudo service jenkins restart
To check status:
sudo systemctl status jenkins
To access: localhost:8080
use Pipe line to build git branch
Jenkins.instance.pluginManager.plugins.each{
plugin ->
println ("${plugin.getDisplayName()} (${plugin.getShortName()}): ${plugin.getVersion()}")
}
mkdir jenkins_home//let folder own by jenkin. If log into container
//and issue id command, got:
//uid=1000(jenkins) gid=1000(jenkins) groups=1000(jenkins)
cd jenkins_home
sudo chown -R 1000:1000 .docker run -d -p 49001:8080 -v ~/jenkins_home:/var/jenkins_home --name jenkins jenkins/jenkinsTo Start container
docker container start jenkins
To Stop container
docker container stop jenkins
mysqldump --host='127.0.0.1' --user=root --password='passwd' --column-statistics=0 db_name>dw.sql
select * from usermanager_users
into outfile '/tmp/test.csv' fields terminated by ',' enclosed by '"'
lines terminated by '\n';
mysql -u [username ] -p[password] [db_name] -e " SELECT * FROM [tbl_name] " > file_name
#Will match first name Mary, but not match mary
SELECT first_name FROM `name` WHERE first_name REGEXP BINARY 'Mary';
SHOW PROCEDURE STATUS WHERE Db = 'db_name'\G
# show details of procedure
SHOW CREATE PROCEDURE procedure_name\G
CREATE USER lshen@'10.18.276.170' IDENTIFIED BY 'eikdkdk123scx';
select * from mysql.user where User="lshen"\G
GRANT SELECT ON *.* TO lshen@'10.18.276.170';
FLUSH PRIVILEGES;
If swap between different MySQL versions, cache may cause problem. For example, they may use the different end character. Therefore, need to flush cache.
#To check whether the query cache is present in your MySQL server
mysql> SHOW VARIABLES LIKE 'have_query_cache';
#To monitor query cache performance
mysql> SHOW STATUS LIKE 'Qcache%';
#removes all query results from the query cache
mysql> RESET QUERY CACHE ;
Error message: Unable to open PDO connection [wrapped: SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client.
root cause:This error is coming from MySQL 8.x’s new default auth‐plugin (caching_sha2_password) which older PHP/MySQL clients (PDO_MYSQL via mysqlnd) don’t yet understand.
source database server is using Mysql8.4. data warehouse is using php7.3
Solution: upgrade data warehouse to use PHP 8.0
< apk add bash curl php7-mysqlnd php7-fileinfo php7-soap php7-pdo_mysql php7-xmlwriter mysql-client \
< php7-dom php7-tokenizer msmtp gnu-libiconv ncurses util-linux && \
---
> apk add bash curl php8-mysqlnd php8-fileinfo php8-soap php8-pdo_mysql php8-xmlwriter mysql-client mariadb-connector-c \
> php8-dom php8-tokenizer msmtp gnu-libiconv ncurses util-linux && \
1. install php ssh2 extension
in ubuntu
apt-get install libssh2-1-dev libssh2-php
test if php ssh2 installed
file_exists('ssh2_connect')
2. find finger print of remote server
connect to the server
ssh-keygen -lf /etc/ssh/ssh_host_rsa_key.pub
the second part is fingerprint
3. using ssh2 to scp files
$conn = ssh2_connect('remote-server-name', 22);
$fingerprint = ssh2_fingerprint($connection,
SSH2_FINGERPRINT_MD5 | SSH2_FINGERPRINT_HEX);
if ($fingerprint != $knowprint) {
die("middle man found");
}
ssh2_auth_password($conn, 'username', 'password');
ssh2_scp_send($conn, 'file_name_in_local, 'file_name_in_remote', 0777);
class Hello {
public static function say_hello()
{
echo "Hello World!\n";
}
}
//There are three ways to use call_user_func
//seperate class name and function
call_user_func(array("Hello", 'say_hello'));
//combine class name and function into one string
call_user_func('Hello::say_hello');
//create a object
call_user_func(array(new Hello(), 'say_hello'));
what extensions have been loaded
php -m
In Alpine, extension is here /usr/lib/php/modules
edit file /etc/security/limits.conf
//show limits
ulimit -a
diff -rq folder1 folder2
find ./ -name platform_check.php
open test.png
open test.jpg
//curl to redirect content to file
curl --output leo.jpg https://checkout.whahaha-content.com/images/unionpay.png
The -p flag will create nested directories if directories do not exist. If exist, do nothing.
//mkdir: leo: No such file or directory
mkdir leo/test
//this works
mkdir -p leo/test
replace all occurences of a pattern
//ie flag will replace in place and that file will be modified
sed -ie 's/unix/linux/g' my.txt
//all leo in my.txt will be replaced by developer. Also will make a backup file called my.txt.bak
sed -i.bak "s/leo/developer/g" my.txt
lsof -nP -iTCP -sTCP:LISTEN | grep <port-number>
find . -mindepth 1 -maxdepth 1 | wc -l
Select a symbol for which you want to find usages, right-click the symbol, and select Find Usages from its context menu.
Find functions in a fileView | Tool Windows | Structure
Variable type hint
/** @var RouteCollectorProxy $app */
public static $app;
5. SVN Blame//index.js
const express = require('express');
const app = express();
const port = 5000;
app.get('/', (req, res) => {
res.sendFile('index.html', {root: __dirname});
});
app.listen(port, () => {
console.log(`Now listening on port ${port}`);
});
const express = require('express');
const app = express();
//middleware to parse incoming request with json payload
app.use(express.json());
//middleware to parse incoming request with url encoded payload
app.use(express.urlencoded({ extended: true }));
const port = 5000;
app.get('/', (req, res) => {
res.sendFile('index.html', { root: __dirname });
});
app.listen(port, () => {
console.log(`Now listening on port ${port}`);
});
app.post('/api/create_transaction', (req, res) => {
const body = req.body;
console.log("body:", body);
res.status(201).json([]);
});
Set up project
Update Database
After database scheme XML is modified, we need to update database. Also need to generate model class again and running time conf
Connect
#enter password manually
mysql --host='10.22.999.162' --user=leo --password
#password in command
mysql -h 10.49.41.213 -u leo --password='mysecret'
Show commentsshow grants for 'cs_user'@'10.32.%.%'
4. Find stored procedures //find procedure
show procedure status where db="myDW"\G
//show procedure details
show create procedure load_dim_date\G
//flip that from security_type=definer to the invoker
ALTER PROCEDURE update_dim_date SQL SECURITY INVOKER;
show full processlist
# 1234 is process id coming from show processlist
kill 1234
show variables where Variable_name = 'hostname';
+---------------+--------------------------------------+
| Variable_name | Value |
+---------------+--------------------------------------+
| hostname | ip-10-32-210-21.corp.leotest.com |
+---------------+--------------------------------------+
1 row in set (0.09 sec)
select * from mysql.user \G
select version();
# if version 5.7.8 and up, can use remame statement
RENAME USER 'qrhen'@'10.17.259.170' TO 'qrhen'@'10.31.248.110';
GRANT SELECT ON `MyTabble`.* TO `lyhen`@`10.33.264.%`;
FLUSH PRIVILEGES;
SHOW GRANTS FOR `lyhen`@`10.33.264.%`;
#show grants for current logged in user
show grants;
lsof -i :3306