Skip to content

Instantly share code, notes, and snippets.

View luojiyin1987's full-sized avatar
💭
I may be slow to respond.

luo jiyin luojiyin1987

💭
I may be slow to respond.
View GitHub Profile
#/bin/bash
while true;
do
count=`ps -p $(cat application.pid)|wc -l`
if [ ${count} -lt 2 ]; then
nohup jdk-11.0.11/bin/java -Xms2g -Xmx8g -jar auto-image-compose-server-0.0.1-SNAPSHOT.jar &
else
echo "image-compose-server is running"
fi
version: "3"
services:
traefik:
container_name: traefik
image: traefik:v2.4.8
restart: always
ports:
- 80:80
- 443:443
networks:
@luojiyin1987
luojiyin1987 / gist:008d123479600a0d559aac37149bef9d
Created June 8, 2021 02:22
七牛云网络存储 批量上传
dir=./$1
fileprefix=$2
for file in $dir/*
do
echo ${file:2}
./qshell fput mybucket $fileprefix${file:2} $file
done
@luojiyin1987
luojiyin1987 / gist:ceccda286da91a60d826cfc9f707324f
Last active February 5, 2021 07:34
use jquery from input copy upload file to other input
$('#pic1')[0].files = $('.bcpo-file input')[0].files;
@luojiyin1987
luojiyin1987 / CountUnhappyFriends.js
Created November 30, 2020 14:54
CountUnhappyFriends set
/**
* @param {number} n
* @param {number[][]} preferences
* @param {number[][]} pairs
* @return {number}
*/
var unhappyFriends = function(n, preferences, pairs) {
let arr = Array.from(Array(n), item=> new Array(n).fill(0));
for(let i=0; i<n; i++) {
@luojiyin1987
luojiyin1987 / crowller.ts
Last active November 13, 2020 09:06
crowller superagent cheerio
import superagent from 'superagent';
import cheerio from 'cheerio';
interface Course{
title: string;
count: number;
}
class Crowller{
class Demo{
private static instance: Demo;
private constructor(public name: string) {}
static getInstance() {
if(!this.instance) {
this.instance = new Demo('dell llw');
}
return this.instance;
}
@luojiyin1987
luojiyin1987 / RankTeamsbyVotes.js
Last active November 5, 2020 12:12
sort 排序的强化,
/**
* @param {string[]} votes
* @return {string}
*/
var rankTeams = function(votes) {
if(votes.length ===1 ) {
return votes[0];
}
const teams = votes[0].length;
const obj = {};
@luojiyin1987
luojiyin1987 / RLE_Iterator.js
Created November 4, 2020 14:41
RLE 迭代器
/**
* @param {number[]} A
*/
var RLEIterator = function(A) {
this.data =A;
this.count = this.data.shift()||0;
this.num = this.data.shift();
};
/**
@luojiyin1987
luojiyin1987 / SpiralMatrixI.js
Created November 1, 2020 04:22
简化 逻辑判断的新写法, && 用来执行,不是单纯的判断
/**
* @param {number} n
* @return {number[][]}
*/
var generateMatrix = function(n) {
let b = [0, n - 1, 0, n - 1], x = 0, y = 0, i = 0, d = '→', r = new Array(n).fill(0).map(_=>new Array(n).fill(0))
while (i++ < Math.pow(n, 2)) {
d === '→' && (r[y][x++] = i, x === b[1] && (d = '↓', ++b[2])) ||
d === '↓' && (r[y++][x] = i, y === b[3] && (d = '←', b[1]--)) ||