Skip to content

Instantly share code, notes, and snippets.

View mhwh-dev's full-sized avatar
💭
Science is the knowledge of the universe

Edgar AP mhwh-dev

💭
Science is the knowledge of the universe
View GitHub Profile
@mhwh-dev
mhwh-dev / scp-speed-test.sh
Created January 1, 2025 23:31 — forked from alecbedzir/scp-speed-test.sh
[speed test] Test ssh connection speed
#!/bin/bash
# scp-speed-test.sh
# Author: Alec Jacobson alecjacobsonATgmailDOTcom
# http://www.alecjacobson.com/weblog/?p=635
#
# Test ssh connection speed by uploading and then downloading a 10000kB test
# file (optionally user-specified size)
#
# Usage:
# ./scp-speed-test.sh user@hostname [test file size in kBs]
@mhwh-dev
mhwh-dev / stats.php
Created January 1, 2025 23:31 — forked from alecbedzir/stats.php
Create nice-looking charts showing CPU usage
<?php
/**
* Script for getting statistics information from server
* To view the content in json _GET parameter "show" should be specified
* To view the content in pretty format _GET parameter/value "show=pretty" should be specified
*/
/**
* Error reporting
*/
# Check gist comments to verify system PATH and or adapt it.
wget https://ftp.gnu.org/gnu/glibc/glibc-2.18.tar.gz
tar zxvf glibc-2.18.tar.gz
cd glibc-2.18
mkdir build
cd build
../configure --prefix=/opt/glibc-2.18
make -j4
sudo make install
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/glibc-2.18/lib
@mhwh-dev
mhwh-dev / Php8Tasks.php
Created April 18, 2024 13:25 — forked from Sentinel17/Php8Tasks.php
Домашнее задание №8
<!-- ДОМАШНЕЕ ЗАДАНИЕ
#необходимо написать класс по работе с датами со следующими методами
#-найти разницу дат, вернуть разницу в формате timestamp
#-формат timestamp преобразовать в количество дней (целое число)
#-вернуть нужный формат даты (формат задается свойством объекта) на входе дата в формате timestamp
#-вернуть словом день недели от заданной даты
#-вернуть словом месяц от заданной даты
#-определить является ли заданный год высокосным (вернуть true/false)
#-преобразовать любой заданный вариант даты в нужный формат, который задан в свойстве класса -->
@mhwh-dev
mhwh-dev / Auth.php
Created April 18, 2024 13:25 — forked from Sentinel17/Auth.php
Домашнее задание №10
<?php
include 'Database.php';
class Auth {
protected $pdo;
public function __construct(){
$db = new Database();
$db->baseConfig();
$this->pdo = $db->pdo;
}
public function login($login, $password){
@mhwh-dev
mhwh-dev / FormController.php
Created April 18, 2024 13:24 — forked from Sentinel17/FormController.php
Laravel ДЗ №1
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class FormController extends Controller
{
public function formUser(Request $request)
{
<?php
namespace App\Models;
use Illuminate\Support\Facades\DB;
class ModelBaseFunction {
private $table_name = 'users';
public function getAllUsers(){
@mhwh-dev
mhwh-dev / Database.php
Created April 18, 2024 13:23 — forked from Sentinel17/Database.php
Домашнее задание №11
<?php
class Database{
public $isConn;
protected $data;
public function __construct($username = "root", $password = "", $host = "127.0.0.1", $dbname = "test", $options = []){
$this->isConn = TRUE;
$this->data = new PDO("mysql:host=$host;dbname=$dbname;charset=utf8", $username, $password, $options);
$this->data->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->data->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
@mhwh-dev
mhwh-dev / nginxproxy.md
Created February 3, 2024 15:25 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@mhwh-dev
mhwh-dev / show-php-version.php
Created October 14, 2023 02:49 — forked from Zodiac1978/show-php-version.php
Show PHP version and if PHP is running in 32-bit or 64-bit mode in At-a-glance dashboard widget
<?php
/*
Plugin Name: Show PHP Version
Description: Shows the current PHP version in the "At a Glance" admin dashboard widget.
Version: 1.1
Requires at least: 3.8
Author: Torsten Landsiedel
Author URI: http://torstenlandsiedel.de
*/