Skip to content

Instantly share code, notes, and snippets.

View shakahl's full-sized avatar
:electron:

Soma Szelpal shakahl

:electron:
View GitHub Profile
@shakahl
shakahl / parseBool.js
Created July 1, 2024 00:12 — forked from guzmanfg/parseBool.js
Parse boolean values (accepts any truthy or falsy values)
function parseBool (value){
var isEmptyString = (typeof value === "string" && value.length <= 0);
var isFalsy = typeof value === "undefined" || isEmptyString;
return !isFalsy && !!JSON.parse(value);
};

Pre-requisite

  1. Laragon
  2. Multiple DB are ready to install (look table below)
  3. Unzip tools like 7zip or Winrar
  4. Laragon installation path default is C:\laragon\, might be different depending on where you install this. However we will focus on laragon mysql directory folder which located on C:\laragon\bin\mysql

If you look at Laragon documentation on multiple DB it should be straight forward however i would like to make it as painless as possible with the setup

By default Laragon (Full version) comes with MySQL 8.0.* version. However we will install latest or older version of MySQL show how we switch to one another using Laragon system tray mysql version switch feature.

@shakahl
shakahl / LICENSE.WTFPL
Created June 21, 2024 12:38
[License] WTFPL - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@shakahl
shakahl / Find-GitRepository.ps1
Created June 4, 2024 19:17 — forked from jdhitsolutions/Find-GitRepository.ps1
Use this PowerShell function to find Git repositories in the specified folder. It is assumed that you have the Git command line tools already installed.
Function Find-GitRepository {
<#
.SYNOPSIS
Find Git repositories
.DESCRIPTION
Use this command to find Git repositories in the specified folder. It is assumed that you have the Git command line tools already installed.
.PARAMETER Path
The top level path to search.
@shakahl
shakahl / range.js
Created May 29, 2024 01:31 — forked from DazzGranto/range.js
Range in JavaScript (Sequence generator)
// Sequence generator function (commonly referred to as "range", e.g. Clojure, PHP etc)
const range = (start, stop, step = 1) => Array.from({ length: (stop - start) / step + 1}, (_, i) => start + (i * step));
// Generate numbers range 0..4
range(0, 4);
// [0, 1, 2, 3, 4]
// Generate numbers range 1..10 with step of 2
range(1, 10, 2);
// [1, 3, 5, 7, 9]
@shakahl
shakahl / go_parse_error_key_value_context.go
Last active May 27, 2024 14:27
Go - function that parses key-value map context information from an error string
package main
import (
"errors"
"fmt"
"reflect"
"regexp"
"strings"
)
@shakahl
shakahl / go_version1_substitute_deep_nested_value.go
Last active May 28, 2024 05:38
Go - Substitute deep nested value in a string from a nested map
package main
import (
"errors"
"fmt"
"reflect"
"regexp"
"strings"
pkgerrors "github.com/pkg/errors"
@shakahl
shakahl / go_get_nested_value.go
Created May 27, 2024 11:47
Golang - Accessing a deep nested value from a map in Go
package main
import (
"errors"
"fmt"
)
func GetNestedValue(m map[string]any, keys ...string) (any, error) {
if len(keys) == 0 {
return nil, errors.New("no keys provided")
@shakahl
shakahl / portainer-docker-stack.yml
Created May 10, 2024 09:54
portainer-docker-stack.yml
---
# docker network create -d overlay --attachable public
# docker stack deploy portainer -c portainer-agent-stack.yml
version: '3.9'
x-default-opts:
&default-opts
logging:
@shakahl
shakahl / windows-ssh-no-password-with-keys-wsl2.md
Created April 23, 2024 21:02 — forked from adamelliotfields/windows-ssh-no-password-with-keys-wsl2.md
Windows SSH Server with Password-less Key Authentication and Default WSL2 Shell

Windows SSH Server with Password-less Key Authentication and Default WSL2 Shell

Disclaimer: I am not a Windows Admin and I'm not even that good with PowerShell.

I wanted to be able to SSH into my Windows laptop directly into Linux. I also wanted to disable password authentication and only allow public key (RSA in my case) authentication.

Scott Hanselman wrote a blog post on how to make your default WSL2 distro your default shell for SSH. Windows OS Hub published an article on using public key