-
Notifications
You must be signed in to change notification settings - Fork 1
/
constants.ring
85 lines (82 loc) · 4.42 KB
/
constants.ring
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
Author: ysdragon (https://github.com/ysdragon)
*/
// PowerShell Script for Windows
PS_SCRIPT = "
$CPU_INFO = (Get-CimInstance -Query 'SELECT Name, NumberOfCores, NumberOfLogicalProcessors FROM Win32_Processor')
$CPU_USAGE = (Get-Counter '\Processor(_Total)\% Processor Time' -SampleInterval 1 -MaxSamples 1).CounterSamples.CookedValue
$CPU = @{
name = $CPU_INFO.Name
cores = $CPU_INFO.NumberOfCores
threads = $CPU_INFO.NumberOfLogicalProcessors
usage = [math]::round($CPU_USAGE, 2)
}
$GPU_INFO = (Get-CimInstance -Query 'SELECT Caption FROM Win32_VideoController')
$GPUs = @()
foreach ($GPU in $GPU_INFO) {
$GPUs += @{
name = $GPU.Caption
}
}
$OS = (Get-CimInstance -Query 'SELECT Caption, Version, FreePhysicalMemory FROM Win32_OperatingSystem')
$TOTAL_RAM = [math]::round((Get-CimInstance -Query 'SELECT Capacity FROM Win32_PhysicalMemory' | Measure-Object -Property Capacity -Sum).Sum / 1GB, 2)
$FREE_RAM = [math]::round($OS.FreePhysicalMemory / 1MB, 2)
$USED_RAM = [math]::round($TOTAL_RAM - $FREE_RAM, 2)
$RAM = @{
size = $TOTAL_RAM.ToString() + 'G'
used = $USED_RAM.ToString() + 'G'
free = $FREE_RAM.ToString() + 'G'
}
$DISKS_RAW = Get-CimInstance -Query 'SELECT Size, DeviceID, Model FROM Win32_DiskDrive'
$DISKS = @()
foreach ($DISK in $DISKS_RAW) {
$DISKS += @{
name = $DISK.Model
size = [math]::round($DISK.Size / 1GB, 2).ToString() + 'G'
}
}
$PARTS_RAW = (Get-CimInstance -Query 'SELECT Size, FreeSpace, Caption FROM Win32_LogicalDisk WHERE DriveType=3')
$PARTS = @()
foreach ($PART in $PARTS_RAW) {
$PARTS += @{
name = $PART.Caption
size = [math]::round($PART.Size / 1GB, 2).ToString() + 'G'
used = ([math]::round($PART.Size / 1GB, 2) - [math]::round($PART.FreeSpace / 1GB, 2)).ToString() + 'G'
free = [math]::round($PART.FreeSpace / 1GB, 2).ToString() + 'G'
}
}
$PCOUNT = (Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* | Measure-Object).Count
$SHELL = 'PowerShell ' + $PSVersionTable.PSVersion.ToString()
$Result = @{
cpu = $CPU
gpu = $GPUs
ram = $RAM
os = $OS.Caption
version = $OS.Version
disks = $DISKS
parts = $PARTS
pcount = $PCOUNT
shell = $SHELL
}
Write-Output (ConvertTo-Json $Result)
"
// Time units
tUnits = [
[86400, "day", :days],
[3600, "hour", :hours],
[60, "minute", :minutes],
[1, "second", :seconds]
]
// Linux Package Managers
pManagers = [
:dpkg = [:supported = ["debian", "ubuntu", "devuan", "rhino", "mint", "osmc", "antix", "pop", "popos", "elementary", "vanilla", "sparky", "kali", "kubuntu", "deepin", "tails", "voyager", "damnsmall", "q4os", "lubuntu", "parrot", "endless", "wattos", "watt", "qubes", "qubesos", "xubuntu", "bodhi", "gnoppix", "relianoid", "av", "avlinux", "pure", "pureos", "bros", "br", "spiral", "syslinux", "syslinuxos", "mate", "ubuntumate", "neptune", "lxle", "makulu", "emmabuntüs", "bunsenLabs", "kodachi", "nitrux"], :cmd = "dpkg-query -f '${binary:Package}\n' -W | wc -l", :name = "dpkg"],
:dnf = [:supported = ["fedora", "centos", "almalinux", "rockylinux", "mageia", "openmandriva", "ultramarine", "redhat", "oracle"], :cmd = "dnf list installed | wc -l", :name = "rpm"],
:zypper = [:supported = ["opensuse", "opensuse-tumbleweed", "opensuse-leap", "regata"], :cmd = "zypper se --installed-only | wc -l", :name = "zypper"],
:pacman = [:supported = ["arch", "archarm", "artix", "endeavouros", "endeavour", "manjaro", "cachyos", "cachy", "garuda", "arco", "arcolinux", "archcraft", "bluestar", "sdesk", "biglinux", "big", "reborn", "rebornos", "blendos", "blend", "mabox", "athena"], :cmd = "pacman -Q | wc -l", :name = "pacman"],
:emerge = [:supported = ["gentoo", "fentoo", "calculate"], :cmd = "qlist -I | wc -l", :name = "emerge"],
:pkg = [:supported = ["freebsd", "openbsd", "ghostbsd", "netbsd"], :cmd = "pkg info | wc -l | tr -d ' '", :name = "pkg"],
:xbps = [:supported = ["void", "gabee", "gabeeos", "agarim", "agarimos"], :cmd = "xbps-query -l | wc -l", :name = "xbps"],
:nix_env = [:supported = ["nix"], :cmd = "nix-store -q --requisites /run/current-system/sw | wc -l", :name = "nix_env"],
:apk = [:supported = ["alpine", "chimera"], :cmd = "apk list --installed | wc -l", :name = "apk"],
:slackpkg = [:supported = ["slackware", "porteus", "porteux", "absolute"], :cmd = "ls /var/log/packages | wc -l", :name = "slackpkg"]
]