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 / cross-compile-ldd
Created June 3, 2021 09:27 — forked from jerome-pouiller/cross-compile-ldd
ldd drop-in replacement for cross-compilation toolchains.
#!/bin/bash
# ldd drop-in replacement for cross-compilation toolchains.
# This file is a slightly modified version of xldd.in from
# crosstool-ng 1.22.0
# In order to use it, copy it in same directory than other
# toolchain binaries and rename it with same tuple.
# (i.e. /opt/arm-sysmic-linux-gnueabihf/bin/arm-sysmic-linux-gnueabihf-ldd)
@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>
@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 / 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 / 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 / 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 / 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 / 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 / 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 / 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"