Skip to content

Instantly share code, notes, and snippets.

View StudioEtrange's full-sized avatar
💫

StudioEtrange StudioEtrange

💫
View GitHub Profile
@StudioEtrange
StudioEtrange / ssl_proxy_onion_demo.sh
Created October 21, 2021 01:11
open an ssl proxy over ssh and add N layer of ssh/ssl to communication between a client and a server
#! /bin/bash
# Credits : anonymous
# Ouvrir un proxy SSL sur le port ssh
# IE avoir X couche de cryptage ssl + ssh
# Cf NBSSL nombre de couche SSL
# Execute sans parametre = Usage
cd `dirname $0`
@StudioEtrange
StudioEtrange / -PDF manipulation tools
Last active April 15, 2024 23:32
various pdf manipulation tools and tips
various tips and tools for pdf
@StudioEtrange
StudioEtrange / launch_docker_airgeddon_remotely.sh
Created June 7, 2021 01:01
launch_docker_airgeddon_remotely.sh
# https://github.com/v1s1t0r1sh3r3/airgeddon
docker run --rm -ti --name airgeddon --net=host --privileged \
-v $HOME/air/io:/io -v $HOME/air/plugins:/opt/airgeddon/plugins \
-e DISPLAY=$(env | grep DISPLAY | awk -F "=" '{print $2}') \
-e AIRGEDDON_WINDOWS_HANDLING=tmux v1s1t0r1sh3r3/airgeddon
@StudioEtrange
StudioEtrange / synology_set_external_drive_as_internal.sh
Created April 3, 2021 20:05
synology_set_external_drive_as_internal
# https://www.casler.org/wordpress/synology-ssd-cache-on-external-devices/
echo "Current values"
more /etc.defaults/synoinfo.conf | grep maxdisk
more /etc.defaults/synoinfo.conf | grep usbportcfg
more /etc.defaults/synoinfo.conf | grep esataportcfg
more /etc.defaults/synoinfo.conf | grep internalportcfg
sudo sed -i.bak -e 's/maxdisks=\".*$/maxdisks=\"24\"/g' -e 's/usbportcfg=\".*$/usbportcfg=\"0x00\"/g' -e 's/esataportcfg=\".*$/esataportcfg=\"0x00\"/g' -e 's/internalportcfg=\".*$/internalportcfg=\"0xffffff\"/g' /etc.defaults/synoinfo.conf
echo "Updated values"
more /etc.defaults/synoinfo.conf | grep maxdisk
more /etc.defaults/synoinfo.conf | grep usbportcfg
@StudioEtrange
StudioEtrange / inline_file_as_string_heredoc.sh
Created January 28, 2021 02:22
inject file inline to command with heredoc
# https://stackoverflow.com/a/38731052
# variable substitution, leading tab retained, overwrite file, echo to stdout
tee /path/to/file <<EOF
${variable}
EOF
# no variable substitution, leading tab retained, overwrite file, echo to stdout
@StudioEtrange
StudioEtrange / show-cron-jobs.sh
Created January 28, 2021 02:20 — forked from myshkin-uk/show-cron-jobs.sh
A bash script to list all cron tasks on a computer.
#!/bin/bash
# This script is designed to work only with recent bash implementations, not ash/dash etc.
# @file show-cron-jobs.sh
#
# published at:
# https://gist.github.com/myshkin-uk/d667116d3e2d689f23f18f6cd3c71107
#
# @NOTE DGC 2-Sep-2019
# There is one comment there that the script doesn't run as expected.
@StudioEtrange
StudioEtrange / count_all_crontab.sh
Created January 27, 2021 19:16
count number of active task inside of all user crontab
# count number of active task inside of all user crontab
# sample with excluding a string containing "str"
for c in $(sudo ls /var/spool/cron); do sudo crontab -u $c -l 2>/dev/null | grep -v -e '^$' | grep -v -e '^#' | grep -v "crontab;" | grep -v "str"; done | wc -l
# launch a shell with an empty env
# https://unix.stackexchange.com/a/291913
env -i bash --noprofile --norc
# source var file and show a specific var
env -i bash --noprofile --norc -c ". somefile.sh; echo $VAR;"
# backup/restore env
# https://unix.stackexchange.com/questions/284382/export-save-and-import-source-shell-variables
@StudioEtrange
StudioEtrange / docker-compose-traefik-route-to-url.yml
Last active January 31, 2022 17:11
traefik sample for route to an external URL - add a blog.mondomain.com route to http://blog:4000
traefik:
image: traefik:v2.1.6
container_name: traefik
volumes:
- "traefik.enable=true"
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./traefik-conf.yml:/etc/traefik/traefik.yml
- ./traefik-services.yml:/etc/traefik/services.yml
labels:
- "traefik.http.routers.blog.entrypoints=web_main"
@StudioEtrange
StudioEtrange / bash_debug_time.sh
Last active January 24, 2020 04:51
Debug execution time of bash script
# Solutions from https://stackoverflow.com/a/20855353
# SOLUTION 1 : analyse at the current level of execution (do not step into code)
# get https://www.f-hauri.ch/vrac/cours_truc-et-astuces_2012-04-03/add/elap.bash-v2