Skip to content

Instantly share code, notes, and snippets.

View sumonst21's full-sized avatar
🏠
Working from home

Md. Sumon Islam sumonst21

🏠
Working from home
View GitHub Profile
@fanjin-z
fanjin-z / csgo-server-guide.md
Last active November 11, 2023 17:20
Complete Guide for Hosting CS:GO Dedicated Servers

Complete Guide for Hosting a CS:GO Dedicated Server

Creative Commons License.

I tested the setup on Debian Stretch (naive installation) and Jessie (LinuxGSM installation). The setup should work on Debian 8 (Jessie), Debian 9 (Stretch) and Ubuntu (16.04). However, If you're running on Windows or other non-debian based Linux OS (e.g. CentOS, openSUSE), this guide doesn't apply to you.

My Servers:

I'm hosting FFA warm-up and HvH(soon) servers in San Francisco, welcome to join by:

IPv4: 159.89.154.137   
Ipv6: 2604:a880:2:d0::20ad:2001 
@ve3
ve3 / Encryption.js
Last active August 10, 2023 10:51
Encrypt and decrypt between programming languages (PHP & JavaScript). (Newer version here https://gist.github.com/ve3/b16b2dfdceb0e4e24ecd9b9078042197 )
/**
* Encryption class for encrypt/decrypt that works between programming languages.
*
* @author Vee Winch.
* @link https://stackoverflow.com/questions/41222162/encrypt-in-php-openssl-and-decrypt-in-javascript-cryptojs Reference.
* @link https://github.com/brix/crypto-js/releases crypto-js.js can be download from here.
*/
class Encryption {
@jesperorb
jesperorb / php_form_submit.md
Last active April 30, 2024 22:27
PHP form submitting with fetch + async/await

PHP Form submitting

If we have the following structure in our application:

  • 📁 application_folder_name
    • 📄 index.php
    • 📄 handle_form.php
    • 📄 main.js

And we fill our index.php with the following content just to get a basic website with a form working. You should be able to run this through a php-server of your choice.

@trx1138
trx1138 / mkv2srt-syno.sh
Created March 3, 2018 03:16
extract srt from mkv container with ffmpeg (for synology)
#!/bin/bash
# Extract subtitles from each MKV file in the given directory
# If no directory is given, work in local dir
if [ "$1" = "" ]; then
DIR="."
else
DIR="$1"
fi
@keiraarts
keiraarts / load-styles-conditionally.php
Last active May 12, 2022 10:23
How to solve the PHP Notice: is_page was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. By using the Template Redirect hook the action can be called before any templates are loaded.
// Currently there is an issue in our PHP server error logs.
// PHP Notice: is_page was called incorrectly.
// Conditional query tags do not work before the query is run. Before then, they always return false.
// This is the wrong way to call is_page.
// is_page() only work within template files.
// To use it within plugin files, you need to use it with the combination of template_redirect action hook.
// function wordpress_theme_enqueue_styles() {
// if (is_page(2072)) {
@holmberd
holmberd / php-pools.md
Last active April 19, 2024 07:24
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@LinzardMac
LinzardMac / 1-wp-config.php
Last active October 8, 2021 20:26
Stupid simple conditional config for local and production w/ constants.
<?php
/**
* The base configuration for WordPress
*
* The wp-config.php creation script uses this file during the
* installation. You don't have to use the web site, you can
* copy this file to "wp-config.php" and fill in the values.
*
* This file contains the following configurations:
*
@linkanp
linkanp / php_environment_setup_ubuntu.md
Last active October 24, 2022 19:10
PHP 5.6 Development Environment on Ubuntu 16.04

PHP 5.6 Development Environment on Ubuntu 16.04

As a PHP developer on Ubuntu, we may need to re setup our development environment sometimes. I did it already a few times, so decided to write down the steps for a typical php development environment on ubuntu. My Ubuntu version is 16.04.

Installation List

@tiagocardosos
tiagocardosos / clear_binary_log_mysql.txt
Last active March 5, 2024 12:18
MySQL Clear Binary Log
Can I Remove MySQL Binary Log Yes, as long as the data is replicated to Slave server, it’s safe to remove the file. It’s recommend only remove MySQL Binary Log older than 1 month.
Besides, if Recovery of data is the main concern, it’s recommend to archive MySQL Binary Log.
There are several ways to remove or clean up MySQL Binary Log, it’s not recommend to clean up the file manually, manually means running the remove command.
Remove MySQL Binary Log with RESET MASTER Statement Reset Master statement is uses for new database start up during replication for Master and Slave server. This statement can be used to remove all Binary Log.
To clean up Binary Log on Master Server
@mrbar42
mrbar42 / README.md
Last active April 20, 2024 02:57
bash scripts to create VOD HLS stream with ffmpeg almighty (tested on Linux and OS X)

running:

bash create-vod-hls.sh beach.mkv

will produce:

    beach/
      |- playlist.m3u8
 |- 360p.m3u8