Skip to content

Instantly share code, notes, and snippets.

View hasinhayder's full-sized avatar
🚀
Back on track, yayyyy!

Hasin Hayder hasinhayder

🚀
Back on track, yayyyy!
View GitHub Profile
@hasinhayder
hasinhayder / toUTF8Array.js
Created April 11, 2021 19:23 — forked from joni/toUTF8Array.js
toUTF8Array: Javascript function for encoding a string in UTF8.
function toUTF8Array(str) {
var utf8 = [];
for (var i=0; i < str.length; i++) {
var charcode = str.charCodeAt(i);
if (charcode < 0x80) utf8.push(charcode);
else if (charcode < 0x800) {
utf8.push(0xc0 | (charcode >> 6),
0x80 | (charcode & 0x3f));
}
else if (charcode < 0xd800 || charcode >= 0xe000) {
@hasinhayder
hasinhayder / README.md
Created April 8, 2021 18:15 — forked from mrbar42/README.md
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
@hasinhayder
hasinhayder / README.md
Created April 8, 2021 00:55 — forked from mrbar42/README.md
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
@hasinhayder
hasinhayder / example.html
Created April 8, 2021 00:48 — forked from onetdev/example.html
VideoJS + XHR mod : Adding XHR interceptor
<link media="all" rel="stylesheet" href="https://unpkg.com/[email protected]/dist/video-js.css">
<script src="https://unpkg.com/[email protected]/dist/video.js"></script>
<video-js id="player">
<source src="//video/index.m3u8" type="application/x-mpegURL" />
</video-js>
<script>
var player = videojs("player");
var prefix = "key://";
var urlTpl = "https://domain.com/path/{key}";
@hasinhayder
hasinhayder / DNS_TO_LOCALHOST.markdown
Created February 10, 2021 20:52 — forked from tinogomes/DNS_TO_LOCALHOST.markdown
Public DNS Pointing To localhost (127.0.0.1)

Available Wildcarded DNS Domains

It turns out that some kind hearted people already set up wildcarded domains for you already. You can use any domain below and/or any subdomain of these and they will always resolve back to 127.0.0.1 (your local machine). Here's the list of ones I know about. Let me know if there are more!

  • localhost - It will always works. Do you know why? I hope so.
  • [*.]fuf.me - Managed by @fidian; it will always point to localhost for IPv4 and IPv6
  • [*.]localtest.me
  • [*.]127-0-0-1.org.uk
  • [*.]vcap.me
  • [*.]yoogle.com
@hasinhayder
hasinhayder / elementor-assign-category-snippet.php
Created December 13, 2020 09:13 — forked from obiPlabon/elementor-assign-category-snippet.php
Asssign any elementor widget to a different category
<?php
/**
* Asssign any elementor widget to a different category
*
* To override the existing category just pass [ 'your-custom-category' ]
* And to keep existing [ 'your-custom-category', 'basic' ]
* here 'your-custom-category' is any registered category slug
*
* @param array $config
@hasinhayder
hasinhayder / elementor-disable-all-wp-widgets.php
Created December 12, 2020 18:24 — forked from obiPlabon/elementor-disable-all-wp-widgets.php
Disable or remove elementor widget from editor panel
<?php
/**
* Disable elementor registered widget.
*
* This will disable all WordPress native widgets
*
* @param \Elementor\Widgets_Manager $widgets_manager Instance of elementor widgets manager
*
* @author obiPlabon <https://obiPlabon.im>
*
@hasinhayder
hasinhayder / solution.js
Last active October 6, 2020 18:27
Extracting data and flattening it from a multi dimensional array
//data source = https://gist.github.com/hasinhayder/7352ac2d76660862061ffdd0d963711e
const videos = course.data.chapters
.map((chapter) => chapter.episodes.map((episode) => episode.vid))
.flat()
//Another solution (By Shadman Shadab)
const videos = course.data.chapters
.flatMap((chapter) => chapter.episodes.map((episode) => episode.vid))
@hasinhayder
hasinhayder / VirtualHost.conf
Created June 6, 2020 19:32
Apache Header Cache Control
<VirtualHost *:80>
DocumentRoot (Your root folder here)
ServerName (ServerName Details Here)
..
<FilesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|svg)$">
Header set Cache-Control "max-age=31536000, public"
</FilesMatch>
..
</VirtualHost>
@hasinhayder
hasinhayder / .htaccess
Last active January 4, 2023 10:36
Apache Deflate
<ifmodule mod_deflate.c>
#DeflateCompressionLevel 9
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf