Skip to content

Instantly share code, notes, and snippets.

View hsntgm's full-sized avatar
🎯
Working hard for PSAUXIT

Hasan ÇALIŞIR hsntgm

🎯
Working hard for PSAUXIT
View GitHub Profile
@hsntgm
hsntgm / lets_encrypt_dane_tlsa.py
Last active February 26, 2024 20:34
Create a DANE TLSA records (SMTP & HTTP) [Automatically for Let's Encrypt]
#!/usr/bin/env python3
#
# Copyright (C) 2024 Hasan CALISIR <hasan.calisir@psauxit.com> - PSAUXIT.COM
# Distributed under the GNU General Public License, version 2.0.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@hsntgm
hsntgm / functions.php
Last active February 7, 2024 15:40
woocommerce-nvi-tc-kimlik-dogrulama
<?php
function strto($to, $str) {
if ('lower' === $to) {
return mb_strtolower(str_replace(array('I', 'Ğ', 'Ü', 'Ş', 'İ', 'Ö', 'Ç'), array('ı', 'ğ', 'ü', 'ş', 'i', 'ö', 'ç'), $str), 'utf-8');
} elseif ('upper' === $to) {
return mb_strtoupper(str_replace(array('ı', 'ğ', 'ü', 'ş', 'i', 'ö', 'ç'), array('I', 'Ğ', 'Ü', 'Ş', 'İ', 'Ö', 'Ç'), $str), 'utf-8');
} else {
trigger_error('Lütfen geçerli bir strto() parametresi giriniz.', E_USER_ERROR);
}
@hsntgm
hsntgm / get_cpanm.sh
Created October 12, 2021 20:50
Useful function to get cpanm manually instead of relying package managers
# Need for further perl module installation which not found in distribution repo
# Best way for scripted perl module installation
get_cpanm (){
if ! command -v cpanm >/dev/null 2>&1; then # Check in $PATH
if [[ ! -f /usr/local/bin/cpanm ]]; then # Check in local path
{
cd /tmp
curl -sLk https://cpanmin.us | perl - --sudo App::cpanminus
} >/dev/null 2>&1
fi
@hsntgm
hsntgm / lc0-0.21.1.ebuild
Created July 5, 2021 13:27
lc0 Gentoo/Linux ebuild for all backends
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit eutils flag-o-matic meson toolchain-funcs unpacker
MY_MKL_PV="10.0.5.025"
DESCRIPTION="UCI-compliant chess engine designed to play chess via neural network"
@hsntgm
hsntgm / openblas-0.3.5.ebuild
Created July 5, 2021 13:24
OpenBLAS Gentoo/Linux ebuild
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit fortran-2 toolchain-funcs
DESCRIPTION="OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version"
HOMEPAGE="http://xianyi.github.com/OpenBLAS/"
SRC_URI="https://github.com/xianyi/OpenBLAS/archive/v${PV}.tar.gz -> ${P}.tar.gz"
@hsntgm
hsntgm / certbot-dns-rfc2136.sh
Created July 5, 2021 13:18
dns-rfc2136 python module updater
#!/bin/bash
# If you use certbot auto renawal with DNS validation you need exact version of dns-rfc2136 python module with certbot.
# This script simply updates dns-rfc2136 python module with pip ACCORDING TO CERTBOT VERSION to prevent breaking certificate renew automations if needed.
# Even you have fully updated system in some linux distros there may be version mismatch beetween these two packages.Then you get parse errors probably.
# This script rely on pip instead of package manager! If your distro repository has certbot-dns-rfc2136 package and already installed using pip can break things.
# One possible solution could be masking certbot-dns-rfc2136 updates from your package manager and rely on this script(pip).
# But this could also break other packages that depends certbot-dns-rfc2136. This depends which linux distro runs on your system. Be careful.
# Crontab:
# 0 4 * * * /path/scripts/certbot-dns-rfc2136.sh >/dev/null 2>&1
@hsntgm
hsntgm / update_gentoo.sh
Created July 5, 2021 13:14
Handy gentoo auto update cron script
#!/bin/bash
#
# eix depended handy gentoo update cron script.
# * Prioritize portage upgrade if available.
# * Runs perl-cleaner for perl upgrade process.
# * Warns for reboot if pam upgraded.
# * Sends upgrade summary via mail.
#======================================================================================
# send mail configuration:
@hsntgm
hsntgm / doveadm_ops.sh
Last active May 25, 2021 08:11
Dovecot -- find and delete mails that sent by mistake if unseen yet.
#!/bin/bash
# >> LDA-Dovecot <<
# Find and delete mails which accidently sent to wrong mailbox if unseen yet.
# Works very fast in big mailboxes. Search for uniq_word in body.
mbox="INBOX"
mailbox="somebody@company.com"
date="2021-05-14"
str="uniq_word"