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
@ttk
ttk / cf-els-goaccess.sh
Created September 21, 2018 22:44
Exports the Cloudflare ELS log file and transforms the format to be consumed by goaccess
#!/bin/bash
# Purpose: Exports the Cloudflare ELS log file and transforms the format to be consumed by goaccess.
# Developed by Tom Kaminski <tom@mobilenations.com>
# Requires the following tools:
# wget
# jq - https://stedolan.github.io/jq/
# goaccess - https://goaccess.io/
@chrisstubbs93
chrisstubbs93 / ffmpeg.sh
Last active January 11, 2024 22:40
auto-restart FFMPEG when it stops sending frames to youtube
#!/bin/sh
sleep 5
ffmpeg -re -f mjpeg -r 10 -i "http://localhost/?action=stream" -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -acodec aac -ab 1k -strict experimental -s 640x360 -vcodec h264 -pix_fmt yuv420p -g 20 -vb 500k -preset ultrafast -crf 31 -r 10 -f flv "rtmp://a.rtmp.youtube.com/live2/xxxx-xxxx-xxxx-xxxx" 2> /home/pi/ffmpeg.log
@kowalcj0
kowalcj0 / .bashrc
Last active July 30, 2023 10:09
Extract all subtitles from a movie using ffprobe & ffmpeg
alias subs=subs
function subs() {
movie="${1}"
filename="${1%.*}"
mappings=`ffprobe -loglevel error -select_streams s -show_entries stream=index:stream_tags=language -of csv=p=0 "${movie}"`
OLDIFS=$IFS
IFS=,
( while read idx lang
do
@holmberd
holmberd / linux-kill-pts.md
Last active April 25, 2024 15:50
Kill tty/pts sessions in Linux

Kill user tty/pts sessions in Linux

Commands

  • w: show who is logged on and what they are doing
  • who: show who is logged on
  • tty: show current users pseudo terminal
  • ps -ft pts/1: get process id for the pseudo terminal
  • pkill: signal process based on name and other attributes
@anthumchris
anthumchris / README.md
Last active September 25, 2022 19:04
Clear Nginx Cache

Clearing Nginx's HTTP Cache

I recently implemented Nginx HTTP content caching on our WordPress web servers to improve page load speeds and eliminate redundant, unneeded server-side page rendering. Caching the pages was relatively straightforward, but clearing the cache required a custom workaround.

Nginx comes in two versions: free and “Nginx Plus” at $2,500/year. The free version of Nginx does not offer the needed cache-clearing features of Nginx Plus, and I wasn’t comfortable paying $20,000 for 8 instances without trying to build my own solution.

Our Nginx servers run as an HTTP proxy for multiple PHP/MySQL-backed WordPress sites. The goal was to cache the dynamic PHP HTML responses in Nginx and serve the HTML pages from Nginx to avoid redundant, CPU-intensive PHP renders.

Site Cache Configuration

The example below shows how PHP response caching is configured for a site (other nginx configuration details are excluded for brevity). A cache named cachedemo-prod is defined to store cached HTML f

@1hakr
1hakr / example.com
Last active January 31, 2024 01:16
Supercharge your NGIX config
proxy_cache_path /tmp/cacheapi levels=1:2 keys_zone=microcacheapi:100m max_size=1g inactive=1d use_temp_path=off;
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name example.com;
location /api/ {
# Rate Limiting
limit_req zone=reqlimit burst=20; # Max burst of request
@yidas
yidas / codeiginter-server-config.md
Last active March 1, 2024 01:30
Codeigniter 3 server configuration for Nginx & Apache

Codeigniter 3 server configuration for Nginx & Apache

Web Server Site Configuration

Recommended Apache Configuration

Use the following configuration in Apache's httpd.conf file or within a virtual host configuration. Note that you should set DocumentRoot and ServerName fit to your environment:

@cecilemuller
cecilemuller / 2019-https-localhost.md
Last active April 26, 2024 03:07
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@7rin0
7rin0 / apache2_vhost_config_vuejs_dist
Created June 18, 2018 13:50
VueJS: Apache / Nginx vhost config examples
<VirtualHost *:80>
DocumentRoot "/home/dev/server/project/dist/"
ServerName vuejs.project.local
<Directory /home/dev/server/project/dist/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require all granted
Order allow,deny
allow from all
@mrbar42
mrbar42 / README.md
Last active March 28, 2024 18:06
Secured HLS setup with Nginx as media server

Secured HLS setup with Nginx as media server

This example is part of this article.

This is an example for an HLS delivery with basic security. Nginx compiled with nginx-rtmp-module & secure-link is used as media server. Features:

  • Domain filtering
  • Referrer filtering
  • Embed buster