Skip to content

Instantly share code, notes, and snippets.

@kezenwa
kezenwa / stats.sh
Created May 3, 2023 19:24 — forked from egulhan/stats.sh
echos memory, disk and cpu usage
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"
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
}
@kezenwa
kezenwa / ActiveYouTubeURLFormats.txt
Created December 9, 2023 06:17 — forked from rodrigoborgesdeoliveira/ActiveYouTubeURLFormats.txt
Example of the YouTube videos URL formats
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
@kezenwa
kezenwa / indexeddbstorage.js
Created July 1, 2024 07:55 — forked from xnohat/indexeddbstorage.js
sync wrapper for IndexedDB to same localStorage API, working extractly same as localStorage, just replace localStorage to idbStorage
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);
<?php
check_malicious_upload();
function check_malicious_upload() {
$user_uploads = fetch_uploads();
foreach ($user_uploads as $key => $value) {