Skip to content

Instantly share code, notes, and snippets.

View VadimDor's full-sized avatar
🐕
working for a bone

Vadim Dor VadimDor

🐕
working for a bone
View GitHub Profile
@VadimDor
VadimDor / detect-jpeg-png-svg.md
Last active February 3, 2024 11:31
Bash script to detect image format of file 😎

Bash script to detect image format of (blind downloaded) file

declare -A signatures=( [JPEG]='^\xFF\xD8\xFF' [PNG]='^\x89PNG\x0D\x0A\x1A\x0A' [SVG]='^<svg' [GIF]='^GIF' [BMP]='^BM' [PSD]='^8BPS' [SWF]='^<FWS')

 for key in "${!signatures[@]}"
  do 
	echo "$key => ${signatures[$key]}"
	escaped="${signatures[$key]/[/\]/\\}"
@VadimDor
VadimDor / sendkey2remote.cmd
Created July 2, 2023 20:57
That script implements dedicated ed25519-key exchange for key based authentication from local Windows machine and remote macOS or Linux SSH host. For more info what is going on and for preparation steps see https://code.visualstudio.com/docs/remote/troubleshooting#_improving-your-security-with-a-dedicated-key
@echo off
setlocal
CALL :GETPARENT PARENT
IF /I "%PARENT%" == "powershell" GOTO :ISPOWERSHELL
IF /I "%PARENT%" == "pwsh" GOTO :ISPOWERSHELL
endlocal
echo This script must be run from Powershell console. Quitting...
echo. >&2
echo ERROR: This batch file must be run from a PowerShell prompt >&2
@VadimDor
VadimDor / brew.sh
Last active July 2, 2023 14:11
Installs brew on Debian. Testet on Debian 12
#!/bin/bash
# to use this execute in console
# sudo /bin/bash -c \
# "$(curl -fsSL https://gist.githubusercontent.com/VadimDor/083e6bb65079492e713fea17f20561ef/raw/xxx-hash-of-actial-version-xxx/brew.sh)"
# where xxx-hash-of-actial-version-xxx you can see here in raw view
# .---------- constant part!
# vvvv vvvv-- the code from above
@VadimDor
VadimDor / aboutme.geojson
Last active October 29, 2020 18:00
About Me
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@VadimDor
VadimDor / test.svg
Last active October 27, 2020 15:16
test highlight
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@VadimDor
VadimDor / letsencrypt-acme-cron.sh
Created October 27, 2020 13:49
Using acme.sh script to renew LetsEncrypt certs using cron jobs sending colorized html-emails on renewal or by errors
#!/bin/bash
# Intended to be set as cron job for LetsEncrypt certificate renew.
# Sends colorized html-emails on successful renewal or by errors
# Licence: LGPLv2
# Author:
# Vadim Dorezuk https://github.com/VadimDor/
# Usage: download, change emails parameters below, localize messages, enjoy
# Depends on:
@VadimDor
VadimDor / letsencrypt-acme-cron.md
Last active October 28, 2020 19:36
Using acme.sh script to renew LetsEncrypt certs using cron jobs sending colorized html-emails on renewal or by errors . See README below: "https://../#file-letsencrypt-acme-cron-sh"

1. Install acme.sh shell script

git clone https://github.com/Neilpang/acme.sh.git
cd acme.sh
./acme.sh --install
git clone https://github.com/Neilpang/acme.sh.git
cd acme.sh
./acme.sh --install
@VadimDor
VadimDor / main.coffee
Created September 17, 2017 23:16
somedesc
fs = require 'fs'
InputDialog = require '@aki77/atom-input-dialog'
untildify = require 'untildify'
{CompositeDisposable} = require 'atom'
{showError} = require './helper'
[GistListView, GistClient] = []
module.exports = AtomGist =
subscriptions: null
client: null
@VadimDor
VadimDor / callRemote.cmd
Last active August 6, 2017 18:36
DOS batch script for ATOM to bring RemoteFTP and Terminal packages together
@echo off
setlocal EnableDelayedExpansion EnableExtensions
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
set "DEL=%%a"
)
rem For coloring thanks to JFL
rem https://stackoverflow.com/questions/4339649/how-to-have-multiple-colors-in-a-windows-batch-file/5344911#5344911
rem Prepare a file ".colored" with only one dot for coloring