This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### linux | |
# find biggest top 10 files or folders in current dir | |
du -a -h | sort -n -r | head -n 10 | |
# find runing process | |
# example args: | |
# process_name: nginx | |
ps -ax | grep {{process_name}} | |
### docker |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function permuate(seq) { | |
if (seq.length === 0) return [[]]; | |
const solutions = []; | |
for(let i = 0; i < seq.length; ++i){ | |
const subSolutions = permuate(seq.filter((num, j) => j !== i)); | |
subSolutions.forEach(solution => solutions.push([seq[i]].concat(solution))); | |
} | |
return solutions; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function bubbleSort(nums){ | |
if (!nums) return; | |
for(let i = 0;i < nums.length; ++i){ | |
for(let j = 0;j < nums.length-1; ++j) { | |
if (nums[j] > nums[j+1]) { | |
let tmp = nums[j]; | |
nums[j] = nums[j+1]; | |
nums[j+1] = tmp; | |
} |
NewerOlder