Skip to content

Instantly share code, notes, and snippets.

Avatar

Gergely Nagy gnanet

  • Self-Employed Freelancer
  • Hungary
  • @gnanet
View GitHub Profile
@gnanet
gnanet / check_viber_deb.sh
Created Dec 13, 2019
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 Oct 22, 2019 — 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 Aug 23, 2019
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 Jun 1, 2019
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
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 Mar 26, 2019
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 Nov 1, 2018
Let's Encrypt on debian stretch with nginx and SMTP POP3 IMAP with acmetool
View stretch-acmetool-nginx-postfix-dovecot.md

How to install acmetool with stretch

https://github.com/hlandau/acme/releases

How to do it

Follow instructions, but dont simply copy them:

# Download a **non_cgo** tar.gz into /usr/local/
$ cd /usr/local
$ wget https://github.com/hlandau/acme/releases/download/v0.0.67/acmetool-v0.0.67-linux_amd64.tar.gz
@gnanet
gnanet / download.php
Created Sep 1, 2018 — forked from tosinafolabi/download.php
Force File Download with PHP
View download.php
<?php
/*
* Force File Download
* Usage: http://example.com/download.php?file=./uploads/image.jpg
*
* There are a couple of *ninja* exit() as security guarantee, adapt as necessary
*
*/
// grab the requested file's name
@gnanet
gnanet / ssh-fingerprint-auth_keys.sh
Created Aug 28, 2018
One-Liner for split authorized_keys, generate a fingerprint for each public key with ssh-keygen
View ssh-fingerprint-auth_keys.sh
cat authorized_keys | while read keyline; do if [ "$keyline" != "" ]; then keyname=$(echo $keyline | cut -d' ' -f 3); keytype=$(echo $keyline | cut -d' ' -f 1); echo $keyline > ${keytype}_${keyname}.pub; ssh-keygen -l -f ${keytype}_${keyname}.pub && rm ${keytype}_${keyname}.pub; fi; done
@gnanet
gnanet / easyscp.acmetool.hook.sh
Last active Aug 26, 2018
Custom acmetool hook to update Let's Encrypt certificates for EasySCP
View easyscp.acmetool.hook.sh
#!/bin/sh
# This is a custom hook for acmetool
# https://github.com/hlandau/acme/releases
#
# Save this file to /usr/lib/acme/hooks/easyscp and make it executable
# This file updates certificate+private key files for domains which
# already were configured from inside EasySCP.
#