Skip to content

Instantly share code, notes, and snippets.

😀
Haha

vamdt vamdt

View GitHub Profile
View ReConstructBinaryTree.java
package com.vamdt.fox.fox.of;
import java.util.HashMap;
import java.util.Map;
/**
* pre arr + in arr => tree
* in arr + post arr => tree
* pre arr + post arr => tree
*/
View ssh_auto_complete.sh
complete -W "$(echo `cat ~/.ssh/config | grep 'Host '| cut -f 2 -d ' '|uniq`;)" ssh
View gist:970dce78d3d7b7e02b3a3215c99ba4e8
#!/bin/bash
while true
do
if [[ $(($RANDOM % 2)) -eq 0 ]]
then
echo "000"
else
echo "111"
fi
View CompletableFutureTest.java
public class CompletableFutureTest {
static class User {
private String nickname;
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
@vamdt
vamdt / edit_distance.py
Created Sep 20, 2018
Dynamic programming
View edit_distance.py
def main():
result = edit_distance("fox", "fab")
print(result)
def edit_distance(str1, str2):
len1 = len(str1)
len2 = len(str2)
maxtrix = [[i for j in range(len2 +1)] for i in range(len1 + 1)]
maxtrix[0] = [i for i in range(len1 + 1)]
View 素书.md

素 书

原始章第一

夫道、德、仁、义、礼,五者一体也。
道者,人之所蹈,使万物不知其所由。
德者,人之所得,使万物各得其所欲。
仁者,人之所亲,有慈惠恻隐之心,以遂其生成。
义者,人之所宜,赏善罚恶,以立功立事。
礼者,人之所履,夙兴夜寐,以成人伦之序。\

View AutomateProcess.java
public class AutomateProcessor {
private UserExceptionAnalysisListener userExceptionAnalysisListener = new UserExceptionAnalysisListener();
private UserModelingListener userModelingListener = new UserModelingListener();
private HardRuleFilterListener hardRuleFilterListener = new HardRuleFilterListener();
private AntiRubbishListener antiRubbishListener = new AntiRubbishListener();
View epoll_test.c
#include <stdio.h>
#include <unistd.h>
#include <sys/epoll.h>
#include <string.h>
int main() {
int epoll_fd = epoll_create1(0);
struct epoll_event event, events[5];
char read_buffer[11];
int running = 1, event_count, i;
@vamdt
vamdt / idea_bash.bat
Created May 8, 2018
idea terminal bash shell path
View idea_bash.bat
@echo off
SET bashbin="f:\tools\cmder\vendor\git-for-windows\bin"
SET currentpath=%cd%
REM replace \ to /
SET unixpath=%currentpath:\=/%
REM replace : to empty
SET unixpath=%unixpath::=%
REM add / at begnning
SET unixpath=/%unixpath%
@vamdt
vamdt / ForwardService.java
Last active Apr 20, 2018
SpringMVC forward request
View ForwardService.java
package com.vamdt.fox.fox.service;
import org.springframework.beans.factory.BeanFactoryUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.ModelAndView;
You can’t perform that action at this time.