Skip to content

Instantly share code, notes, and snippets.

View duruyao's full-sized avatar
🏢
Coding in office

Ryan Du duruyao

🏢
Coding in office
View GitHub Profile
@duruyao
duruyao / restore_gitlab.sh
Last active May 17, 2024 02:35
Automatically restore for Omnibus Gitlab installations from backups periodically.
#!/usr/bin/env bash
## date: 2024-02-29
## author: duruyao@vimicro.com
## desc: restore for 'omnibus' gitlab installations from backups
set -euo pipefail
current_date() {
date +"%Y-%m-%d"
@duruyao
duruyao / backup_gitlab.sh
Last active May 17, 2024 02:36
Automatically backup Omnibus GitLab packages to local and remote periodically.
#!/usr/bin/env bash
## date: 2024-02-29
## author: duruyao@vimicro.com
## desc: backup 'omnibus' gitlab packages to local and remote
set -euo pipefail
current_date() {
date +"%Y-%m-%d"
@duruyao
duruyao / items_of_array.sh
Last active September 5, 2022 07:04
Compare ${array[*]} with ${array[@]} in bash script.
#!/usr/bin/env bash
## date: 2021-11-18
## author: duruyao@gmail.com
## desc: compare "${array[@]}" with "${array[*]}"
basket=( apple banana ornage pear )
for it in ${basket[@]}; do
echo "${it}"
@duruyao
duruyao / BST.cpp
Last active October 7, 2021 08:12
Binary search tree implemented by C++.
/*
* @author duruyao
* @file BST.cpp
* @desc
* @date 2021-10-07
* @version 1.0
*/
#include <vector>
#include <iostream>
@duruyao
duruyao / binary_search.cpp
Created October 7, 2021 03:20
Binary search implemented by C++.
/*
* @author duruyao
* @file binary_search.cpp
* @desc
* @date 2021-10-07
* @version 1.0
*/
#include <vector>
#include <iostream>
@duruyao
duruyao / top_k_by_BFPRT.cpp
Last active October 7, 2021 03:18
Selecting Top-K elements algorithm implemented by C++.
/*
* @author duruyao
* @file top_k_by_BFPRT.cpp
* @desc
* @date 2021-10-02
* @version 1.0
*/
#include <vector>
#include <iostream>
@duruyao
duruyao / merge_sort.cpp
Last active October 7, 2021 03:17
Merge sorting algorithm implemented by C++.
/*
* @author duruyao
* @file merge_sort.cpp
* @desc
* @date 2021-10-02
* @version 1.0
*/
#include <vector>
#include <iostream>
@duruyao
duruyao / heap_sort.cpp
Last active October 7, 2021 03:16
Heap sorting algorithm implemented by C++.
/*
* @author duruyao
* @file heap_sort.cpp
* @desc
* @date 2021-10-02
* @version 1.0
*/
#include <vector>
#include <iostream>
@duruyao
duruyao / insertion_sort.cpp
Last active October 7, 2021 03:15
Insert sorting algorithm implemented by C++ and Go.
/*
* @author duruyao
* @file insertion_sort.cpp
* @desc
* @date 2021-10-02
* @version 1.0
*/
#include <vector>
#include <iostream>
@duruyao
duruyao / quick_sort.cpp
Last active October 7, 2021 03:15
Quick sorting algorithm implemented by C++ and Go.
/*
* @author duruyao
* @file quick_sort.cpp
* @desc
* @date 2021-10-02
* @version 1.0
*/
#include <vector>
#include <iostream>