Skip to content

Instantly share code, notes, and snippets.

@1mursaleen
1mursaleen / gist:1ea3b947210bf9ee0b807d380c2bb055
Created March 20, 2024 10:53
Better Changelog Generation Command
git log --pretty=format:"- %s" dd5baf97...HEAD > changelog.txt
git log --since="2023-03-01" --pretty=format:"- %s%n%b%n" > changelog.txt
git log --since="2024-03-01" --date=short --pretty=format:"%ad%n- %s%n%b%n" > changelog.txt
git log --since="2024-03-01" --date=short --pretty=format:"---%ad%n- %s%b" | awk '/^-/{if (NR>1) print ""; print; next} 1' > changelog.txt
@1mursaleen
1mursaleen / openai_dalle_generator.py
Last active January 17, 2024 10:51
OpenAI DALL-E Image Generator Script: Dynamic Model Selection, Custom Prompts, and Image Download
"""
Usage Guidelines and Command Line Arguments:
This script generates images using OpenAI's DALL-E model based on a given prompt.
To use this script, provide the model version (dall-e-2 or dall-e-3), the prompt for the image,
and optionally the size, quality, number of images, and a flag to download the images.
1. model: The version of DALL-E model to use.
- Possible values: 'dall-e-2', 'dall-e-3'
- Example: --model dall-e-2
@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.
@1mursaleen
1mursaleen / gist:79fd8c76a9ad997f47f56af276e02cc0
Created October 15, 2023 12:16
Valet Composer Global Commands not working on Mac
export PATH="$PATH:$HOME/.composer/vendor/bin"
@1mursaleen
1mursaleen / Fixing Valet Permission Errors.md
Last active August 14, 2023 18:00
Fixing Valet Permission Errors

Issue:

When encountering the following errors:

Warning: file_get_contents(/var/root/.valet/config.json): failed to open stream: Permission denied in /Users/Username/.composer/vendor/laravel/valet/server.php on line 23

Warning: Invalid argument supplied for foreach() in /Users/Username/.composer/vendor/laravel/valet/server.php on line 47
404 - Not Found
@1mursaleen
1mursaleen / RetryHelper.ts
Last active February 23, 2023 12:18
TypeScipt Recurring Retry Function - with Exponential Backoff - for Synchronous & Asynchronous Functions
import randomString from "./randomString";
import Sleep from "./Sleep";
interface IRetryHelperOptions {
retries?: number;
retryIntervalMs?: number;
backoffIteration?: number;
trialID?: string | undefined;
exponentialBackoff?: boolean;
logs?: boolean;
@1mursaleen
1mursaleen / readme.md
Created December 18, 2022 08:07
Copying a Github repository in from one account to another (Mirroring)

If you want to mirror a repository in another location, including getting updates from the original, you can clone a mirror and periodically push the changes.

Open Git Bash.

Create a bare mirrored clone of the repository.

$ git clone --mirror https://github.com/EXAMPLE-USER/REPOSITORY-TO-MIRROR.git Set the push location to your mirror.

$ cd REPOSITORY-TO-MIRROR

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 / wireguard.conf
Created April 15, 2022 07:44 — forked from nealfennimore/wireguard.conf
Wireguard VPN - Forward all traffic to server
# ------------------------------------------------
# Config files are located in /etc/wireguard/wg0
# ------------------------------------------------
# ---------- Server Config ----------
[Interface]
Address = 10.10.0.1/24 # IPV4 CIDR
Address = fd86:ea04:1111::1/64 # IPV6 CIDR
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE # Add forwarding when VPN is started
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; ip6tables -D FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE # Remove forwarding when VPN is shutdown