Skip to content

Instantly share code, notes, and snippets.

View d1y's full-sized avatar
💤

小猫 d1y

💤
View GitHub Profile
@d1y
d1y / gist:d809eed89a7b957b04c7f7dab15ea258
Created March 15, 2021 02:46 — forked from hpatoio/gist:4398399
Create a MySQL database and create a user with all grant on it
CREATE USER 'DB_USERNAME'@'localhost' IDENTIFIED BY 'DB_PASSWORD';
GRANT USAGE ON * . * TO 'DB_USERNAME'@'localhost' IDENTIFIED BY 'DB_PASSWORD' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;
CREATE DATABASE IF NOT EXISTS `DB_USERNAME` ;
GRANT ALL PRIVILEGES ON `DB_USERNAME` . * TO 'DB_USERNAME'@'localhost';
#For connection from everywhere
GRANT USAGE ON * . * TO 'DB_USERNAME'@'%' IDENTIFIED BY 'DB_PASSWORD' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0
GRANT ALL PRIVILEGES ON `DB_USERNAME` . * TO 'DB_USERNAME'@'%';
@d1y
d1y / npm.taobao.sh
Created November 18, 2020 05:37 — forked from 52cik/npm.taobao.sh
npm 淘宝镜像配置
npm set registry https://r.npm.taobao.org # 注册模块镜像
npm set disturl https://npm.taobao.org/dist # node-gyp 编译依赖的 node 源码镜像
## 以下选择添加
npm set sass_binary_site https://npm.taobao.org/mirrors/node-sass # node-sass 二进制包镜像
npm set electron_mirror https://npm.taobao.org/mirrors/electron/ # electron 二进制包镜像
npm set ELECTRON_MIRROR https://cdn.npm.taobao.org/dist/electron/ # electron 二进制包镜像
npm set puppeteer_download_host https://npm.taobao.org/mirrors # puppeteer 二进制包镜像
npm set chromedriver_cdnurl https://npm.taobao.org/mirrors/chromedriver # chromedriver 二进制包镜像
npm set operadriver_cdnurl https://npm.taobao.org/mirrors/operadriver # operadriver 二进制包镜像
@d1y
d1y / README.md
Created November 2, 2020 01:46 — forked from hellokaton/README.md
Go 的信号处理和优雅退出

每个平台的信号定义或许有些不同。下面列出了POSIX中定义的信号。 Linux 使用34-64信号用作实时系统中。 命令man 7 signal提供了官方的信号介绍。

在POSIX.1-1990标准中定义的信号列表

@d1y
d1y / x.md
Created August 7, 2020 17:11
@d1y
d1y / confirm.go
Created August 7, 2020 16:12 — forked from r0l1/confirm.go
Go (golang): How to ask for user confirmation via command line
/* MIT License
*
* Copyright (c) 2017 Roland Singer [[email protected]]
*
* 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:
$(function () {
// Copy link to clipboard
// No lib to do this ;)
$("#copy").on('click', function () {
/* Get the text field */
var copyText = document.getElementById("direct-gif-link");
/* Select the text field */
copyText.select();
copyText.setSelectionRange(0, 99999); /*For mobile devices*/
flutter run --enable-software-rendering
@d1y
d1y / wap2app.js
Created May 13, 2020 04:27
wap2app 示例
(function(){
function callBackSuccess(params , res){
try{
if(typeof params.success){
params.success(res) ;
return true ;
}
return false ;
}catch(e){
@d1y
d1y / 1.js
Created May 5, 2020 08:34
懒加载示例
function isInSight(el) {
const bound = el.getBoundingClientRect();
const clientHeight = window.innerHeight;
//如果只考虑向下滚动加载
//const clientWidth = window.innerWeight;
if ( (bound.top + bound.height) < 0 ){
return true;
} else {
return false;
@d1y
d1y / axios.js
Created April 30, 2020 06:09
axios拦截器
import axios from 'axios'
import { baseURL } from '@/config'
import { getToken } from '@/lib/util'
class HttpRequest {
constructor (baseUrl = baseURL) {
this.baseUrl = baseUrl
this.queue = {}
}
getInsideConfig () {