Joe Huss

All generations.

metaThu, 19 Jan 2023

a site about emulators and gaming platforms

<meta name="keywords" content="emulator, emulators, game, games, console, consoles, gaming, nintendo, genesis, sega, nes, snes, nintendo64, n64, ps1, playstation, playstation1, ps2, playstation2, ps3, playstation3, gameboy, gameboycolor, gameboy advance, gba, nintendo ds, ds, nintendo dsi, dsi, nintendo 3ds, 3ds, gamecube, gc, wii, wiiu, virtual boy">

generate a bootstrap4 page for showing ipmi sensor data

<div class="container-fluid"> <div class="row"> <div class="col-sm-12"> <h1>ipmi sensors</h1> </div> </div> <div class="row"> <div class="col-sm-12"> <table class="table table-bordered table-hover"> <thead> <tr> <th>name</th> <th>desc</th> <th>state</th> <th>reading</th> <th>unit</th> </tr> </thead> <tbody> <tr> <td>FAN1</td> <td>FAN1</td> <td>OK</td> <td>0</td> <td>RPM</td> </tr> <tr> <td>FAN2</td> <td>FAN2</td>

generate a bootstrap4 page for showing ipmi sensor data with graphs

<body> <div class="container" id="main"> <div class="row"> <div class="col-md-6"> <div class="card"> <h3 class="card-header">Fan Speed (RPM)</h3> <div class="card-body"> <div id="yspeed"> <p> <img src="assets/yspeed.svg" /> </p> <p> <a href="https://github.com/jamesmunns/sensor-graphs">https://github.com/jamesmunns/sensor-graphs</a></p> </div> </div> </div> </div> <div class="col-md-6"> <div class="card"> <h3 class="card-header">CPU Temperature (

generate a page for showing ipmi sensor data with graphs

<html> <head> <title>Show ipmi sensors</title> <link rel="stylesheet" href="http://getbootstrap.com/dist/css/bootstrap.min.css"> <link rel="stylesheet" href="http://getbootstrap.com/assets/css/docs.min.css"> <link rel="stylesheet" href="../static/css/bootstrap-theme.min.css"> <link rel="stylesheet" href="../static/css/bootstrap.min.css"> <link rel="stylesheet" href="../static/css/bootstrap-datetimepicker.min.css"> <link rel="stylesheet" href="../static/css/bootstrap-datetimepicker-standalone.css"> <link rel="stylesheet" href="../static/css/bootstrap-datetimepicker.min.css"> </head> <body> <div class="container" id="main">hello world</div> <div id="graph

metaThu, 19 Jan 2023

a site for clients to manage their reliable and low-cost services with us including websites, vpss, dedicated servers, domain registrations, backups, and email services in our datacenter

<meta name="keywords" content="website, websites, website hosting, website design, website development, web designing, web development, web design, web hosting, web site hosting, web host, web hosting company, web hosting provider, web hosting service, web page hosting, web site hosting, web host, web hosting services, web hosting provider, web hosting provider, web hosting service, web hosting service provider, web site hosting service, web hosting companies, web hosting solutions, web hosting reviews, web hosting business, web hosting providers, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions, web hosting solutions

class from descriptionThu, 19 Jan 2023

create an ssh class for multiplexing ssh connections and running commands on them in a queue.

<?php class SSH { private $conn; private $host; private $port; private $username; private $password; private $commands; public function __construct($host, $port, $username, $password) { $this->conn = ssh2_connect($host, $port); $this->host = $host; $this->port = $port; $this->username = $username; $this->password = $password; $this->commands = []; } public function addCommand($command) { $this->commands[] = $command; } public function execute() { array_unshift($this->commands, 'export TERM=xterm;'); $command = implode('', $this->commands); return ssh2_exec($this->conn, $command); } } $ssh = new SSH('192.168.1.1', 22, 'root', 'password');

PHP
View
class from descriptionThu, 19 Jan 2023

create an ssh class for maintaining a pool of ssh connections and running commands on them in parallel via a queue

class ssh { private $pool = array(); private $queue = array(); public function add($host, $user, $pass) { $ssh = new Net_SSH2($host); if (!$ssh->login($user, $pass)) { exit('Login Failed'); } $this->pool[] = $ssh; } public function exec($cmd) { $this->queue[] = $cmd; } public function run() { $pool = $this->pool; $queue = $this->queue; while (count($pool) && count($queue)) { foreach ($pool as $key => $ssh) { $cmd = array_shift($queue); $ssh->exec($cmd); unset($pool[$key]); } } } } $ssh = new ssh; $ssh->add('1.1.1.1', 'user', 'pass'); $ssh

PHP
View
code to explanationFri, 20 Jan 2023

if [ -e /proc/vz/fairsched/cpu.proc.stat ]; then grep -H "^cpu" /proc/vz/fairsched/*/cpu.proc.stat | tr / " " | tr : " " | awk '{ print $4 " " $6 " " $7 " " $8 " " $9 " " $10 " " $11 " " $12 " " $13 " " $14 }'; else grep "^cpu" /proc/stat | awk '{ print 0 " " $1 " " $2 " " $3 " " $4 " " $5 " " $6 " " $7 " " $8 " " $9 }'; fi

The code check if there is any container running in the host. If there is a container running, the code will take the information from the container (inside /proc/vz/fairsched/cpu.proc.stat) to print the cpu usage. Otherwise, the code will get the cpu usage directly from the host (inside /proc/stat).

Questions about programming?Chat with your personal AI assistant