Skip to content

Instantly share code, notes, and snippets.

View salimhossain's full-sized avatar

Salim Hossain salimhossain

View GitHub Profile
@salimhossain
salimhossain / com.local.keyRemapping.plist
Created February 6, 2025 02:30
macOS keyboard brightness shortcut keys (fn + f1 and fn + f2)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.local.KeyRemapping</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/hidutil</string>
<string>property</string>
@salimhossain
salimhossain / WP_Allow_WebP_uploads.php
Last active January 31, 2025 01:40
WordPress Allow WebP uploads
<?php
// Allow WebP uploads
add_filter( 'mime_types', 'enable_webp_uploads' );
function enable_webp_uploads( $mimes ) {
$mimes['webp'] = 'image/webp';
return $mimes;
}
// Check WebP support
add_action( 'admin_notices', 'check_webp_support' );
function check_webp_support() {
@salimhossain
salimhossain / gutenberg.txt
Created March 26, 2021 08:55 — forked from chrismccoy/gutenberg.txt
Gutenberg Resources
Getting Started with Block Themes: Patterns
https://themeshaper.com/2021/01/11/getting-started-with-block-themes-patterns/
WordPress Blocks Backwards Compatibility
https://webdevstudios.com/2020/12/29/wordpress-blocks-backwards-compatibility/
Stylin’ WordPress Gutenberg Columns Block
https://dbushell.com/2020/11/02/wordpress-gutenberg-columns-block-css-styles/
Gutenberg Components and Invalid Hook Call Error in React
@salimhossain
salimhossain / nginxproxy.md
Created March 26, 2021 07:04 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@salimhossain
salimhossain / frontendDevlopmentBookmarks.md
Created March 26, 2021 06:49 — forked from dypsilon/frontendDevlopmentBookmarks.md
A badass list of frontend development resources I collected over time.
@salimhossain
salimhossain / benchmark+go+nginx.md
Created March 26, 2021 06:09
Benchmarking Nginx with Go

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI
@salimhossain
salimhossain / nginx-tuning.md
Created March 25, 2021 13:33 — forked from denji/nginx-tuning.md
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.

@salimhossain
salimhossain / wp-admin-modal-dialog.php
Created March 25, 2021 13:23 — forked from anttiviljami/wp-admin-modal-dialog.php
WordPress admin modal dialog example
<?php
// enqueue these scripts and styles before admin_head
wp_enqueue_script( 'jquery-ui-dialog' ); // jquery and jquery-ui should be dependencies, didn't check though...
wp_enqueue_style( 'wp-jquery-ui-dialog' );
?>
<!-- The modal / dialog box, hidden somewhere near the footer -->
<div id="my-dialog" class="hidden" style="max-width:800px">
<h3>Dialog content</h3>
<p>This is some terribly exciting content inside this dialog. Don't you agree?</p>