Skip to content

Instantly share code, notes, and snippets.

@ebela
ebela / pascaltriangle.js
Created March 15, 2025 21:56
Calculate Pascal trangle numbers
function buildPascalTriangleLevel( arr ) {
if ( arr == undefined ) {
arr = [];
}
if ( arr.length == 0 ) {
arr.push([1]);
}
else {
prevLevel = arr[arr.length-1];
let level = [];
@ebela
ebela / mikrotik-model-naming.txt
Last active March 3, 2025 06:52
Mikrotik model name coding
hAP - home AP
wAP - wall AP
cAP - ceiling AP
wsAP - wall socket AP
mAP - mini AP
ltAP - LTE AP
CRS - Cloud router switch
@ebela
ebela / hvghu_hide_notfree.js
Last active August 24, 2024 15:16
a fizetos tartalmak elrejtese a hvg.hu oldalon
//a fizetos tartalmak elrejtese a hvg.hu oldalon. ma 20240824
const elements = document.querySelectorAll('.hvg360-icon');
elements.forEach(element => {
// Megkeressük a szülőelemet egy másik osztállyal
const parent = element.closest('.articleitem, .articlelist-element');
if (parent) {
// A szülőelem display tulajdonságának none-ra állítása
parent.style.display = 'none';
@ebela
ebela / findmounts.sh
Created April 17, 2024 05:59
find all mount from root but exclude some directories
sudo find / -maxdepth 4 -not \( \( -path /proc -o -path /sys -o -path /dev -o -path /run \) -prune \) -type d -exec findmnt {} \;
@ebela
ebela / mlog.inc.php
Created March 7, 2024 20:48
quick timestamped php log
function mlog($msg, $level=null) {
$date = new DateTime();
$date->setTimezone( new DateTimeZone('Europe/Budapest'));
$dt = $date->format('Y.m.d H:i:s');
//$clientip=' ['.CLIENT_IP.']';
$lvl = $level ? " [$level]":"";
$cip = isset($_SERVER['HTTP_CF_CONNECTING_IP']) ? $_SERVER['HTTP_CF_CONNECTING_IP'] : $_SERVER['REMOTE_ADDR']);
$logline = $dt.' [.$cip.]'.$lvl.': '.$msg.PHP_EOL;
//$logline.=var_export($_SERVER,1);
@ebela
ebela / wp_update_domain.sql
Created December 18, 2023 06:46
wordpress move from one domain to another. sql query
UPDATE wp_options SET option_value = replace(option_value, 'oldurl.com', 'newurl.com') WHERE option_name = 'home' OR option_name = 'siteurl';UPDATE wp_posts SET guid = replace(guid, 'oldurl.com','newurl.com');UPDATE wp_posts SET post_content = replace(post_content, 'oldurl.com', 'newurl.com'); UPDATE wp_postmeta SET meta_value = replace(meta_value,'oldurl.com','newurl.com');
If 2fa is enabled on github switch to ssh instead of https on linux
1. generate an ssh keypair on your linux box
ssh-keygen -t {rsa|dsa}
2. add the public key to github: profile - settings - ssh keys
3. switch from https to ssh
Check your repo remote:
# letsencrypt wildcard and root certificate create.sh
sudo certbot certonly --manual --preferred-challenges=dns --email user@example.com --server https://acme-v02.api.letsencrypt.org/directory --agree-tos -d *.mydomain.com -d mydomain.com
<style type="text/css">
.menu-container .menu a{
font-family: "Times New Roman", Times, serif;
font-size: 16px;
font-weight: bold;
}
.menu-container ul {
list-style-type: none;
src=user@remote.com:/storage/mail
dst=/systems/dandre.hu/mail/vmail/
backdir=/systems/backups/
dn=example.com
time for ln in `ls -1 /var/vmail/$dn/` ; do
echo $ln;
time rsync -az --delete --backup --backup-dir=$backdir/$dn/$ln --info=progress2 -e "ssh -p 22" $src/$dn/$ln/Maildir $dst/$dn/$ln/
done