目录

程序员子悠 · 好记性不如烂笔头

技术人生 X 人生技术

The 16th Week of ARTS:Sliding Window Maximum_239

Introduction Algorithm - Learning Algorithm Review - Learning English Tip - Learning Techniques Share - Learning Influence Let's do it!!! Algorithm Sliding Window Maximum Description Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position. Return the max sliding window. My Solution package com.silence.arts.leetcode.stack; impor....

The 15th Week of ARTS:KthLargest Element in a Stream_703

Introduction Algorithm - Learning Algorithm Review - Learning English Tip - Learning Techniques Share - Learning Influence Let's do it!!! Algorithm KthLargest Element in a Stream Description Design a class to find the kth largest element in a stream. Note that it is the kth largest element in the sorted order, not the kth distinct element. Your KthLargest class will have a constructor which accepts an integer k and an integer array nums, which contains initial elements from the stream. For each ....

The 14th Week of ARTS:LinkedListCycle_142

Introduction Algorithm - Learning Algorithm Review - Learning English Tip - Learning Techniques Share - Learning Influence Let's do it!!! Algorithm Linked List Cycle II Description Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Note: Do not modify the linked list. My Solution package com.silence.arts.leetcode.list; import java.util.HashSet; import java.util.Set; /** * <br> * <b>Function:</b><br> * <b>Author:</b>....

基于 Redis 注册中心的 Dubbo 监控平台搭建

背景 本文描述的 Dubbo 监控系统都是基于 Redis 作为注册中心的 无需同时部署多个监控中心 官方 Dubbo-admin 和 Dubbo-monitor 搭建 GitHub 官方组件目前在重构,采用前后分离技术,尚未完成。本文采用的还是 master 分支的老版本 dubbo-admin 搭建步骤 git clone https://github.com/apache/incubator-dubbo-ops 在 dubbo-admin 项目的 pom.xml 中增加 Redis 依赖,因为我们这里用的是 Redis 作为注册中心 <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId> <version>2.9.0</version> </dependency> <dependency> <groupId>commons-io</groupId> ......

The 13th Week of ARTS:Valid Parentheses_20

Introduction Algorithm - Learning Algorithm Review - Learning English Tip - Learning Techniques Share - Learning Influence Let's do it!!! Algorithm Sort List Description Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: Open brackets must be closed by the same type of brackets. Open brackets must be closed in the correct order. Note that an empty string is also considered valid. My Solution package ....

The 12th Week of ARTS:LinkedListCycle_141

Introduction Algorithm - Learning Algorithm Review - Learning English Tip - Learning Techniques Share - Learning Influence Let's do it!!! Algorithm Sort List Description Given a linked list, determine if it has a cycle in it. My Solution package com.silence.arts.leetcode.list; /** * <br> * <b>Function:</b><br> * <b>Author:</b>@author Silence<br> * <b>Date:</b>2018-10-21 23:50<br> * <b>Desc:</b>无<br> */ public class Lin....

The 11th Week of ARTS:Sort List_148

Introduction Algorithm - Learning Algorithm Review - Learning English Tip - Learning Techniques Share - Learning Influence Let's do it!!! Algorithm Sort List Description Sort a linked list in O(n log n) time using constant space complexity. Example 1: Input: 4->2->1->3 Output: 1->2->3->4 Example 2: Input: -1->5->3->4->0 Output: -1->0->3->4->5 My Solution package com.silence.arts.leetcode.list; import java.util.ArrayList; import java.util.List; /** * <....

常用算法笔记

常用算法笔记 @(公众号)[技术点] 快排 package com.silence.arts.leetcode.second; public class QuickSort { public static void main(String[] args) { int[] array = new int[]{10, 5, 3, 1, 7, 2, 8, 0}; quickSort2(array, 0, array.length - 1); for (int element : array) { System.out.print(element + " "); } } public static void quickSort2(int[] arr, int left, int right) { if (left < right) { int position = position(arr, left, right); quickSort2(arr, left, position - 1); quickSort2(arr, position + 1, right); } } public....

The 10th Week of ARTS:206-ReverseLinkedList

Introduction Algorithm - Learning Algorithm Review - Learning English Tip - Learning Techniques Share - Learning Influence Let's do it!!! Algorithm Reverse Linked List Description Reverse a singly linked list. Example: Input: 1->2->3->4->5->NULL Output: 5->4->3->2->1->NULL My Solution package com.silence.arts.leetcode.second; /** * <br> * <b>Function:</b><br> * <b>Author:</b>@author Silence<br> * <b>Date:</b>2018....

个人博客Google AdSense接入

个人博客Google AdSense接入 @(公众号)[blog] 前言 最近将个人博客接入的Google AdSense 系统(发现了一个发家致富的方法,虽然没什么访问量~~😜)。 Google AdSense 百度百科 简单来说就是网站上接入广告,用户在浏览的时候如果点击了广告就会有收益。当然接入的广告是有后台可以用网站长自己控制的。 效果 网站效果 Google AdSense后台效果~美刀。。。 接入流程——简单方便 首先当然有个个人网站; 注册Google AdSense账号,填入相关信息,坐等审核通过,一般一两天,会有邮件通知; 在网站中加入相关JS脚本代码,这段代码注册完了AdSense会提供; 基本完成。。后面就是在后台配置一些自己觉得可以的广告,或者屏蔽一些不好的广告即可,以及控制一些广告类型,比如图文,链接啥的。 后台效果 结语 嗯,现在自己有了一个日常任务,就是每天看几次博客,然后点点广告😂,毕竟没什么访问量,还得靠自己😅 欢迎去点广告🙃🙃🙃https://zxsilence.cn/ One more thing Personal Medium Hom....

The 9th Week of ARTS:16-3Sum Closest

Introduction Algorithm - Learning Algorithm Review - Learning English Tip - Learning Techniques Share - Learning Influence Let's do it!!! Algorithm 3Sum Closest Description Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each input would have exactly one solution. Example: Given array nums = [-1, 2, 1, -4], and target = 1. The sum that is closest to the target is....

记一次线上Nginx响应超时问题

项目背景 线上有两个项目,分别为tomcat 项目A,以及一个SpringBoot项目B,项目A,使用Nginx代理转发。 问题描述 从A项目中上传一个30秒的视频,通过HTTP上传到B项目中使用FFmpeg对其进行一系列解析等动作,然后返回视频的CDN地址。 由于此操作过程一般会耗时5-6分钟,在本地和测试环境将http请求的超时时间sockettimeout设置为10分钟,可以正常使用。 但是在生成环境下却发现有时能上传成功,有时却不行。 解决 经过多次测试发现,每次上传失败的处理时长大概都是5分钟,由于HttpClient代码里面默认设置的是5分钟,所以一直导致我认为是修改的配置没有生效。最后修改源码,将超时时间默认值改成20分钟,发现还是在5分钟左右就报错。 这个时候就可以确定肯定是有其他地方有个5分钟设置超时时间导致的。然后跟运维的同事一起分析了下nginx配置,发现有个proxy_read_timeout=300s的设置,这个时候基本上就已经定位问题原因了。 为了确定问题先在没改配置的时候使用ip地址访问上传视频,最后正常处理。然后修改配置为10分钟,通过域名访问,结果跟预....

The 8th Week of ARTS:144-Binary Tree Preorder Traversal

Introduction Algorithm - Learning Algorithm Review - Learning English Tip - Learning Techniques Share - Learning Influence Let's do it!!! Algorithm Binary Tree Preorder Traversal Description Given a binary tree, return the preorder traversal of its nodes' values. Example: Input: [1,null,2,3] 1 2 / 3 Output: [1,2,3] My Solution package com.silence.arts.leetcode.second; import java.util.ArrayList; import java.util.List; /** * <br> * <b>Function:</b><br> * <b>Author:&a....

The 7th Week of ARTS:94-Binary Tree Inorder Traversal

Introduction Algorithm - Learning Algorithm Review - Learning English Tip - Learning Techniques Share - Learning Influence Let's do it!!! Algorithm Binary Tree Inorder Traversal Description Given a binary tree, return the inorder traversal of its nodes' values. Example: Input: [1,null,2,3] 1 \ 2 / 3 Output: [1,3,2] 2. My Solution package com.silence.arts.leetcode.second; import java.util.ArrayList; import java.util.List; /** * <br> * <b>Function:</b><br> * <b>Auth......

The 6th Week of ARTS:7-ReverseInteger And 9-PalindromeNumber

Introduction Algorithm - Learning Algorithm Review - Learning English Tip - Learning Techniques Share - Learning Influence Let's do it!!! Algorithm ReverseInteger Description Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Example 2: Input: -123 Output: -321 Example 3: Input: 120 Output: 21 My Solution package com.silence.arts.leetcode.first; /** * <br> * <b>Function:</b><br> * <b>Author:</b>@author Silence<br&....

The 5th Week of ARTS:8-String to Integer (atoi)

Introduction Algorithm - Learning Algorithm Review - Learning English Tip - Learning Techniques Share - Learning Influence Let's do it!!! Algorithm Description Implement atoi which converts a string to an integer. The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical digits as possible, and interprets them as a numerica....

The 4th Week of ARTS:5-Longest Palindromic Substring

Introduction Algorithm - Learning Algorithm Review - Learning English Tip - Learning Techniques Share - Learning Influence Let's do it!!! Algorithm Description Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example 1: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example 2: Input: "cbbd" Output: "bb" Solution Brute Force package com.silence.arts.leetcode.first; /** * <br> * <b>Function:</b>.....

基于Github的Webhook实现发布代码后网站自动部署

基于Github的Webhook实现发布代码后网站自动部署 @(公众号)[知识付费] Introduction 原来使用Github的guthub.io资源库搭建的个人网站,最近迁移到了腾讯云上面。所以之前的部署流程就变成了:本地编写——>push到github——>登录到腾讯云pull代码——>重启jekyll。一次两次还能容忍,但是次数多了就不能接受了,十分麻烦,所以这两天就调整了一下,用基于Github的Webhook来实现代码push到Github后,自动发布。 流程就变成了如下。 自动部署流程 使用github-webhook-handler开发一个Http服务 确保安装了npm 创建一个自动发布的目录autobuild,初始化一个package.json npm init -f 安装github-webhook-handler npm i -S github-webhook-handler 编写index.js,注意mysecret需要跟github的webhook配置一致 [root@VM_225_78_centos autobuild]# cat in....

The 3rd Week of ARTS:4-Median of Two Sorted Arrays

Introduction Algorithm - Learning Algorithm Review - Learning English Tip - Learning Techniques Share - Learning Influence Let's do it!!! Algorithm Description There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The median is (2 + 3)/2 = 2.5 Solution package com.silence.arts.leetcod....

任务调度Azkaban(二)任务流

Command任务 创建tpye=command的job文件 silence-pro:command silence$ ll total 40 -rw-r--r-- 1 silence wheel 61 7 3 21:38 command1.job -rw-r--r-- 1 silence wheel 74 7 6 17:56 command2.job -rw-r--r-- 1 silence wheel 68 7 6 17:59 command3.job -rw-r--r-- 1 silence wheel 67 7 6 17:57 command4.job -rw-r--r-- 1 silence wheel 74 7 6 18:00 command5.job silence-pro:command silence$ cat command1.job type=command command=echo "create directory before get data" silence-pro:command silence$ cat command2.job type=comma....