Skip to content

Instantly share code, notes, and snippets.

View sumonst21's full-sized avatar
💭
Starred for hope, forked for later

Md. Sumon Islam sumonst21

💭
Starred for hope, forked for later
View GitHub Profile
@sumonst21
sumonst21 / profiles.json
Created October 31, 2019 11:58 — forked from trajano/settings.json
Windows Terminal (with git bash and additional shortcuts)
{
"globals" :
{
"alwaysShowTabs" : true,
"copyOnSelect" : false,
"defaultProfile" : "{00000000-0000-0000-ba54-000000000001}",
"initialCols" : 120,
"initialRows" : 30,
"keybindings" :
[
@sumonst21
sumonst21 / skeleton-daemon.sh
Created November 6, 2019 13:32 — forked from shawnrice/skeleton-daemon.sh
A template to write a quick daemon as a bash script
#!/bin/sh
# This is a skeleton of a bash daemon. To use for yourself, just set the
# daemonName variable and then enter in the commands to run in the doCommands
# function. Modify the variables just below to fit your preference.
daemonName="DAEMON-NAME"
pidDir="."
pidFile="$pidDir/$daemonName.pid"
@sumonst21
sumonst21 / encode.py
Created November 8, 2019 02:04 — forked from derekkwok/encode.py
Simple python script to encode videos using ffmpeg
"""
This python script encodes all files that have the extension mkv in the current
working directory.
Sources:
http://ffmpeg.org/trac/ffmpeg/wiki/x264EncodingGuide
"""
import subprocess, os
#-------------------------------------------------------------------------------
@sumonst21
sumonst21 / storage.py
Created November 8, 2019 02:05 — forked from derekkwok/storage.py
A subclass of FileSystemStorage that checks if content.file has attribute 'temporary_file_path'
import errno, os
from django.conf import settings
from django.core.files import locks
from django.core.files.move import file_move_safe
from django.core.files.storage import FileSystemStorage
class CustomStorage(FileSystemStorage):
"""
This storage class tries to move files instead of copy when saving via
@sumonst21
sumonst21 / example.com.conf
Created November 15, 2019 00:25 — forked from cdolek/example.com.conf
nginx config example for memcached, php fpm and wordpress
http {
# memcached servers, generated according to wp-ffpc config
upstream memcached-servers {
server 127.0.0.1:11211;
}
# PHP-FPM upstream; change it accordingly to your local config!
upstream php-fpm {
@sumonst21
sumonst21 / cf-els-goaccess.sh
Created November 24, 2019 15:30 — forked from ttk/cf-els-goaccess.sh
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/
@sumonst21
sumonst21 / readme.md
Created November 24, 2019 21:05 — forked from geoffyuen/readme.md
Import CSV into ACF Repeater (Wordpress)
@sumonst21
sumonst21 / mongodb_and_php7.md
Created December 3, 2019 14:28 — forked from rashkopetrov/mongodb_and_php7.md
Install MongoDB and make it work with PHP 7.0

Install MongoDB

  1. Import the public key used by the package management system.
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
  1. Create a list file for MongoDB.
@sumonst21
sumonst21 / image-proxy.conf
Created December 7, 2019 17:26 — forked from tmaiaroto/image-proxy.conf
Nginx Image Filter Resize Proxy Service
# Feel free to change this path of course (and keys_zone value as well, but also change the usage of it below).
proxy_cache_path /var/www/cache/resized levels=1:2 keys_zone=resizedimages:10m max_size=1G;
# Gzip was on in another conf file of mine...You may need to uncomment the next line.
#gzip on;
gzip_disable msie6;
gzip_static on;
gzip_comp_level 4;
gzip_proxied any;
# Again, be careful that you aren't overwriting some other setting from another config's http {} section.
@sumonst21
sumonst21 / ffmpeg_mkv_mp4_conversion.md
Created December 8, 2019 21:48 — forked from jamesmacwhite/ffmpeg_mkv_mp4_conversion.md
Easy way to convert MKV to MP4 with ffmpeg

Converting mkv to mp4 with ffmpeg

Essentially just copy the existing video and audio stream as is into a new container, no funny business!

The easiest way to "convert" MKV to MP4, is to copy the existing video and audio streams and place them into a new container. This avoids any encoding task and hence no quality will be lost, it is also a fairly quick process and requires very little CPU power. The main factor is disk read/write speed.

With ffmpeg this can be achieved with -c copy. Older examples may use -vcodec copy -acodec copy which does the same thing.

These examples assume ffmpeg is in your PATH. If not just substitute with the full path to your ffmpeg binary.

Single file conversion example