Skip to content

Instantly share code, notes, and snippets.

@Dergonic
Dergonic / index.php
Last active March 16, 2018 14:09
Remake of the famous Raspberry Pi Sysinfo Script
<?php
// Original by PROXIMO https://gist.github.com/PROX1MO
// Modified by DERGONIC https://gist.github.com/Dergonic
// Changelog :
// Changes relating modification of "ifconfig" structure
// Split -> explode or preg_split (PHP7 compliant)
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 26 May 1983 13:00:00 GMT");
header("Pragma: no-cache");
@Dergonic
Dergonic / LogUptime.sh
Last active April 26, 2016 09:24
Log my server uptime
#!/usr/bin/env bash
mysqllogin=#Mysql_Login
mysqlpassword=#Mysql_Pass
mysqldb=#Mysql_Server
uptime=`cat /proc/uptime | sed "s/ /%/" |cut -d'%' -f1`
sql="INSERT INTO uptime (id,date,value) VALUES ('',NOW(),$uptime);"
@Dergonic
Dergonic / Exclude_fool_values.js
Last active April 26, 2016 09:25
Exclude fools values from a table of values
function removeWrongValues(values, trustMulti) {
var sValues = values.sort(function(a,b){return a - b;});
var valCount = sValues.length; //number of items in the table
var q1Arr = (sValues.length % 2 == 0) ? sValues.slice(0, (sValues.length / 2)) : sValues.slice(0,Math.floor(sValues.length / 2));
var q2Arr = sValues;
var q3Arr = (sValues.length % 2 == 0) ? sValues.slice((sValues.length / 2), sValues.length) : sValues.slice(Math.ceil(sValues.length / 2));
var q1 = median(q1Arr);
var q2 = median(q2Arr);
@Dergonic
Dergonic / speedtest-mysql.sh
Last active December 17, 2022 22:32
Speedtest my connection and post the result to mysql db.
#!/usr/bin/env bash
# Character for separating values
# (commas are not safe, because some servers return speeds with commas)
speedtestserver=3271
mysqllogin=#Mysql_Login
mysqlpassword=#Mysql_Pass
mysqldb=#Mysql_Server
pcip="192.168.1.2" #work computer