Skip to content

Instantly share code, notes, and snippets.

View yanli0303's full-sized avatar

Yan Li yanli0303

View GitHub Profile
/* https://animista.net/ */
.typing {
animation: typing 2s steps(22), blink .5s step-end infinite alternate;
}
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'admin';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;
CREATE USER 'admin'@'%' IDENTIFIED BY 'admin';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' WITH GRANT OPTION;
SHOW GRANTS FOR mstr;
FLUSH PRIVILEGES;
CREATE DATABASE my_store CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="./style.css">
<title>Adopt Me</title>
</head>
@yanli0303
yanli0303 / open-new-broswer-window-by-post-method.js
Created April 22, 2021 17:27
Open a new browser window using HTTP POST method.
/**
* Submit login form with POST method.
* @param {string} action The login page URL.
* @param {string} target The name of the iframe, or `_blank`;
* @param {object} params The dictionary of form data.
* @returns The form element inserted into the page.
*/
export const postForm = (action, target, params) => {
const form = document.createElement('form')
form.style.display = 'none'
<?xml version="1.0" encoding="UTF-8"?>
<OfficeApp
xmlns="http://schemas.microsoft.com/office/appforoffice/1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0"
xmlns:mailappor="http://schemas.microsoft.com/office/mailappversionoverrides/1.0"
xsi:type="MailApp">
<Id>092ed79b-a5ca-5fa1-ba67-aa2e9691a362</Id>
@yanli0303
yanli0303 / how-to-capture-network-traffic-with-wireshark.md
Last active February 16, 2021 20:43
How to capture network traffic (TCP, UDP, Kerberos, HTTP, HTTPS...etc) with Wireshark

How to capture network traffic with Wireshark

This note introduces how to install and configure Wireshark to capture network traffics of following protocols:

  • TCP
  • UDP
  • Kerberos
  • HTTP
  • HTTPS
  • ...more
@yanli0303
yanli0303 / micro-module-services.md
Last active August 31, 2020 18:07
Micro Module Services Programming Model

Micro Module Services Programming Model

"Micro Module Services" is a loosely coupled programming model that aims to solve below problems of centralized design patterns such as MVC:

  • Controllers tend to get bigger and bigger over time (and multiple developers), and overly complex.
  • Big controllers would become God objects when they take responsibility for handling all kinds of requests. They end up with lots of code and do all kinds of things, they know and have access to almost everything in an application.
  • Big controllers hurt the isolation of concerns, make it hard to refactor or delete code, require more and more efforts to maintain.
  • Libraries designed in centralized patterns aren't reusable, because it's hard to separate one of the functionalities from the central points such as controllers.
  • Unit testing is difficult as test cases need to mock dependencies.

The Micro Module Services programming model borrows concepts from microservices, it structures an application

[
{
"id": "zhongzisou",
"name": "种子搜",
"proxy": false,
"url": "https://zhongzidi1.com",
"paths": {
"time": "/list/{k}/{p}",
"size": "/list_length/{k}/{p}",
"hot": "/list_click/{k}/{p}"
@yanli0303
yanli0303 / xcode-9-edit-in-scope.md
Created August 24, 2018 20:30
Xcode 9.4.1 edit in scope (rename a local variable)
  1. Set cursor to the variable name.
  2. Press and hold "SHIFT" key until all occurrences of the variable are highlighted.
  3. CMD + CTRL + E and start edit in scope.
@yanli0303
yanli0303 / HttpStatusEnum.strings
Last active July 27, 2018 19:35
HTTP Status Swift Enumeration based on https://httpstatuses.com/
/// HTTP Status
"http_status_100" = "Continue";
"http_status_101" = "Switching Protocols";
"http_status_102" = "Processing";
"http_status_200" = "OK";
"http_status_201" = "Created";
"http_status_202" = "Accepted";
"http_status_203" = "Non-authoritative Information";
"http_status_204" = "No Content";
"http_status_205" = "Reset Content";