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 / 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
@shakahl
shakahl / README.md
Created January 28, 2024 13:58 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@shakahl
shakahl / jscrush-compress-pseudo.js
Created January 24, 2024 12:30 — forked from nikhilm/jscrush-compress-pseudo.js
JSCrush 'reverse engineering'
segmentLengthBound = ... // B, originally set to s.length/2
counter = {} // o
bestSavings = 0 // M
maxRepetitions = 0 // N
bestSegment = 0 // e
longestSegmentLength = 0 // Z
segmentLength = 0 // t
while (segmentLength <= segmentLengthBound) {
start = 1;
@shakahl
shakahl / jq-cheetsheet.md
Created January 22, 2024 21:07 — forked from olih/jq-cheetsheet.md
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@shakahl
shakahl / Dockerfile
Created January 18, 2024 03:07 — forked from TijmenWierenga/Dockerfile
PHP Apache Dockerfile
#syntax=docker/dockerfile:experimental
# Use official composer library to move the composer binary to the PHP container
FROM composer:1.9 AS composer
FROM php:7.4-apache
LABEL maintainer="t.wierenga@live.nl"
RUN apt update -y
@shakahl
shakahl / Compress string.js
Created January 17, 2024 07:22 — forked from Explosion-Scratch/Compress string.js
Compress string using gzip and native browser APIs
function compress(string, encoding) {
const byteArray = new TextEncoder().encode(string);
const cs = new CompressionStream(encoding);
const writer = cs.writable.getWriter();
writer.write(byteArray);
writer.close();
return new Response(cs.readable).arrayBuffer();
}
function decompress(byteArray, encoding) {
@shakahl
shakahl / bump-version.sh
Created January 15, 2024 03:16 — forked from dbernheisel/bump-version.sh
Bash script to bump the version
#!/bin/bash
# Works with a file called VERSION in the current directory,
# the contents of which should be a semantic version number
# such as "1.2.3"
# this script will display the current version, automatically
# suggest a "minor" version update, and ask for input to use
# the suggestion, or use a newly entered value.
@shakahl
shakahl / bump-version.sh
Created January 15, 2024 02:49 — forked from jv-k/bump-version.sh
This script automates bumping the git software project's version using automation ⚠️ For an updated version, please see https://github.com/jv-k/ver-bump — a CLI module you can use with your projects ⚠️
#!/bin/bash
#
# █▄▄ █░█ █▀▄▀█ █▀█ ▄▄ █░█ █▀▀ █▀█ █▀ █ █▀█ █▄░█
# █▄█ █▄█ █░▀░█ █▀▀ ░░ ▀▄▀ ██▄ █▀▄ ▄█ █ █▄█ █░▀█
#
# Description:
# - This script automates bumping the git software project's version using automation.
# - It does several things that are typically required for releasing a Git repository, like git tagging,
# automatic updating of CHANGELOG.md, and incrementing the version number in various JSON files.