Skip to content

Instantly share code, notes, and snippets.

@1242035
1242035 / listToFlatArray.js
Created July 25, 2019 11:31
rebuild array from tree es6
export function listToFlatArray(treeStructure) {
let flatten = (children, extractChildren, level, parent) => Array.prototype.concat.apply(
children.map(x => ({ ...x, level: level || 1, parent: parent || null })),
children.map(x => flatten(extractChildren(x) || [], extractChildren, (level || 1) + 1, x.id))
);
let extractChildren = x => x.children;
return flatten(extractChildren(treeStructure), extractChildren).map(x => delete x.children && x);
}
@1242035
1242035 / WasabiServiceProvider.php
Created July 23, 2019 04:42
Laravel Wasabi storage provider
<?php
namespace App\Providers;
use Storage;
use Aws\S3\S3Client;
use League\Flysystem\AwsS3v3\AwsS3Adapter;
use League\Flysystem\Filesystem;
use Illuminate\Support\ServiceProvider;
@1242035
1242035 / mongodb.conf
Created July 23, 2019 04:41
Mongodb nssm service window config file
storage:
dbPath: "D:\\server\\mongodb\\db"
systemLog:
destination: file
path: "D:\\server\\mongodb\\logs\\mongod.log"
@1242035
1242035 / default.conf
Last active July 17, 2019 17:14
Config nginx + php service on window use nssm
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
@1242035
1242035 / vue google map
Created June 24, 2019 11:49
vue google map
<div class="w-100 h-100">
<googlemaps-map
ref="app__map"
class="w-100 h-100"
:center.sync="center"
:zoom.sync="zoom"
:options="mapOptions"
@idle="onIdle"
@click="onMapClick">
<googlemaps-user-position
@1242035
1242035 / README.md
Created May 30, 2019 06:02 — forked from claytonrcarter/README.md
Share named routes between Laravel and Javascript

Share named routes between Laravel and Javascript

This is a 2-part technique to share named routes between Laravel and Javascript. It uses a custom artisan command to export your named routes to JSON, and a Javascript route() helper to lookup the route and fill in any parameters. Written for Laravel 5.3; not tested in 5.4.

Installation

1. Install RouteJson.php

Copy RouteJson.php into your app as app/Console/Commands/RouteJson.php

@1242035
1242035 / docker-stop-remove-image-container-all.bat
Created March 16, 2019 03:16
docker-stop-remove-image-container-all
@ECHO OFF
FOR /f "tokens=*" %%i IN ('docker ps -q') DO docker stop %%i
FOR /f "tokens=*" %%i IN ('docker ps -q') DO docker container rm -f %%i
FOR /f "tokens=*" %%i IN ('docker images --format "{{.ID}}"') DO docker rmi -f %%i
@1242035
1242035 / git-clearHistory
Created June 22, 2018 04:13 — forked from stephenhardy/git-clearHistory
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
@1242035
1242035 / ecc.py
Created May 25, 2018 03:34 — forked from bellbind/ecc.py
[python]basics of elliptic curve cryptography
# Basics of Elliptic Curve Cryptography implementation on Python
import collections
def inv(n, q):
"""div on PN modulo a/b mod q as a * inv(b, q) mod q
>>> assert n * inv(n, q) % q == 1
"""
for i in range(q):
if (n * i) % q == 1:
Today I got the same problem, after trying many solutions
i found that the problem was the command sudo systemctl disable mysql.service that i used to disable MySQL auto starting,
so to get it working i re-enabled again MySQL server using the command sudo systemctl enable mysql.service
and run again the upgrade process and it terminated perfectly.
https://askubuntu.com/questions/760724/16-04-upgrade-broke-mysql-server