Skip to content

Instantly share code, notes, and snippets.

View edihasaj's full-sized avatar
🐞
I write bugs that eventually turn into features

Edi Hasaj edihasaj

🐞
I write bugs that eventually turn into features
View GitHub Profile
@edihasaj
edihasaj / .htaccess
Created March 15, 2023 17:10 — forked from alexsasharegan/.htaccess
Apache Config for React Router
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]
@edihasaj
edihasaj / origin.ps1
Created January 28, 2023 10:46
Pull/Push different origin
# Set the new remote repository URL
$oldUrl = "https://github.com/your-git.git"
$newUrl = "https://target-git.git"
# Get the current directory
$currentDir = "C:\Users\where"
# Change directory to the .git folder
cd "$currentDir\.git"
using namespace System.Management.Automation
using namespace System.Management.Automation.Language
if ($host.Name -eq 'ConsoleHost')
{
Import-Module PSReadLine
}
#Import-Module PSColors
#Import-Module posh-git
Import-Module -Name Terminal-Icons
@edihasaj
edihasaj / ohmyposhv3-v2.json
Created January 22, 2023 14:44 — forked from shanselman/ohmyposhv3-v2.json
ohmyposhv3-v2
{
"final_space": true,
"console_title": true,
"console_title_style": "folder",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"horizontal_offset": 0,
"vertical_offset": 0,
@edihasaj
edihasaj / main.py
Last active December 19, 2022 10:39
Download or list s3 bucket custom url or custom hosting
import boto3
if __name__ == '__main__':
s3 = boto3.client(
's3',
aws_access_key_id='your key',
aws_secret_access_key='your password',
endpoint_url="https://s3.yourcustomdomain.com",
)
@edihasaj
edihasaj / React refresh 404 fix for PHP server
Created March 1, 2022 14:19
React refresh 404 fix for PHP server
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]
</IfModule>
@edihasaj
edihasaj / CompositeValidationResult.cs
Created January 9, 2022 19:30
C# Validate object recursively. Manual validation of property object.
public class CompositeValidationResult : ValidationResult
{
private readonly List<ValidationResult> _results = new();
public CompositeValidationResult(string errorMessage) : base(errorMessage)
{
}
public CompositeValidationResult(string errorMessage, IEnumerable<string> memberNames) : base(errorMessage,
memberNames)
@edihasaj
edihasaj / NotNullOrEmptyCollectionAttribute.cs
Created January 9, 2022 19:28
C# list not null or empty collection validation attribute
public class NotNullOrEmptyCollectionAttribute : ValidationAttribute
{
private readonly int _length;
public NotNullOrEmptyCollectionAttribute(int length)
{
_length = length;
}
public NotNullOrEmptyCollectionAttribute()
@edihasaj
edihasaj / connection.vbs
Created October 25, 2021 07:18
AnyConnect auto-connect
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run """%PROGRAMFILES(x86)%\Cisco\Cisco AnyConnect Secure Mobility Client\vpnui.exe"""
WScript.Sleep 2000
WshShell.AppActivate "Cisco AnyConnect Secure Mobility Client"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"