Skip to content

Commit

Permalink
Merge pull request #4 from UNFDanmark/main
Browse files Browse the repository at this point in the history
[ADDED] more pages
  • Loading branch information
GDC-Teknisk committed Aug 24, 2024
2 parents 5f609fc + cdebbbf commit 183c825
Show file tree
Hide file tree
Showing 8 changed files with 195 additions and 10 deletions.
5 changes: 3 additions & 2 deletions wiki/Writerside/in.tree
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@

<toc-element topic="roles.md">
<toc-element topic="Empty-MD-Topic.md">
<toc-element topic="Github-repositories.md"/>
<toc-element topic="Setup-af-ny-windows-installation.md"/>
<toc-element topic="Windows-ISO.md"/>
<toc-element topic="Unity-project.md"/>
<toc-element topic="Git-setup.md"/>
<toc-element topic="Install-Script.md"/>
<toc-element topic="Bloker-webside-lokalt.md"/>
</toc-element>
</toc-element>
Expand Down
56 changes: 55 additions & 1 deletion wiki/Writerside/topics/Bloker-webside-lokalt.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,57 @@
# Bloker webside lokalt

Start typing here...
For at kunne køre powershell scripts på en windows computer skal det slås til ved at køre denne kommando med administrator rettigheder.

```Shell
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
```

Det følgende script har 5 dele:
1. Sti til hosts fil
2. Funktion der tilføjer domæner til hosts filen
3. Liste af domæner som skal blokkeres
4. Ip adresse som domæner skal omdirigeres til
5. Løkke som blokkerer domæner

```Shell
# Define the path to the hosts file
$hostsFilePath = "$env:SystemRoot\System32\drivers\etc\hosts"

# Function to add a domain to the hosts file
function Add-DomainToHostsFile {
param (
[string]$ipAddress,
[string]$domain
)

# Check if the entry already exists
$entry = "$ipAddress`t$domain"
$hostsFileContent = Get-Content -Path $hostsFilePath
if ($hostsFileContent -contains $entry) {
Write-Output "Entry '$entry' already exists in the hosts file."
} else {
# Add the new entry
try {
Add-Content -Path $hostsFilePath -Value $entry
Write-Output "Entry '$entry' has been added to the hosts file."
} catch {
Write-Error "Failed to add entry '$entry' to the hosts file. Error: $_"
}
}
}
# List of domains to block
$domainsToBlock = @(
"www.roblox.com",
"www.netflix.com"
)
# IP address to redirect the domains to (localhost)
$blockIpAddress = "127.0.0.1"
# Block each domain
foreach ($domain in $domainsToBlock) {
Add-DomainToHostsFile -ipAddress $blockIpAddress -domain $domain
}
```
{collapsible="true" collapsed-title="block-domains.ps1"}
3 changes: 0 additions & 3 deletions wiki/Writerside/topics/Git-setup.md

This file was deleted.

18 changes: 18 additions & 0 deletions wiki/Writerside/topics/Github-repositories.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Git repositories

Deltagernes repositories har følgende struktur, se evt [repositories](https://github.com/UNFDanmark) fra tidligere år


```Bash
GDC2024-GR1
├── 2D
│   └── Ting fra 2D
├── 3D
│   └── Ting fra 3D
├── Lyd
│   └── Ting fra lyd
├── README.md
└── TheUnityProject
├── .gitignore
└── Unity filer og mapper
```
3 changes: 0 additions & 3 deletions wiki/Writerside/topics/Install-Script.md

This file was deleted.

110 changes: 110 additions & 0 deletions wiki/Writerside/topics/Setup-af-ny-windows-installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Setup af ny windows installation

Dette dokument indeholder PowerShell-scripts til at opsætte en ny bruger, installere nødvendige programmer og konfigurere Git for GDC-deltagere.

## Oprettelse af ny bruger

Dette script opretter en ny standardbruger med navnet "Deltager" uden administratorrettigheder og uden kodeord.

```Bash
# Create new user account without admin privileges and no password
try {
$username = "Deltager"
New-LocalUser -Name $username -FullName "Deltager" -Description "Standard user for GDC"

# Add the new user to the 'Users' group (standard user, not admin)
Add-LocalGroupMember -Group "Brugere" -Member $username

Write-Host "User $username created and configured successfully."
} catch {
Write-Host "Error creating user: $_"
}
```
{collapsible="true" collapsed-title="create-limited-user.ps1"}

## Installér nødvendige programmer

Dette script installerer de programmer, der er nødvendige for GDC ved brug af winget.

```Bash
# Function to install applications
function Install-App($appName, $appSource) {
try {
$listApp = winget list --exact -q $appName
if (![String]::Join("", $listApp).Contains($appName)) {
Write-Host "Installing: $appName"
if ($appSource -ne $null) {
winget install --exact --silent $appName --source $appSource --accept-package-agreements
} else {
winget install --exact --silent $appName --accept-package-agreements
}
} else {
Write-Host "Skipping Install of $appName"
}
} catch {
Write-Host "Error installing $appName: $_"
}
}

# List of apps to install
$apps = @(
@{name = "Unity.Unity.2022"},
@{name = "Unity.UnityHub"},
@{name = "JetBrains.Rider"},
@{name = "BlenderFoundation.Blender"},
@{name = "KDE.Krita"},
@{name = "Audacity.Audacity"},
@{name = "Git.Git"},
@{name = "GitHub.GitHubDesktop"},
@{name = "GitHub.cli"},
@{name = "BrunoBanelli.PCI-Z"},
@{name = "Google.Chrome"}
)

# Install new apps
foreach ($app in $apps) {
Install-App -appName $app.name -appSource $null
}
```
{collapsible="true" collapsed-title="install-apps.ps1"}
## Git Setup
Dette script opsætter Git for deltageren ved at klone nødvendige repositories og konfigurere Git-brugeren.
```Bash
# Define constants
$year = "2024"
$githubAccountName = "GDC-Teknisk"
$githubKey = "ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # Generate a new key each year

# Prompt for group number
Write-Host -NoNewline "Enter group number: "
$key_pressed = ([System.Management.Automation.Host.KeyInfo]$Host.UI.RawUI.ReadKey([System.Management.Automation.Host.ReadKeyOptions]::IncludeKeyDown)).Character;
Write-Host ""

# Clone repositories
try {
Set-Location C:\Users\GDC\Desktop
$git_repo = "https://github.com/UNFDanmark/GDC$year-GR" + $key_pressed
git clone $git_repo
git clone "https://github.com/UNFDanmark/GDC$year-TeachingProgramming"
Write-Host "Repositories cloned successfully"
} catch {
Write-Host "Error cloning repositories: $_"
}

# Configure git user
$mail = "teknisk+GDC$year-GR" + $key_pressed + "@game.unf.dk"
try {
git config --global user.email $mail
git config --global user.name "Deltager"
git credential-manager configure
git config --global url."https://$githubAccountName:$githubKey@github.com".insteadOf "https://github.com"
Write-Host "Git user configured successfully"
} catch {
Write-Host "Error configuring git: $_"
}

```
{collapsible="true" collapsed-title="setup-git.ps1"}
4 changes: 3 additions & 1 deletion wiki/Writerside/topics/Unity-project.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Unity project

Start typing here...
Start typing here...

Daniel help :(
6 changes: 6 additions & 0 deletions wiki/Writerside/topics/Windows-ISO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Windows ISO

Den windows ISO som bruges under opsætning af computere skal gerne have en _ExecutionPolicy_ som tillader at man kan køre powershell scripts.
derudover skal winget være installeret og initialiseret hvis muligt.

Dette vil gøre det meget nemmere at installere og opsætte programmerne

0 comments on commit 183c825

Please sign in to comment.