Skip to content

Instantly share code, notes, and snippets.

@nilsoberg2
nilsoberg2 / container.php
Created February 8, 2023 21:56 — forked from tlikai/container.php
PHP Dependency Injection Container
<?php
class Container
{
protected $setings = array();
public function set($abstract, $concrete = null)
{
if ($concrete === null) {
$concrete = $abstract;
@nilsoberg2
nilsoberg2 / sysinfo.pl
Last active October 4, 2019 16:52 — forked from aras-p/sysinfo.pl
Perl get hardware/OS data without non-standard modules
# CPU freq is unreliable on some CPU ('Intel(R) Xeon(R) CPU E5-2690 v3 @ 2.60GHz') since the CPU frequency is adaptive to system load.
my $spec = Util::System::getSystemSpec();
print "OS: '$spec->{os}'\n";
print "CPU: '$spec->{cpu_name}'\n";
print "CPU count: $spec->{num_cpu}\n";
print "CPU freq: $spec->{cpu_freq} GHz\n";