This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//https://en.wikipedia.org/wiki/Median | |
function calcAvg($arr) | |
{ | |
$avg = (array_sum($arr)/count($arr)); | |
return $avg; | |
} | |
function calcMedian($arr) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
XVFB=/usr/bin/Xvfb | |
XVFBARGS=":1 -screen 0 1024x768x24 -ac +extension GLX +render -noreset" | |
PIDFILE=/var/run/xvfb.pid | |
case "$1" in | |
start) | |
echo -n "Starting virtual X frame buffer: Xvfb" | |
start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS | |
echo "." | |
;; | |
stop) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from http://scratch99.com/web-development/javascript/convert-bytes-to-mb-kb/ | |
function bytesToSize(bytes) { | |
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; | |
if (bytes == 0) return 'n/a'; | |
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); | |
if (i == 0) return bytes + ' ' + sizes[i]; | |
return (bytes / Math.pow(1024, i)).toFixed(1) + ' ' + sizes[i]; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Thanks to https://gist.github.com/Lewiscowles1986/ce14296e3f5222082dbaa088ca1954f7 | |
if [ "$(whoami)" != "root" ]; then | |
echo "Run script as ROOT please. (sudo !!)" | |
exit | |
fi | |
echo "deb http://mirrordirector.raspbian.org/raspbian/ stretch main contrib non-free rpi" > /etc/apt/sources.list.d/stretch.list | |
echo "APT::Default-Release \"jessie\";" > /etc/apt/apt.conf.d/99-default-release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://stackoverflow.com/questions/23451726/saving-binary-data-as-file-using-javascript-from-a-browser | |
var sampleBytes = new Int8Array(4096); | |
var saveByteArray = (function () { | |
var a = document.createElement("a"); | |
document.body.appendChild(a); | |
a.style = "display: none"; | |
return function (data, name) { | |
var blob = new Blob(data, {type: "octet/stream"}), | |
url = window.URL.createObjectURL(blob); | |
a.href = url; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Thanks to https://wiki.zoneminder.com/Raspbian | |
if [ "$(whoami)" != "root" ]; then | |
echo "Run script as ROOT please. (sudo !!!)" | |
exit | |
fi | |
# Disable Wi-Fi and Bluetooth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback | |
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB; | |
// Open (or create) the database | |
var open = indexedDB.open("MyDatabase", 1); | |
// Create the schema | |
open.onupgradeneeded = function() { | |
var db = open.result; | |
var store = db.createObjectStore("MyObjectStore", {keyPath: "id"}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#https://ayesh.me/Ubuntu-PHP-7.2 | |
#http://linux-notes.org/ustanovka-mysql-na-debian-ubuntu-linux-mint/ | |
#https://www.digitalocean.com/community/tutorials/apache-ubuntu-14-04-lts-ru | |
#https://stackoverflow.com/questions/3940909/configure-apache-to-listen-on-port-other-than-80 | |
#https://www.tecmint.com/change-default-mysql-mariadb-port-in-linux/ | |
sudo apt-get update | |
sudo apt-get upgrade |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# https://github.com/Open365/Open365 | |
# https://superuser.com/questions/769920/python3-pip-installed-but-pip3-command-not-found | |
sudo apt-get update | |
sudo apt-get upgrade | |
sudo apt-get install -y git vim mc | |
sudo apt-get install -y python3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<head> | |
<script> | |
var db; | |
// until we won't need this prefix mess | |
var indexedDB = window.indexedDB || window.webkitIndexedDB | |
|| window.mozIndexedDB || window.msIndexedDB; | |
var IDBTransaction = window.IDBTransaction || | |
window.webkitIDBTransaction; |
OlderNewer