Skip to content

Instantly share code, notes, and snippets.

View mnikn's full-sized avatar
🕳️
Strike the earth

mnikn mnikn

🕳️
Strike the earth
  • earth
View GitHub Profile
@mnikn
mnikn / bash.sh
Last active July 29, 2019 01:46
[bash] linux bash common commands #linux
### 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
@mnikn
mnikn / permutation.js
Last active June 19, 2019 09:42
[permutation] permutation and combination algorithm #algorithm
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;
}
@mnikn
mnikn / sort.js
Last active February 25, 2019 08:37
[sort] sort algorithms #algorithm
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;
}
@mnikn
mnikn / cookie.js
Last active February 27, 2019 01:40
[cookie] web cookie utils #utils