Skip to content

Instantly share code, notes, and snippets.

@1mursaleen
1mursaleen / nginx.conf
Created September 23, 2021 06:56 — forked from v0lkan/nginx.conf
Configuring NGINX for Maximum Throughput Under High Concurrency
user web;
# One worker process per CPU core.
worker_processes 8;
# Also set
# /etc/security/limits.conf
# web soft nofile 65535
# web hard nofile 65535
# /etc/default/nginx
@1mursaleen
1mursaleen / Multi Auth
Last active August 20, 2021 16:46
Laravel Multi-Auth, Multi SPA.
if you don't understand multi auth, reach out.
@1mursaleen
1mursaleen / signature.php
Created May 17, 2021 11:11 — forked from joshuawoodward/signature.php
How to generate a signature for zoom in PHP
/**
* Generate signature for ZoomMtg JSSDK.
*
* @param string $api_key You REST API Key
* @param string $api_secret You REST API Secret
* @param int $meeting_number The meeting number you are creating the signature for
* @param int $role Role that this signature is for; 0 for participant, 1 for host
*
* @return string Returns the signature string
*
Since 2013 a video format much better than H.264 is widely available, namely H.265 (better in that it compresses more for the same quality, or gives higher quality for the same size). To use it, replace the libx264 codec with libx265, and push the compression lever further by increasing the CRF value — add, say, 4 or 6, since a reasonable range for H.265 may be 24 to 30. Note that lower CRF values correspond to higher bitrates, and hence produce higher quality videos.
ffmpeg -i input.mp4 -vcodec libx265 -crf 28 output.mp4
To see this technique applied using the older H.264 format, see this answer, quoted below for convenience:
Calculate the bitrate you need by dividing your target size (in bits) by the video length (in seconds). For example for a target size of 1 GB (one gigabyte, which is 8 gigabits) and 10 000 seconds of video (2 h 46 min 40 s), use a bitrate of 800 000 bit/s (800 kbit/s):
ffmpeg -i input.mp4 -b 800k output.mp4
@1mursaleen
1mursaleen / gif2mp4.sh
Created December 5, 2020 18:59 — forked from csabapalfi/gif2mp4.sh
Convert gif to mp4
ffmpeg -f gif -i infile.gif outfile.mp4
const { setContext } = require('apollo-link-context');
const { HttpLink } = require('apollo-link-http');
const { introspectSchema, makeRemoteExecutableSchema } = require('graphql-tools');
const fetch = require('node-fetch');
module.exports = function(api) {
api.createSchema(async function(graphql) {
const http = new HttpLink({
uri: 'http://example.com/api',
fetch
@1mursaleen
1mursaleen / adonisjs_postgres_multiple_row_update_with_different_values_in_a_single_query.js
Last active April 5, 2020 17:27
AdonisJS Postgres - Multiple Row Update with Different Values in a Single Query
taken from: https://forum.adonisjs.com/t/bulk-update-lucid-model/2505/2
const placeholders = []
const values = []
for (const pickup of pickups) {
placeholders.push('(?,?)')
values.push(pickup.id)
values.push(pickup.city)
}
@1mursaleen
1mursaleen / laravel laravel-echo laravel-echo-server private channel authentication problems
Last active December 12, 2023 12:25
Common Problems faced while setting up private channels with laravel-echo & laravel-echo-server.
I'll start with the basics and proceed to addressing the common problems
faced while setting up private channels with laravel-echo & laravel-echo-server.
If you are getting these errors while setup; 401, 403, 419 etc, as I did in my experience.
this gist will help you fix these errors.
Although this gist addresses common problems of laravel-echo-server setup, some problems are similar with Pusher setup.
So it might also be useful if you're having problems with setting up Pusher with Echo.
I'll try to cover eveything and try to use appropriate highlighting to single out each common problem.
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Storage;