Skip to content

Commit

Permalink
Exclude empty data from memory
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeySlice committed Sep 15, 2023
1 parent 0e0b984 commit 283c343
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion About This Hack.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@
115D920626D6F65500F5DF35 /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
LastSwiftUpdateCheck = 1250;
LastUpgradeCheck = 1430;
TargetAttributes = {
Expand Down Expand Up @@ -330,6 +329,7 @@
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = "$(MODULE_VERSION)";
MODULE_VERSION = 1.0.2;
PRODUCT_BUNDLE_IDENTIFIER = "com.8itcat.About-This-Hack";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -357,6 +357,7 @@
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = "$(MODULE_VERSION)";
MODULE_VERSION = 1.0.2;
PRODUCT_BUNDLE_IDENTIFIER = "com.8itcat.About-This-Hack";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand Down
6 changes: 3 additions & 3 deletions About This Hack/HardwareCollector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,11 @@ echo "$(cat ~/.ath/scrXml.txt | grep -A2 "</data>" | awk -F'>|<' '/_name/{getlin

static func getRam() -> String {
let ram = run("echo \"$(($(sysctl -n hw.memsize) / 1024 / 1024 / 1024))\" | tr -d '\n'")
let ramMan = run("cat ~/.ath/sysmem.txt | grep 'Manufacturer' | awk '{print $2}' | sed -n '1p'").trimmingCharacters(in: .whitespacesAndNewlines)
let ramMan = run("cat ~/.ath/sysmem.txt | grep 'Manufacturer' | grep -v Empty | awk '{print $2}' | sed -n '1p'").trimmingCharacters(in: .whitespacesAndNewlines)
print("RAM Man: " + ramMan)
let ramType = run("cat ~/.ath/sysmem.txt | grep 'Type' | awk '{print $2}' | sed -n '1p'").trimmingCharacters(in: .whitespacesAndNewlines)
let ramType = run("cat ~/.ath/sysmem.txt | grep 'Type' | grep -v Empty | awk '{print $2}' | sed -n '1p'").trimmingCharacters(in: .whitespacesAndNewlines)
print("RAM Type: " + ramType)
let ramSpeed = run("cat ~/.ath/sysmem.txt | grep 'Speed' | grep 'MHz' | awk '{print $2\" \"$3}' | sed -n '1p'").trimmingCharacters(in: .whitespacesAndNewlines)
let ramSpeed = run("cat ~/.ath/sysmem.txt | grep 'Speed' | grep -v Empty | grep 'MHz' | awk '{print $2\" \"$3}' | sed -n '1p'").trimmingCharacters(in: .whitespacesAndNewlines)
print("RAM Speed: " + ramSpeed)

let ramReturn = "\(ram)GB \(ramSpeed) \(ramType) \(ramMan)"
Expand Down

0 comments on commit 283c343

Please sign in to comment.