Skip to content

Instantly share code, notes, and snippets.

View ddmitov's full-sized avatar

Dimitar D. Mitov ddmitov

View GitHub Profile
@ddmitov
ddmitov / shrinkpdf.sh
Created August 12, 2024 13:12
Bash script for shrinking the size of PDF files
#!/bin/sh
gs -q -dNOPAUSE -dBATCH -dSAFER \
-sDEVICE=pdfwrite \
-dCompatibilityLevel=1.3 \
-dPDFSETTINGS=/screen \
-dEmbedAllFonts=true \
-dSubsetFonts=true \
-dColorImageDownsampleType=/Bicubic \
-dColorImageResolution=72 \
import os
import json
def lambda_handler(event, context):
json_region = os.environ['AWS_REGION']
return {
"statusCode": 200,
"headers": {
"Content-Type": "application/json"
#!/usr/bin/env python3
# Snake Works 2020.
# https://github.com/ddmitov/
#
# /^\/^\
# _| O| O|
# \/ / \_/\_/ \
# \____|____ \
# \_______ \ ______
@ddmitov
ddmitov / selenium.py
Created August 29, 2020 10:47
Minimal testing script for the Selenium Python package
#!/usr/bin/python3
import os
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--window-size=1920x1080')
@ddmitov
ddmitov / initials-maker.py
Last active August 28, 2020 20:33
Extracts Initials from any name that can be written in Latin letters
#!/usr/bin/python3
# Initials Maker v.1.0
# by Dimitar D. Mitov
# https://github.com/ddmitov
# This is free and unencumbered software released into the public domain.
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
@ddmitov
ddmitov / turtle-chessboard.py
Last active May 28, 2020 20:02
Implementation of the famous Python Turtle Chessboard task
#!/usr/bin/python3
# Turtle Chessboard v.1.0
# by Dimitar D. Mitov
# https://github.com/ddmitov
# This is free and unencumbered software released into the public domain.
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
@ddmitov
ddmitov / rss-meter
Last active June 6, 2022 07:33
Linux RSS Memory Meter
#!/usr/bin/perl
# Linux RSS Memory Meter version 2.0.
# MIT 2019 Dimitar D. Mitov
# https://github.com/ddmitov
# Linux RSS Memory Meter can measure
# the combined RSS memory usage of several processes
# together with their child processes
# providing every second a total in megabytes.
@ddmitov
ddmitov / sshexec.pl
Created August 16, 2018 11:37
Execute remote commands using Perl5, Net::OpenSSH and a private key
#!/usr/bin/perl
use Net::OpenSSH;
my $ssh = Net::OpenSSH->new('[email protected]', key_path => '/path/to/private_key');
$ssh->error and die "Couldn't establish SSH connection: ".$ssh->error;
my ($stdin, $stdout, $stderr, $pid) = $ssh->open3("ls -l");
my @output = <$stdout>;
@ddmitov
ddmitov / check-urls.py
Last active October 6, 2018 18:34
Simple Python URL Tester for my Markdown files
#! /usr/bin/python
###############################################################################
# URL Tester
# Version 0.2
#
# Usage:
# python check-urls.py CREDITS.md
#
# CREDITS