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 / 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

@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
@1mursaleen
1mursaleen / multiple_ssh_setting.md
Created April 1, 2022 16:03 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@1mursaleen
1mursaleen / gist:752e685d64bd6836cdfa3d25177d0f74
Created October 26, 2021 09:57 — forked from solenoid/gist:1372386
javascript ObjectId generator
var mongoObjectId = function () {
var timestamp = (new Date().getTime() / 1000 | 0).toString(16);
return timestamp + 'xxxxxxxxxxxxxxxx'.replace(/[x]/g, function() {
return (Math.random() * 16 | 0).toString(16);
}).toLowerCase();
};