Skip to content

Instantly share code, notes, and snippets.

@santaklouse
santaklouse / imgcat
Created March 27, 2020 00:09
Imgcat (render images in console)
#!/bin/bash
# tmux requires unrecognized OSC sequences to be wrapped with DCS tmux;
# <sequence> ST, and for all ESCs in <sequence> to be replaced with ESC ESC. It
# only accepts ESC backslash for ST. We use TERM instead of TMUX because TERM
# gets passed through ssh.
function print_osc() {
if [[ $TERM == screen* ]] ; then
printf "\033Ptmux;\033\033]"
else
@santaklouse
santaklouse / README.md
Last active November 7, 2020 01:03
MTProxy on PwD

TG MTProxy on Play with Docker:

run MTProxy

docker run --name 'mtproto_proxy' --restart unless-stopped -p 1984:1984 -dti dotcypress/mtproxy -s '`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`'

get secret

@santaklouse
santaklouse / README.md
Last active November 12, 2020 16:18
Encryption and ERFS

Encryption


Using openssl private/public keys

generate a 2048-bit RSA key and store it in key.txt

openssl genrsa -out key.txt 2048

encrypt "hello world" using the RSA key in key.txt

echo "hello world" | openssl rsautl -inkey key.txt -encrypt >output.bin

decrypt the message and output to stdout

@santaklouse
santaklouse / urlShortener.js
Created December 2, 2020 13:56
tiny cc url
let getRandomInt = (min, max) => Math.floor(Math.random() * (Math.floor(max) - Math.ceil(min)) + Math.ceil(min));
let tinyCcUrl = (url, custom = '') => {
//need to get it on page
if (!localStorage.getItem('sig')) localStorage.setItem('sig', 'YmNhZGU3OTQ0YmMyNzE0ODBiNWFhZThhZGNjMmQ2ZDg2MjEwYWVlODJmYjQ0ODM3OWVmYzRkMDZiOWRhNTJmZDc3NThmMTcwZWUwNWE4MzhhNWJiOWZlNmRmNjAwMzcwZDJmZGMwZjQ4MDE1MDMzOWM4ZWEzMGI1OWFmYTU3MzU=');
url = encodeURI(url);
sig = encodeURI(localStorage.getItem('sig'));
fetch("https://tiny.cc/tiny/url/create", {
"headers": {
@santaklouse
santaklouse / Makefile
Last active February 1, 2021 17:27
mem_infect
all:infect target
infect: infect.c
${CC} -o $@ $<
target: target.c
${CC} -o $@ $<
.PHONY:
clean:
@santaklouse
santaklouse / parseURLParameters.js
Last active February 9, 2021 16:56 — forked from pirate/parseURLParameters.js
Parse URL query parameters in ES6
const getUrlParams = search => {
let params = {};
search
.slice(search.indexOf('?') + 1)
.split('&')
.forEach(hash => {
const [key, val] = hash.split('=')
params[key] = val === void(0)
? true
: decodeURIComponent(val);
@santaklouse
santaklouse / README.md
Created March 18, 2021 17:30
Crontab job that's daily check disk usage and if free space if less than 10% - in my case do `echo '' > /root/logfile_storage/motion.log`

@daily sh -c "if [ $(df / --output='pcent' | grep -o [0-9][0-9]) -gt 90 ]; then echo '' > /root/logfile_storage/motion.log; fi

@santaklouse
santaklouse / index.js
Created March 22, 2021 18:30
Shuffles symbols in string
const shuffle = v=>[...v].sort(_=>Math.random()-.5).join('');
document.write(shuffle("The quick brown fox jumps over the lazy dog"));
@santaklouse
santaklouse / create-angular-nest-app.sh
Last active June 22, 2021 13:00
Creates Angular + Nest application and open link to app in browser (Linux version)
#!/usr/bin/env bash
sudo apt install -y nodejs
sudo npm i -g npm@latest
sudo npm i -g @angular/cli @nestjs/cli eslint nx npm-check-updates
sudo ncu -g
npx --yes create-nx-workspace@latest angular-nest-app --preset=angular-nest --appName=ui --style=scss --nx-cloud=false --cli=angular
cd angular-nest-app

Keybase proof

I hereby claim:

  • I am santaklouse on github.
  • I am santaklouse (https://keybase.io/santaklouse) on keybase.
  • I have a public key ASDhtMFOMATy8uhYzw2UIPuajMcZ-JbI-660JYFLSRl8Xgo

To claim this, I am signing this object: