Skip to content

Commit c557901

Browse files
Timna BrownTimna Brown
authored andcommitted
Update Cloud2BR organization references
1 parent 4b6f569 commit c557901

File tree

225 files changed

+485
-577
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

225 files changed

+485
-577
lines changed
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
const REPO = process.env.REPO;
5+
const GITHUB_TOKEN = process.env.TRAFFIC_TOKEN;
6+
const METRICS_FILE = 'metrics.json';
7+
8+
if (!GITHUB_TOKEN || !REPO) {
9+
console.error('Error: TRAFFIC_TOKEN and REPO environment variables must be set.');
10+
process.exit(1);
11+
}
12+
13+
if (typeof fetch !== 'function') {
14+
console.error('Error: global fetch is not available. Use Node.js 20 or later.');
15+
process.exit(1);
16+
}
17+
18+
async function getLast14DaysTraffic() {
19+
const response = await fetch(`https://api.github.com/repos/${REPO}/traffic/views`, {
20+
headers: {
21+
Accept: 'application/vnd.github+json',
22+
Authorization: `Bearer ${GITHUB_TOKEN}`,
23+
'User-Agent': 'visitor-counter'
24+
}
25+
});
26+
27+
if (!response.ok) {
28+
const errorText = await response.text();
29+
throw new Error(
30+
`Failed to fetch traffic data: ${response.status} ${response.statusText}\n${errorText}`
31+
);
32+
}
33+
34+
const data = await response.json();
35+
return data.views.map((item) => ({
36+
date: item.timestamp.slice(0, 10),
37+
count: item.count,
38+
uniques: item.uniques
39+
}));
40+
}
41+
42+
function readMetrics() {
43+
if (!fs.existsSync(METRICS_FILE)) {
44+
return [];
45+
}
46+
47+
try {
48+
const raw = fs.readFileSync(METRICS_FILE, 'utf-8');
49+
const parsed = JSON.parse(raw);
50+
return Array.isArray(parsed) ? parsed : [];
51+
} catch {
52+
console.error('metrics.json is not valid JSON. Starting fresh.');
53+
return [];
54+
}
55+
}
56+
57+
function writeMetrics(metrics) {
58+
fs.writeFileSync(METRICS_FILE, JSON.stringify(metrics, null, 2));
59+
console.log(`metrics.json updated with ${metrics.length} days`);
60+
}
61+
62+
function mergeMetrics(existing, fetched) {
63+
const byDate = new Map();
64+
65+
for (const entry of existing) {
66+
byDate.set(entry.date, entry);
67+
}
68+
69+
for (const entry of fetched) {
70+
byDate.set(entry.date, entry);
71+
}
72+
73+
return [...byDate.values()].sort((left, right) => left.date.localeCompare(right.date));
74+
}
75+
76+
function calculateTotalViews(metrics) {
77+
return metrics.reduce((sum, entry) => sum + entry.count, 0);
78+
}
79+
80+
function findMarkdownFiles(dir) {
81+
let results = [];
82+
const entries = fs.readdirSync(dir, { withFileTypes: true });
83+
84+
for (const entry of entries) {
85+
const fullPath = path.join(dir, entry.name);
86+
if (entry.isDirectory()) {
87+
results = results.concat(findMarkdownFiles(fullPath));
88+
continue;
89+
}
90+
91+
if (entry.isFile() && entry.name.endsWith('.md')) {
92+
results.push(fullPath);
93+
}
94+
}
95+
96+
return results;
97+
}
98+
99+
function updateMarkdownBadges(totalViews) {
100+
const refreshDate = new Date().toISOString().split('T')[0];
101+
const badgeRegex = /<!-- START BADGE -->[\s\S]*?<!-- END BADGE -->/g;
102+
const badgeBlock = `<!-- START BADGE -->
103+
<div align="center">
104+
<img src="https://img.shields.io/badge/Total%20views-${totalViews}-limegreen" alt="Total views">
105+
<p>Refresh Date: ${refreshDate}</p>
106+
</div>
107+
<!-- END BADGE -->`;
108+
109+
for (const file of findMarkdownFiles('.')) {
110+
const content = fs.readFileSync(file, 'utf-8');
111+
if (!badgeRegex.test(content)) {
112+
continue;
113+
}
114+
115+
const updated = content.replace(badgeRegex, badgeBlock);
116+
fs.writeFileSync(file, updated);
117+
console.log(`Updated badge in ${file}`);
118+
}
119+
}
120+
121+
(async () => {
122+
try {
123+
const fetched = await getLast14DaysTraffic();
124+
const existing = readMetrics();
125+
const merged = mergeMetrics(existing, fetched);
126+
writeMetrics(merged);
127+
128+
const totalViews = calculateTotalViews(merged);
129+
updateMarkdownBadges(totalViews);
130+
} catch (error) {
131+
console.error(error);
132+
process.exit(1);
133+
}
134+
})();

.github/workflows/use-visitor-counter.yml

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,36 +22,17 @@ jobs:
2222
with:
2323
fetch-depth: 0
2424

25-
- name: Shallow clone visitor counter logic
26-
run: git clone --depth=1 https://github.com/brown9804/github-visitor-counter.git
27-
2825
- name: Set up Node.js
2926
uses: actions/setup-node@v4
3027
with:
3128
node-version: '20'
3229

33-
- name: Install dependencies for github-visitor-counter
34-
run: |
35-
cd github-visitor-counter
36-
npm ci
37-
3830
- name: Run visitor counter logic (updates markdown badges and metrics.json)
39-
run: node github-visitor-counter/update_repo_views_counter.js
31+
run: node .github/scripts/update_repo_views_counter.js
4032
env:
4133
TRAFFIC_TOKEN: ${{ secrets.TRAFFIC_TOKEN }}
4234
REPO: ${{ github.repository }}
4335

44-
- name: Move generated metrics.json to root
45-
run: mv github-visitor-counter/metrics.json .
46-
47-
- name: List files for debugging
48-
run: |
49-
ls -l
50-
ls -l github-visitor-counter
51-
52-
- name: Clean up visitor counter logic
53-
run: rm -rf github-visitor-counter
54-
5536
- name: Configure Git author
5637
run: |
5738
git config --global user.name "github-actions[bot]"

0_Azure/0_AzureFundamentals/README.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ Costa Rica
44

55
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
66
[![GitHub](https://badgen.net/badge/icon/github?icon=github&label)](https://github.com)
7-
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
8-
[brown9804](https://github.com/brown9804)
7+
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/) [Cloud2BR OSS - Learning Hub](https://github.com/Cloud2BR-MSFTLearningHub)
98

109
Last updated: 2026-01-29
1110

@@ -21,40 +20,40 @@ Last updated: 2026-01-29
2120

2221
## Types of Cloud Services
2322

24-
![Alt text](https://github.com/brown9804/MSCloudEssentials_LPath/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_types_of_cloud_services.png)
23+
![Alt text](https://github.com/Cloud2BR-MSFTLearningHub/DemosScenarios-TechTalks/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_types_of_cloud_services.png)
2524

2625
## Azure CLoud Models
2726

28-
![Alt text](https://github.com/brown9804/MSCloudEssentials_LPath/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_cloud_models.png)
27+
![Alt text](https://github.com/Cloud2BR-MSFTLearningHub/DemosScenarios-TechTalks/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_cloud_models.png)
2928

3029
## Azure Security Rules
3130

32-
![Alt text](https://github.com/brown9804/MSCloudEssentials_LPath/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_security_rules.png)
31+
![Alt text](https://github.com/Cloud2BR-MSFTLearningHub/DemosScenarios-TechTalks/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_security_rules.png)
3332

3433
## Azure Security Network
3534

36-
![Alt text](https://github.com/brown9804/MSCloudEssentials_LPath/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_security_network.png)
35+
![Alt text](https://github.com/Cloud2BR-MSFTLearningHub/DemosScenarios-TechTalks/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_security_network.png)
3736

3837
## Azure DDoS Protection
3938

40-
![Alt text](https://github.com/brown9804/MSCloudEssentials_LPath/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_network_DDos.png)
39+
![Alt text](https://github.com/Cloud2BR-MSFTLearningHub/DemosScenarios-TechTalks/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_network_DDos.png)
4140

4241
## Azure Firewall Rules
4342

44-
![Alt text](https://github.com/brown9804/MSCloudEssentials_LPath/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_firewall_rules.png)
43+
![Alt text](https://github.com/Cloud2BR-MSFTLearningHub/DemosScenarios-TechTalks/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_firewall_rules.png)
4544

46-
![Alt text](https://github.com/brown9804/MSCloudEssentials_LPath/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_firewall_rules_2.png)
45+
![Alt text](https://github.com/Cloud2BR-MSFTLearningHub/DemosScenarios-TechTalks/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_firewall_rules_2.png)
4746

4847
## Azure Security Features Identity
4948

5049
### 1. Authentication & Authorization
51-
![Alt text](https://github.com/brown9804/MSCloudEssentials_LPath/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_security_features_Identity_AuthenticationAuthorization.png)
50+
![Alt text](https://github.com/Cloud2BR-MSFTLearningHub/DemosScenarios-TechTalks/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_security_features_Identity_AuthenticationAuthorization.png)
5251

5352
### 2. Active Directory
54-
![Alt text](https://github.com/brown9804/MSCloudEssentials_LPath/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_security_features_AzureActiveDirectory.png)
53+
![Alt text](https://github.com/Cloud2BR-MSFTLearningHub/DemosScenarios-TechTalks/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_security_features_AzureActiveDirectory.png)
5554

5655
### 3. MFA
57-
![Alt text](https://github.com/brown9804/MSCloudEssentials_LPath/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_security_features-identity-MFA.png)
56+
![Alt text](https://github.com/Cloud2BR-MSFTLearningHub/DemosScenarios-TechTalks/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_security_features-identity-MFA.png)
5857

5958
<!-- START BADGE -->
6059
<div align="center">

0_Azure/1_AzureData/0_DataStorage/0_azure_blob_to_snowflake_connection.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
Costa Rica
44

5-
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
6-
[brown9804](https://github.com/brown9804)
5+
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/) [Cloud2BR OSS - Learning Hub](https://github.com/Cloud2BR-MSFTLearningHub)
76

87
Last updated: 2026-01-29
98

0_Azure/1_AzureData/0_DataStorage/1_mvSharePoint_toAzStorage.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
Costa Rica
44

55
[![GitHub](https://badgen.net/badge/icon/github?icon=github&label)](https://github.com)
6-
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
7-
[brown9804](https://github.com/brown9804)
6+
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/) [Cloud2BR OSS - Learning Hub](https://github.com/Cloud2BR-MSFTLearningHub)
87

98
Last updated: 2026-01-29
109

0_Azure/1_AzureData/0_DataStorage/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
Costa Rica
44

5-
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
6-
[brown9804](https://github.com/brown9804)
5+
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/) [Cloud2BR OSS - Learning Hub](https://github.com/Cloud2BR-MSFTLearningHub)
76

87
Last updated: 2026-01-29
98

0_Azure/1_AzureData/1_Databases/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
Costa Rica
44

5-
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
6-
[brown9804](https://github.com/brown9804)
5+
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/) [Cloud2BR OSS - Learning Hub](https://github.com/Cloud2BR-MSFTLearningHub)
76

87
Last updated: 2026-01-29
98

@@ -12,7 +11,7 @@ Last updated: 2026-01-29
1211
> These functionalities include the ability to query data, manage relationships between different data items, enforce data integrity rules, and perform transactions. These products are typically used when you need to work with structured or unstructured data, and need more advanced features compared to basic data storage products.
1312
1413
<div align="center">
15-
<img src="https://github.com/brown9804/MSCloudEssentials_LPath/assets/24630902/697f7265-647a-41e2-a2f5-ec4b66cf3321" alt="Centered Image" style="border: 2px solid #4CAF50; border-radius: 5px; padding: 5px;"/>
14+
<img src="../../img/migrated-assets/azure-data-databases.png" alt="Centered Image" style="border: 2px solid #4CAF50; border-radius: 5px; padding: 5px;"/>
1615
</div>
1716

1817

0_Azure/1_AzureData/1_Databases/demos/0_mongodb-paas-to-azure-migration-guide.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
Costa Rica
44

55
[![GitHub](https://badgen.net/badge/icon/github?icon=github&label)](https://github.com)
6-
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
7-
[brown9804](https://github.com/brown9804)
6+
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/) [Cloud2BR OSS - Learning Hub](https://github.com/Cloud2BR-MSFTLearningHub)
87

98
Last updated: 2026-01-29
109

0_Azure/1_AzureData/1_Databases/demos/10_SQLonPremMigrationOptionsSharepoint.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
Costa Rica
44

5-
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
6-
[brown9804](https://github.com/brown9804)
5+
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/) [Cloud2BR OSS - Learning Hub](https://github.com/Cloud2BR-MSFTLearningHub)
76

87
Last updated: 2026-01-29
98

0_Azure/1_AzureData/1_Databases/demos/1_azureCosmosDBPartitionMerge.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
Costa Rica
44

55
[![GitHub](https://badgen.net/badge/icon/github?icon=github&label)](https://github.com)
6-
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
7-
[brown9804](https://github.com/brown9804)
6+
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/) [Cloud2BR OSS - Learning Hub](https://github.com/Cloud2BR-MSFTLearningHub)
87

98
Last updated: 2026-01-29
109

0 commit comments

Comments
 (0)