Skip to content

Instantly share code, notes, and snippets.

@bsh
bsh / kubernetes-cheet-sheet.txt
Last active November 25, 2024 16:33
Kubernetes cheet sheet
# futó podok listázása
kubectl get pods
# deploymentek listázása
kubectl get deployments.apps
# adott deployment újraindítása
kubectl rollout restart deployment <deployment neve>
# shell szintű elérés adott pod php-fpm konténerébe
@bsh
bsh / Middleware-CSP.php
Created June 24, 2023 10:57 — forked from valorin/.env.example
CSP Middleware - the simple CSP middleware I use across all of my projects.
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Facades\Vite;
use Illuminate\Support\Str;
/**
* Simple Content Security Policy middleware.
@bsh
bsh / HowToDeleteAllCloudflareRecors.md
Created June 27, 2022 07:45 — forked from AidasK/HowToDeleteAllCloudflareRecors.md
Cloudflare delete all DNS records. Just go to cloudflare dns zones, open your browers developer console and paste this javascript code.

image

add_action('fix_expired_sales_price', 'fix_expired_sales_price_function');
/**
* Törli az akciós árat, ha az akció ideje már lejárt és mégis
* bent marad az ár és a dátum. Valemelyik akciókkal kapcsolatos
* plugin hibája.
*
* Az actiont wp cron futtatja naponta kétszer.
*
public static function trackBooking(Order $order)
{
if (! isset($order->id)) {
return false;
}
$po_api_username = config('constants.po_api_username');
$po_api_password = config('constants.po_api_password');
$ContractID = config('constants.po_api_contract_id');
$TransactionID = time().rand(1, 9999);
@bsh
bsh / cf.php
Created May 11, 2020 14:08
Bulk delete cloudflare DNS records
<?php
function auth_redirect()
{
}
function wp_get_current_user()
{
global $current_user;
wp_set_current_user(1);
@bsh
bsh / mysql.php
Created November 26, 2018 09:04 — forked from billsuxx/mysql.php
<?php
/**
* Procedural drop in replacement for legacy projects using the MySQL function
*
* @author Sjoerd Maessen
* @version 0.1
*/
// Make sure the MySQL extension is not loaded and there is no other drop in replacement active
if (!extension_loaded('mysql') && !function_exists('mysql_connect')) {
@bsh
bsh / copy_lang.php
Last active November 18, 2018 20:15
Prestashop - Copy product description
<?php
/* Copy lang */
/* bsh - brandlift.eu */
if ((!file_exists('init.php') || !file_exists('config/config.inc.php')) && _COOKIE_KEY_ != '') {
die('Error: An include file not found. Check the path.');
} else {
include('config/config.inc.php');
require_once('init.php');
}
@bsh
bsh / stock.php
Created July 7, 2017 14:39
Hide out of stock products - prestashop
<?php
/* Hide out of stock products */
/* bsh - brandlift.eu */
if ((!file_exists('init.php') || !file_exists('config/config.inc.php')) && _COOKIE_KEY_ != '') {
die('Error: An include file not found. Check the path.');
} else {
include('config/config.inc.php');
require_once('init.php');
}
@bsh
bsh / getCountryFromCity.php
Created June 6, 2017 07:56
getCountryFromCity
public function getCountryFromCity($city)
{
if (isset($this->country_city_array[$city])) {
return $this->country_city_array[$city];
} else {
//get
$url = 'http://nominatim.openstreetmap.org/search?city=' . urlencode($city) . '&format=json&limit=1&addressdetails=1&accept-language=en';
$c = curl_init();
$agent = random_user_agent();