Posts

Showing posts from 2019

Compress MP4 files

How to compress the MP4 files. find . -type f -name "*.MP4" -exec bash -c 'FILE="$1"; ffmpeg -i "${FILE}" -s 1280x720 -acodec copy -y "${FILE%.mp4}.shrink.mp4";' _ '{}' \;

Varnish Exemple for CACHE and Optimisation

Varnish Optimisation cache # # This is an example VCL file for Varnish. # # It does not do anything by default, delegating control to the # builtin VCL. The builtin VCL is called when there is no explicit # return statement. # # See the VCL chapters in the Users Guide at https://www.varnish-cache.org/docs/ # and https://www.varnish-cache.org/trac/wiki/VCLExamples for more examples. # Marker to tell the VCL compiler that this VCL has been adapted to the # new 4.0 format. vcl 4.0; # Default backend definition. Set this to point to your content server. backend default { .host = "127.0.0.1"; .port = "8080"; } sub vcl_recv { # Happens before we check if we have this in cache already. # # Typically you clean up the request here, removing cookies you don't need, # rewriting the request, etc. # Happens before we check if we have this in cache already. # # Typically you clean up the request here, removing cookies you ...

Linux Compress PDF batch

#### gs gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf $INPUTFILE ### pdf2ps && ps2pdf pdf2ps input.pdf output.ps && ps2pdf output.ps output.pdf ### Webservice http://compress.smallpdf.com/de For linux #!/bin/sh gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/default -dNOPAUSE -dQUIET -dBATCH -dDetectDuplicateImages -dCompressFonts=true -r150 -sOutputFile="compress_$@" "$@" ./compresspdf.sh file.pdf find -type f -name "*.pdf" -exec ./compresspdf.sh {} \; #!/bin/sh INPUT = $1 ; shift OUTPUT = $1 ; shift GS_BIN =/ usr / bin / gs QFACTOR = "0.40" # Image Compression Quality # # Quality HSamples VSamples QFactor # Minimum [2 1 1 2] [2 1 1 2] 2.40 # Low [2 1 1 2] [2 1 1 2] 1.30 # Medium [2 1 1 2] [2 1 1 2] 0.76 # High [1 1 1 1] [1 1 1 1] 0.40 # Maximum [1 1 1 1] [1 1 1 1] 0.15 $ { GS_BIN } - dBATCH - dSAFER - DNOPAUSE -...

resize images in Linux

Reduce images files png or jpg jpeg in subdirectories find -type f -name "*.jpeg" -exec jpegoptim --strip-all {} \; optipng *.png find -type f -name "*.png" -exec optipng {} \;

Azure remove certificate error

Azure remove certificate error Failed to delete the App Service Certificate. : Delete for 'certificatelalala' App Service Certificate failed because there are still imported certificates derived from the App Service Certificate in the source subscription. Imported certificates: /subscriptions/123456avbcbcvbcm,ddsadada-7s8s9s987s78s/resourceGroups/webapplalala/providers/Microsoft.Web/certificates/certificatelalala-WestEuropewebspace Go to https://resources.azure.com/ navigate to subscriptions --> specific subscription --> providers --> Microsoft.Web --> certificates and see if it is here and i think you can delete it from here directly.

VirtualBOX MAC resolution problem

In windows, run CMD in admin mode, enter in VirtualBox folder, run the command VBoxManage setextradata “Hackintosh” “CustomVideoMode1” “3240x2160x32” && VBoxManage setextradata “Hackintosh” “VBoxInternal2/EfiGraphicsResolution” 3240x2160

Haproxy Monitoring or BLOCK DDOS

How to monitor or block DDOS in Haproxy https://www.haproxy.com/blog/introduction-to-haproxy-stick-tables/ Configuration to monitor access This configuration just will TAG the external IP in the   abuse table, if need block something just remove the double #, to change the level of monitoring increase or reduce the number of connection   level. # ABUSE SECTION works with http mode dependent on src ip ## tcp-request content reject if { src_get_gpc0(Abuse) gt 5000 } acl abuse src_http_req_rate(Abuse) ge 5000 acl flag_abuser src_inc_gpc0(Abuse) ge 100 acl scanner src_http_err_rate(Abuse) ge 5000 # Abuse protection. # Sources that are not filtered. tcp-request content accept if { src -f /etc/haproxy/whitelist.lst } # Sources rejected immeditely. tcp-request content reject if { src -f /etc/haproxy/blacklist.lst } # Limiting the connection rate per client. No more than 5000 connections over 3 seconds. ## tcp-request content reject if { ...

SSH / Putty or similar freeze,

Image
Change the MTU Putty / SSH / Termius  freeze.  After changing the MTU of Windows TAP adapter to 1200, it works fine. 

Azure Mysql in app, error #2002

Image
In the Azure WEB APP , MYSQL IN APP, you get this error azurewebsites.net/phpMyAdmin/ Erreur : #2002 - An attempt was made to access a socket in a way forbidden by its access permissions. — The server is not responding (or the local server's socket is not correctly configured). mysqli_real_connect(): (HY000/2002): An attempt was made to access a socket in a way forbidden by its access permissions.  The solution is

Got error 1 from storage engine

Image
Using in the Azure Database for MySQL server Got the error 1  when I tried to migrate the database ERROR 1030 (HY000) at line   Got error 1 from storage engine Why? https://blogs.msdn.microsoft.com/azuresqldbsupport/2017/06/08/azure-database-for-mysql-cant-restore-database-with-error-got-error-1-from-storage-engine/ "Got error 1 from storage engine" While indicated to be a storage capacity issue on a MySQL server when researching this error, in Azure Database for MySQL this error is most commonly seen when the MyISAM storage engine is being used. Currently, MyISAM is not supported on Azure Database for MySQL. In this scenario, you will need to modify the tables to utilize a supported engine such as InnoDB. This is the engine that Azure Database for MySQL uses by default. This article Converting MyISAM to InnoDB will help you understand the implications of changing from MyISAM and the suggested conversion steps to InnoDB. The most common method is t...