Skip to content

Instantly share code, notes, and snippets.

Avatar

Gergely Nagy gnanet

  • Self-Employed Freelancer
  • Hungary
  • Twitter @gnanet
View GitHub Profile
@gnanet
gnanet / pb_client.sh
Created December 31, 2021 02:45
PushBullet API basic client for BASH
View pb_client.sh
#!/bin/bash
#
# PushBullet API basic client for BASH
#
# needs some packages to run (available Debian Jessie and up)
# apt -y install jq jshon curl
#
pbapi="" # PushBullet API token
@gnanet
gnanet / fix_le_root_x1_x3.sh
Last active October 6, 2021 00:13
Check if updated and self-signed ISRG Root X1 cert is present, then remove DST Root CA X3 from trusted CA-s, lastly update combined ca-certificates.pem on Debian
View fix_le_root_x1_x3.sh
#!/bin/bash
#
# Check if updated and self-signed ISRG Root X1 cert is present
# then remove DST_Root_CA_X3 from trusted CA-s
# lastly update combined ca-certificates.pem
#
if [ -f /usr/share/ca-certificates/mozilla/ISRG_Root_X1.crt ]; then
check_self_x1=$(openssl x509 -noout -text -in /usr/share/ca-certificates/mozilla/ISRG_Root_X1.crt | grep Issuer | grep -E "CN\s*=\s*ISRG Root X1")
@gnanet
gnanet / check_x3_or_x1.sh
Last active October 6, 2021 02:02
Check if DST Root CA X3 or self-signed ISRG Root X1 cert is present in servers chain
View check_x3_or_x1.sh
# one-liner to check if the server-provided certificates include the self-signed ISRG Root X1, or not. Just declare the hostname you want to check
export hostname2check=""; export port2check="443"; check_self_x1=$(openssl s_client -CApath /etc/ssl/certs -servername "${hostname2check}" -connect "${hostname2check}:${port2check}" 2>&1 </dev/null | grep -E -A1 "s:.*CN\s*=\s*ISRG Root X1$" | grep -E "i:.*CN\s*=\s*ISRG Root X1$"); if [[ "x${check_self_x1}" == "x" ]]; then echo "You need to fix your intermediate chain, to present the self-signed X1"; else echo "GOOD, you already have the self-signed X1 in the intermediate chain"; fi; unset hostname2check; unset port2check
@gnanet
gnanet / check_viber_deb.sh
Created December 13, 2019 02:07
Check if an update to viber.deb may be available, and automatically download latest viber.deb from viber.com
View check_viber_deb.sh
#!/bin/bash
#
# check_viber_deb.sh - Gergely Nagy (https://github.com/gnanet) 2019
#
# This script is intended to check if an update to viber.deb may be available,
# and automatically download latest viber.deb from viber.com
#
# You should run this script from cron
#
@gnanet
gnanet / pleskCommands.sh
Created October 22, 2019 23:43 — forked from AlexPashley/pleskCommands.sh
PLESK: Useful PLESK common commands
View pleskCommands.sh
# USEFUL PLESK COMMANDS
# restart plesk
/etc/init.d/psa restart
# reload plesk configs (useful for vhost.conf)
/usr/local/psa/admin/sbin/websrvmng -a -v
# restart qmail
service qmail restart
@gnanet
gnanet / add-sury_org_php-repo.sh
Created August 23, 2019 23:35
This script adds the apt-repository for PHP 5.6.x packages, created by Ondřej Surý
View add-sury_org_php-repo.sh
#!/bin/bash
#
# Original script source: https://packages.sury.org/php/README.txt
#
# This script adds the apt-repository for PHP 5.6.x packages, created by Ondřej Surý
# The script should work both on Debian and Ubuntu
# Extra check added, to make sure a "Release" file is available for the specific codename, before it is added.
if [ "$(whoami)" != "root" ]; then
SUDO=sudo
@gnanet
gnanet / yt-dl-audio.sh
Created June 1, 2019 02:03
Audió letöltése youtube-ról a youtube-dl segítségvel
View yt-dl-audio.sh
#!/bin/bash
# -F, --list-formats List all available formats of requested videos
# -f, --format FORMAT Video format code, see the "FORMAT SELECTION" for all the info: https://github.com/ytdl-org/youtube-dl/blob/master/README.md#format-selection
# You can also use special names to select particular edge case formats:
# - bestaudio: Select the best quality audio only-format. May not be available.
# - best: Select the best quality format represented by a single file with video and audio.
# Since the end of April 2015 and version 2015.04.26, youtube-dl uses -f bestvideo+bestaudio/best as the default format selection.
# -x, --extract-audio Convert video files to audio-only files (requires ffmpeg or avconv and ffprobe or avprobe)
# --audio-format FORMAT Specify audio format: "best", "aac", "flac", "mp3", "m4a", "opus", "vorbis", or "wa
@gnanet
gnanet / decrypt-sym-pass-plesk.php
Created May 5, 2019 03:37
Decrypt symmetric encrypted passwords of plesk stored in "psa" database in table "accounts"
View decrypt-sym-pass-plesk.php
#!/usr/bin/php
<?php
/*
* Decrypt symmetric encrypted passwords of plesk stored in "psa" database in table "accounts"
* Script has to be run on the plesk server locally
*
* /usr/local/sbin/decrypt-sym
*
*/
@gnanet
gnanet / offlineimaprc.py
Created March 26, 2019 03:18
offlineimap nametrans example to put everything in a INBOX. subfolder except for INBOX, or any folder that starts with "INBOX" already
View offlineimaprc.py
# Put everything in a INBOX. subfolder except for INBOX, or any folder that starts with "INBOX" already, also translate some common hungarian foldernames
[Repository Remote-X]
type = IMAP
remotehost = Z
ssl =
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
remoteuser = X
remotepass = P
createfolders = False
readonly = True
@gnanet
gnanet / stretch-acmetool-nginx-postfix-dovecot.md
Last active November 1, 2018 00:56
Let's Encrypt on debian stretch with nginx and SMTP POP3 IMAP with acmetool
View stretch-acmetool-nginx-postfix-dovecot.md