portalzine / Script to check comprehensive disk statistics
0 gustos
0 bifurcaciones
1 archivos
Última actividad 1 month ago
| 1 | |
| 2 | #!/bin/bash |
| 3 | |
| 4 | # Script to check comprehensive disk statistics |
| 5 | # Author: Alex@portalZINE.de |
| 6 | # Date: 25.11.2025 |
| 7 | |
| 8 | ##################################### |
| 9 | # CONFIGURATION |
| 10 | ##################################### |
portalzine / mosparo rule package example
0 gustos
0 bifurcaciones
2 archivos
Última actividad 1 month ago
| 1 | 07be17de35d734cdd01481f3339ac1baafae897d958a5a863edc53a90e43d83b rulepackage.json |
portalzine / Uint8Array-Objekte from Text with Icons
0 gustos
0 bifurcaciones
1 archivos
Última actividad 1 month ago
| 1 | function encodeTextWithIcons(text) { |
| 2 | // Split text by icon pattern {number} |
| 3 | const parts = text.split(/(\{\d+\})/g); |
| 4 | |
| 5 | const byteArray = []; |
| 6 | |
| 7 | for (const part of parts) { |
| 8 | if (part === '') continue; |
| 9 | |
| 10 | // Check if it's an icon pattern |
portalzine / HTMX - Process on DOM changes
0 gustos
0 bifurcaciones
1 archivos
Última actividad 7 months ago
| 1 | const observer = new MutationObserver((mutations) => { |
| 2 | mutations.forEach((mutation) => { |
| 3 | mutation.addedNodes.forEach((node) => { |
| 4 | if (node.nodeType === 1 && !node["htmx-internal-data"]) { |
| 5 | htmx.process(node) |
| 6 | } |
| 7 | }) |
| 8 | }) |
| 9 | }) |
| 10 | observer.observe(document, {childList: true, subtree: true}) |
portalzine / Protect access to log and sql files
0 gustos
0 bifurcaciones
1 archivos
Última actividad 8 months ago
| 1 | # protect access to log and sql files. |
| 2 | <FilesMatch "\.(log|sql)(\.(t?gz|tar|gz|tar\.gz|7z|rar|bz2))?$"> |
| 3 | <IfModule mod_authz_core.c> |
| 4 | Require all denied |
| 5 | </IfModule> |
| 6 | <IfModule !mod_authz_core.c> |
| 7 | Order deny,allow |
| 8 | Deny from all |
| 9 | </IfModule> |
| 10 | </FilesMatch> |
portalzine / oh my zsh - Remember
0 gustos
0 bifurcaciones
1 archivos
Última actividad 9 months ago
| 1 | # UPDATE |
| 2 | omz update |
portalzine / Extract text between two tags (domDocument)
0 gustos
0 bifurcaciones
1 archivos
Última actividad 9 months ago
| 1 | $tag = "p"; |
| 2 | $html ="I am here!"; |
| 3 | $dom = new domDocument('1.0', 'utf-8'); |
| 4 | $dom->loadHTML($html); |
| 5 | $dom->preserveWhiteSpace = false; |
| 6 | |
| 7 | $findTag = $dom->getElementsByTagName($tag); |
| 8 | |
| 9 | echo $findTag->item(0)->nodeValue; |
portalzine / Randomly reorder a list
0 gustos
0 bifurcaciones
1 archivos
Última actividad 9 months ago
| 1 | var reorder = function(selector){ |
| 2 | var ul = document.querySelector(selector); |
| 3 | for (var i = ul.children.length; i >= 0; i--) { |
| 4 | ul.appendChild(ul.children[Math.random() * i | 0]); |
| 5 | } |
| 6 | |
| 7 | } |
portalzine / Syntax Highlighting Class
0 gustos
0 bifurcaciones
2 archivos
Última actividad 9 months ago
| 1 | class SyntaxHighlight { |
| 2 | |
| 3 | static $tokens = array();// This array will be filled from the regexp-callback |
| 4 | public static function process($s) { |
| 5 | $s = htmlspecialchars($s); |
| 6 | // Workaround for escaped backslashes |
| 7 | $s = str_replace('\\\\','\\\\<e>', $s); |
| 8 | $regexp = array( |
| 9 | // Punctuations |
| 10 | '/([\-\!\%\^\*\(\)\+\|\~\=\`\{\}\[\]\:\"\'<>\?\,\.\/]+)/' |
portalzine / Getting the average of an array of numbers
0 gustos
0 bifurcaciones
2 archivos
Última actividad 9 months ago
| 1 | $average_of_myfoos = array_sum($myfoos) / count($myfoos); |
Siguiente
Anterior