Skip to content

Instantly share code, notes, and snippets.

View manutheblacker's full-sized avatar
🎯
Focusing

Emmanuel A. manutheblacker

🎯
Focusing
View GitHub Profile
@LeZuse
LeZuse / howto.md
Last active July 5, 2023 07:52
Disable Docker for Mac auto-update

Docker downloads all updates into a directory in /Users/$USER/Library/Caches/com.docker.docker/org.sparkle-project.Sparkle Let's make this directory inaccessible to the user under which Docker is going to run (you).

Switch to root user:

  sudo su

Change directory ownership and prevent access to other users:

@manutheblacker
manutheblacker / gist:11a493c7a8a7b3652b9319c55a18ce3e
Last active May 11, 2021 08:45 — forked from pwlin/gist:4147863
Translate any webpage using Google Translate
<div id="google_translate_element"></div>
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');
}
</script>
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
@Michaelkodji
Michaelkodji / index.php
Created May 27, 2020 11:30
Generate a automatic code
<?php
function passgen2($nbChar){
return substr(str_shuffle('abcdefghijklmnopqrstuvwxyzABCEFGHIJKLMNOPQRSTUVWXYZ0123456789'),1, $nbChar); }
echo passgen2(9);
// Affiche un password comme : M9ytp5Pbcn
?>
@andresabello
andresabello / SkeletonLoader.vue
Last active November 25, 2022 13:28
A skeleton loader for Vue JS. You will need to implement the setLoadingState. This one is just an example that hides the element after 5 seconds.
<template>
<div class="container">
<div class="row" v-show="loading">
<div class="col-xl-4 pt-5">
<div class="placeholder wave">
<div class="square"></div>
<div class="line"></div>
<div class="line"></div>
</div>
</div>
@tigerhawkvok
tigerhawkvok / poetry-convert.py
Last active April 19, 2024 23:31
Convert a requirements.txt file to a Poetry project
#!python3
"""
Convert a requirements.txt file to a Poetry project.
Just place in the root of your working directory and run!
"""
sourceFile = "./requirements.txt"
import re
import os
@paaljoachim
paaljoachim / functions.php
Last active September 27, 2022 18:00
WooCommerce dropdown product quantity. It also correctly adds the correct minimum quantity when pressing the Add to Cart in the Shop page.
/** Initial code from: https://gist.github.com/kloon/6495019
As the code did not fully work I received help from Helga the Viking
with this gist: https://gist.github.com/helgatheviking/ff8792fbb12f5c5367c816b8a46c70ad
* Change the quantity input to select.
* @param array $args Args for the input.
* @param WC_Product|null $product Product.
* @param boolean $echo Whether to return or echo|string.
* @return string
*/
@darkoromanov
darkoromanov / freemius-2-fomo.php
Last active July 22, 2021 17:58
Freemius integration for Fomo
<?php
// Fomo documentation: https://docs.fomo.com/reference
// Freemius documentation: http://freemius.com/help/documentation/marketing-automation/events-webhooks/
// Install Fomo PHP SDK https://github.com/usefomo/fomo-php-sdk
include "vendor/autoload.php";
define("FOMO_AUTH_TOKEN", "*********");
@bekarice
bekarice / filter-wc-orders-by-gateway.php
Last active August 3, 2023 13:37
Filters WooCommerce Orders by Payment Gateway Used
<?php
/**
* Plugin Name: Filter WooCommerce Orders by Payment Method
* Plugin URI: http://skyverge.com/
* Description: Filters WooCommerce orders by the payment method used :)
* Author: SkyVerge
* Author URI: http://www.skyverge.com/
* Version: 1.0.0
* Text Domain: wc-filter-orders-by-payment
*
@that0n3guy
that0n3guy / gist:905c812c0f65e7ffb5ec
Last active December 20, 2023 11:13
Mautic nginx config
server {
# see: http://wiki.nginx.org/Pitfalls
# see: http://wiki.nginx.org/IfIsEvil
listen 80;
root /app;
index index.html index.htm index.php;
error_page 404 /index.php;
# Make site accessible from http://set-ip-address.xip.io
@denji
denji / nginx-tuning.md
Last active April 26, 2024 11:21
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.