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 / 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\./, ''),

So you deleted a private key file and have no backup?

It happened to me in my first IT job. I was told to rm a couple of outdated keyfiles. Of course they weren't named in a human readable manner. And of course I tab-completed to the wrong directory...

AAAAAAAAAAAAHHHH!!!

Of course, there was no such thing as "undelete" on the linux-box in question.

@shakahl
shakahl / zip.ps1
Created January 29, 2024 07:34 — forked from Araxeus/zip.ps1
Powershell script to zip files while preserving folder structure - includes lots of optional parameters like: file sync, exclude files, zip overwrite, custom FilterScript, automatic zip name from json, and more
#!/usr/bin/env pwsh
#Requires -Version 7
# Specifying no parameter will result in current working directory ($pwd) being archived into $pwd\$pwd.zip
param (
# The following paths can be relative or absolute:
# path to folder/s containing the files to be archived
[Alias("i","input","from")][string[]][ValidateScript({ Test-Path -LiteralPath $_ })] $FolderPaths = @($PWD),
# path to zipfile / zipFolder if $ZipNameFromJson is specified (will be created if it doesn't exist)
[Alias("t","to","output")][string] $ZipPath = "", # defaults to $PWD.zip