Skip to content

Instantly share code, notes, and snippets.

SET @database = "database name";
SET @charset = "utf8mb4";
SET @collate = "utf8mb4_unicode_520_ci";
SELECT "SET foreign_key_checks = 0;"
UNION ALL
SELECT concat(
"ALTER DATABASE `",
@PureLandFlying
PureLandFlying / agnoster.zsh-theme.md
Last active October 22, 2020 14:28
oh-my-zsh: fix git performance issue on WLS

vi ~/.oh-my-zsh/themes/agnoster.zsh-theme

disable

#prompt_git at build_prompt() function

WARNING: Could not lock User prefs. Unix error code 24.
Aug 15, 2020 7:50:34 PM java.util.prefs.FileSystemPreferences syncWorld
WARNING: Couldn't flush user prefs: java.util.prefs.BackingStoreException: Couldn't get file lock.
Have to change
/etc/security/limits.conf
/etc/sysctl.conf
to fix this issue.
put the lines below in wp-config.php
ini_set('display_errors','Off');
ini_set('error_reporting', E_ALL );
define('WP_DEBUG', false);
define('WP_DEBUG_DISPLAY', false);
@PureLandFlying
PureLandFlying / ScrollManager.tsx
Last active January 18, 2023 16:41 — forked from jeffijoe/ScrollManager.jsx
Save and restore scroll position in React
/*
The MIT License
Copyright (c) Jeff Hansen 2018 to present.
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:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION W
if ('scrollRestoration' in window.history) {
  window.history.scrollRestoration = 'manual';
}
#------------ bootstrap the cluster nodes --------------------
start_cmd='redis-server --port 6379 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 5000 --appendonly yes'
redis_image='redis:5'
network_name='redis_cluster_net'
docker network create $network_name
echo $network_name " created"
#---------- create the cluster ------------------------
@PureLandFlying
PureLandFlying / nodejs hangs
Last active February 12, 2020 19:29
nodejs hangs at startup
npm start
> forum@1.0.0 start forum
> node server.js
[HPM] Proxy created: / -> http://localhost:4000
- Building...Listening on port 1234
‼ Could not load existing sourcemap of "node_modules/noty/lib/noty.js".
‼ Could not load existing sourcemap of "node_modules/noty/lib/noty.js".
@PureLandFlying
PureLandFlying / composer.json
Last active January 17, 2020 02:28
How to fix "remove drupal/drupal No version set (parsed as 1.0.0)|remove drupal/core xxx"
change composer.json
"merge-plugin": {
"include": [
"core/composer.json", <-- Remove
],
"recurse": true,
"replace": false,
"merge-extra": false
}

mvnw Couldn't find "C:\dev\calcite.mvn\wrapper\maven-wrapper.jar", downloading it ... Downloading from: "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" Exception calling "DownloadFile" with "2" argument(s): "The request was aborted: Could not create SSL/TLS secure channel." At line:1 char:1