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
@oseme-techguy
oseme-techguy / Correct_GnuPG_Permission.sh
Last active February 6, 2025 05:53
This fixes the " gpg: WARNING: unsafe permissions on homedir '/home/path/to/user/.gnupg' " error while using Gnupg .
#!/usr/bin/env bash
# To fix the " gpg: WARNING: unsafe permissions on homedir '/home/path/to/user/.gnupg' " error
# Make sure that the .gnupg directory and its contents is accessibile by your user.
chown -R $(whoami) ~/.gnupg/
# Also correct the permissions and access rights on the directory
chmod 600 ~/.gnupg/*
chmod 700 ~/.gnupg
@dac514
dac514 / EventEmitter.php
Last active November 4, 2022 19:52
Refactor Your Slow Form Using PHP Generators and Event Streams
<?php
/**
* @license GPLv3 (or any later version)
* @see http://kizu514.com/blog/refactor-your-slow-form-using-php-generators-and-event-streams/
*/
namespace KIZU514;
class EventEmitter
{
@onetdev
onetdev / example.html
Last active December 12, 2022 19:15
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}";
@aprilmintacpineda
aprilmintacpineda / Using Multiple SSH keys - Beginner Friendly.md
Last active March 21, 2025 11:13
Beginner Friendly: Using Multiple SSH keys

How to follow this guide

The problem

I have one computer and two different github accounts. One is for work, the other is for my personal stuff. I can't use the same ssh key twice, so I have to use different ssh key for each of my accounts. How do I do that? How do I switch between these ssh keys?

@mrbar42
mrbar42 / README.md
Last active March 14, 2025 21:14
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
  • Make it exeicutable like: chmod u+x rsync.sh later you have to make chmod u+x .rsyncconfig and chmod u+x .rsyncignore
  • ./rsync.sh init
  • Do you have password less alias host? (Y/n): means if you use passwordless login like: ssh example.com were example.com is your alias hostname on ~/.ssh/config file.
  • ~/.ssh/config file example:
Host example.com
    HostName 12.12.12.12 # Your VPS IP Address
    User root
 Port 22
@diegoparrilla
diegoparrilla / cloudflare-workers-apilityio.js
Last active April 19, 2023 12:20
Using Cloudflare Workers and https://Apility.io API add to the request headers information of the blacklists of abusers that contains the IP address of the client.
addEventListener('fetch', event => {
event.respondWith(fetchAndCheckOrigin(event.request))
})
async function fetchAndCheckOrigin(req) {
try {
startTime = new Date();
const body = await req.body;
const ip = req.headers.get('cf-connecting-ip');
const es = req.headers.get('cf-ipcountry');
@MatteoOreficeIT
MatteoOreficeIT / LaravelQueryJoinRelations.php
Last active October 14, 2023 08:45
Laravel Query Join through Relations
<?php
/**
* User: matteo.orefice
* Date: 16/02/2018
* Time: 16:57
*/
namespace MatteoOrefice\Illuminate\Database\Eloquent\Concerns;
@maion11
maion11 / WC_Variable_Product_Price_Range
Created January 18, 2018 05:38
Changing WooCommerce Variable Products Price Range
function wc_varb_price_range( $wcv_price, $product ) {
$prefix = sprintf('%s: ', __('From', 'wcvp_range'));
$wcv_reg_min_price = $product->get_variation_regular_price( 'min', true );
$wcv_min_sale_price = $product->get_variation_sale_price( 'min', true );
$wcv_max_price = $product->get_variation_price( 'max', true );
$wcv_min_price = $product->get_variation_price( 'min', true );
$wcv_price = ( $wcv_min_sale_price == $wcv_reg_min_price ) ?
@tobiashm
tobiashm / README.md
Last active August 30, 2024 11:58
Setting up local domain for Docker

Example for setting up <whatever>.docker as a local domain (for Docker services)

What to do:

  • Install dnsmasq for resolving hostnames
  • Configure dnsmasq to resolve .docker requests to localhost
  • Configure macOS to send .docker requests to dnsmasq
brew install dnsmasq
# Create config files