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

@shakahl
shakahl / Encrypt-Decrypt-WithDotNet.ps1
Created April 1, 2024 17:13 — forked from PanosGreg/Encrypt-Decrypt-WithDotNet.ps1
Encryption & Decryption using native .NET classes
## Encryption & Decryption using native .NET functions
## This is Symetrical encryption. Which means the same key is used to both encrypt and decrypt.
## The encryption method is based on AES 256bit.
## The major difference between this option and the ConvertFrom/To-SecureString functions
## is that this way produces much smaller encrypted files.
## I have not compared the 2 options in regards to performance though, as-in which one is faster.
@shakahl
shakahl / emojis.sh
Created March 27, 2024 20:56 — forked from BuonOmo/emojis.sh
A list of all UTF-8 emojis in bash or zsh
# Obtained with the code written in next file
emoji_grinning_face=😀
emoji_grinning_face_with_big_eyes=😃
emoji_grinning_face_with_smiling_eyes=😄
emoji_beaming_face_with_smiling_eyes=😁
emoji_grinning_squinting_face=😆
emoji_grinning_face_with_sweat=😅
emoji_rolling_on_the_floor_laughing=🤣
emoji_face_with_tears_of_joy=😂
emoji_slightly_smiling_face=🙂
@shakahl
shakahl / apktool.bat
Created March 6, 2024 21:48 — forked from barbietunnie/apktool.bat
Windows/Mac wrapper script for Apktool
@echo off
if "%PATH_BASE%" == "" set PATH_BASE=%PATH%
set PATH=%CD%;%PATH_BASE%;
java -jar -Duser.language=en "%~dp0\apktool.jar" %1 %2 %3 %4 %5 %6 %7 %8 %9
@shakahl
shakahl / stack.sh
Created March 5, 2024 13:43 — forked from bmc/stack.sh
A stack implementation, in bash
# A stack, using bash arrays.
# ---------------------------------------------------------------------------
# Create a new stack.
#
# Usage: stack_new name
#
# Example: stack_new x
function stack_new
{
@shakahl
shakahl / queryAll.js
Created March 3, 2024 15:45 — forked from dalgard/queryAll.js
Efficient wrapper for document.querySelectorAll
// Always return an array of DOM elements
function queryAll(selector) {
var id_sel = selector.match(/^#([\w-]*)$/),
class_sel = !id_sel && selector.match(/^\.([\w-]+)$/),
tag_sel = !class_sel && selector.match(/^[\w-]+$/);
if (id_sel) {
var elem = document.getElementById(id_sel[1]);
return (elem ? [elem] : []); // Always return an array
}
@shakahl
shakahl / adjectives.txt
Created February 1, 2024 19:03 — forked from ysbaddaden/adjectives.txt
Generate Ubuntu-like release names
abandoned
able
absolute
adorable
adventurous
academic
acceptable
acclaimed
accomplished
accurate
@shakahl
shakahl / proxyTrack.js
Created January 30, 2024 22:30 — forked from mrharel/proxyTrack.js
Using Proxy to Track Javascript Class
const callerMap = {};
function getCaller(error) {
if (error && error.stack) {
const lines = error.stack.split('\n');
if (lines.length > 2) {
let match = lines[2].match(/at ([a-zA-Z\-_$.]+) (.*)/);
if (match) {
return {
name: match[1].replace(/^Proxy\./, ''),