Skip to content

Instantly share code, notes, and snippets.

View DanielChuDC's full-sized avatar
🎯
Focusing

danielchu DanielChuDC

🎯
Focusing
  • singapore
View GitHub Profile
@DanielChuDC
DanielChuDC / systool-report.sh
Last active April 7, 2024 16:40
This Bash script is designed to search for specific system tools ("scp", "ssh") within specified directories and generate a report containing the file paths and line numbers where these tools are found.
#!/bin/bash
target_dirs="/opt"
target_tools=(
"scp"
"ssh"
)
target_output="report.txt"
# Array to track scanned directories
#!/bin/bash
target_dirs="/opt/"
target_tools=(
"scp"
"ssh"
)
function print_report() {
local input="$1"
#!/bin/bash
# Used an array (target_tools) to store system tools.
# Used find command to iterate over directory contents safely, with the -mindepth 1 option to avoid processing the directory itself.
# Properly quoted variables to prevent word splitting and globbing issues.
# Added -d '' option to read command to handle filenames with spaces correctly.
# Ensured find command only searches one level deep in directories.
@DanielChuDC
DanielChuDC / check_content.sh
Created April 7, 2024 13:44
write a bash script that will print a report for 1. list the input director content(could be contain multiple children folders) 1.a. if the input is a directory, recursive do 1. 1.b. if the input is a file, check the content
#!/bin/bash
target_dirs="/opt/"
target_tools="
scp
ssh
"
function print_report() {
local input="$1"

Generate Jar with dependencies (fatJar) using Gradle

There are multiple posts (old and new) with instructions on how to generate a fat jar, this is, a jar file for your application containing also your application's dependencies. Most solutions I have tried did not work for me, even in a simple Hello World java application, but I have found one that seems to work as expected.

Here it is:

Instructions

@DanielChuDC
DanielChuDC / example.v
Created March 8, 2023 13:34
LSFR Verilog Implementation example
module lfsr(
input clk,
input rst,
output reg [3:0] rand_out,
output reg [3:0] LED
);
reg [3:0] lfsr_reg;
always @(posedge clk or posedge rst) begin
@DanielChuDC
DanielChuDC / Doxyfile
Created January 29, 2023 15:01
version 1.9.6 Doxyfile for generating UML class diagram
# Doxyfile 1.9.6
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
#
# All text after a double hash (##) is considered a comment and is placed in
# front of the TAG it is preceding.
#
# All text after a single hash (#) is considered a comment and will be ignored.
# The format is:
@DanielChuDC
DanielChuDC / README.md
Created January 4, 2023 08:46 — forked from hungvietdo/README.md
VI7: Node-link diagram and Adjacency matrix

Node-link Diagram

I added a new attribute to the dataset which is region.

In the node-link diagram, states in the same region likely stick together as they have links in between.

States in region which has less number of links spread out in the diagram. For example: look at the light-green color (South Atlantic), Florida is far apart with those states (DC, Maryland, Virginia, West Viginia, Delaware).

Thus, although the dataset is non-spatial, users can explore the relationship of nodes by looking the distance or number of hops in between.

@DanielChuDC
DanielChuDC / setupEnv.sh
Created December 27, 2022 14:18 — forked from dccampbell/setupEnv.sh
Linux Environment - Initial Setup Script
#!/usr/bin/env bash
echo "=== System Install Starting! ==="
# Variables
DL_DIR="$HOME/Downloads/EnvSetup" && mkdir -p "$DL_DIR"
BIN_DIR="$HOME/bin" && mkdir -p "$BIN_DIR"
source /etc/os-release #loads $UBUNTU_CODENAME
export DEBIAN_FRONTEND=noninteractive
No Aspects Go Rust
1. Popularity and mature open source production ready packages 5 3
2. Support for cloud-native features and services: 5 3
3. Developer experience 4 4
4. Performance and efficiency 3 4
5. Cross-platform compatibility 4 4
6. Integration with c/c++ 4 5
7. Security 4 5