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 | |
check_malicious_upload(); | |
function check_malicious_upload() { | |
$user_uploads = fetch_uploads(); | |
foreach ($user_uploads as $key => $value) { |
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
class IndexedDBStorage { | |
constructor(dbName = 'localStorageDB', storeName = 'localStorageStore') { | |
this.dbName = dbName; | |
this.storeName = storeName; | |
this._init(); | |
this.cache = {}; | |
} | |
_init() { | |
const request = window.indexedDB.open(this.dbName, 1); |
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
http://www.youtube.com/watch?v=-wtIMTCHWuI | |
http://youtube.com/watch?v=-wtIMTCHWuI | |
http://m.youtube.com/watch?v=-wtIMTCHWuI | |
https://www.youtube.com/watch?v=lalOy8Mbfdc | |
https://youtube.com/watch?v=lalOy8Mbfdc | |
https://m.youtube.com/watch?v=lalOy8Mbfdc | |
http://www.youtube.com/watch?v=yZv2daTWRZU&feature=em-uploademail | |
http://youtube.com/watch?v=yZv2daTWRZU&feature=em-uploademail | |
http://m.youtube.com/watch?v=yZv2daTWRZU&feature=em-uploademail |
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
var striptags = require('striptags') | |
function smartExcerpt (string) { | |
var re = /(^.*?[a-zA-Z0-9\)\”\"]{2,}[.!?])[\s\”\"]+\W*[A-Z]/ | |
var matches = striptags(string).match(re) | |
return matches && matches[1] ? matches[1] : string | |
} |
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
printf "Memory\t\tDisk\t\tCPU\n" | |
MEMORY=$(free -m | awk 'NR==2{printf "%.2f%%\t\t", $3*100/$2 }') | |
DISK=$(df -h | awk '$NF=="/"{printf "%s\t\t", $5}') | |
CPU=$(top -bn1 | grep load | awk '{printf "%.2f%%\t\t\n", $(NF-2)}') | |
echo "$MEMORY\t$DISK\t$CPU" |
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 | |
/* | |
* @source http://stackoverflow.com/questions/1147931/how-do-i-determine-the-extensions-associated-with-a-mime-type-in-php | |
*/ | |
function system_extension_mime_types() { | |
# Returns the system MIME type mapping of extensions to MIME types, as defined in /etc/mime.types. | |
$out = array(); | |
$file = fopen('/etc/mime.types', 'r'); |
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
top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1"%"}' |
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
#!/usr/bin/perl -w | |
# ORGINAL FTP BACKUP SCRIPT V1.00 | |
# Version 1.01 2nd hand coded BY ZEROF <zerof at backbox.org> | |
# This script was updated because some providers support only FTP passive mode (like online.net) | |
# And I needed Debian support as well (replaced path of gzip) | |
# SFTP support didn't work, need few lines of new code I guess, I didn't spend to much time on that part | |
# i just disabled, for now. If you have idea about fixing this, keep me posted. | |
# Is this best solution you will find? Nop, find some more secured scipt like duplicity | |
# COPYRIGHT 2013 - WEBHOSTINGHERO.COM |
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 | |
class AMP { | |
private $html; | |
/** | |
* HtmlToAmp constructor. | |
*/ | |
public function __construct($htmlContent) { |
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 | |
# Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication | |
# http://creativecommons.org/publicdomain/zero/1.0/ | |
function ampify($html='') { | |
# Replace img, audio, and video elements with amp custom elements | |
$html = str_ireplace( | |
['<img','<video','/video>','<audio','/audio>'], |
NewerOlder