Skip to content

Instantly share code, notes, and snippets.

View PetrGlad's full-sized avatar
🚶‍♂️
.

Petr Gladkikh PetrGlad

🚶‍♂️
.
View GitHub Profile
@PetrGlad
PetrGlad / join-pdf-example.sh
Created June 2, 2024 16:14
Join PDF Documents
# https://stackoverflow.com/a/19358402/117220
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/default -dNOPAUSE -dQUIET -dBATCH \
-dDetectDuplicateImages -dCompressFonts=true -r150 -sOutputFile=output.pdf input.pdf
@PetrGlad
PetrGlad / number-to-words.py
Created May 4, 2024 16:24
An exersice problem
import sys
DIGITS = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']
TEENS = ['ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen']
TENS = ['ten', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety']
def speek_0(n: int) -> [str]:
"""Auxiliary function."""
words = []
$ echo "ertyoiu" | podman secret create asdf -
c680db24d26dc024f36f90e90
$ podman secret ls
ID NAME DRIVER CREATED UPDATED
c680db24d26dc024f36f90e90 asdf file 5 seconds ago 5 seconds ago
$ podman run --rm -ti --secret asdf alpine
/ # ls /var/run/secrets/
asdf
/ # ls /var/run/secrets/asdf
@PetrGlad
PetrGlad / rant.py
Created March 12, 2024 16:07
Code pile
import os
import re
import jinja2
import pygments
import pygments.lexers as lexers
from pygments.formatters import HtmlFormatter
CSS_CLASS = ".code"
@PetrGlad
PetrGlad / audatic.py
Last active March 5, 2024 19:30
Python test assignment coderbyte
import statistics
import ast
import math
import json
from typing import Callable
class ParseError(Exception):
pass
#!/bin/sh
diff --color <(yq -P 'sort_keys(..)' $1) <(yq -P 'sort_keys(..)' $2)
@PetrGlad
PetrGlad / idea-ultimate.desktop
Created November 21, 2021 19:11
IntelliJ Idea Gnome Desktop Launcher Example
# Shoulid be in ~/.local/share/applications/idea-ultimate.desktop
[Desktop Entry]
Version=1.0
Name=Idea Ultimate
GenericName=IDE
Terminal=false
Exec=/opt/idea-IU-212.5457.46/bin/idea.sh
Terminal=false
Type=Application
Icon=/opt/idea-IU-212.5457.46/bin/idea.svg
#!/bin/bash
# Fix for working in IntelliJ behind corporate firewall in Linux.
# Note that this makes your Idea's TLS communications monitored.
# Note that if you have a JetBrains license owned by your company,
# then better ask your IT support to fix cert problems instead.
# Howto:
# 0. Your company cert is expected to be in /usr/local/share/ca-certificates/extra/MyCompanyCA.crt
# 1. Launch Intellij.
# 2. Copy CA storage path from the "certificate problem" pop up dialog. Close IntelliJ.
@PetrGlad
PetrGlad / retest.sh
Created September 4, 2019 21:08
Continuous retest
while inotifywait -e modify -r . ;
do
lein test;
echo;
done
@PetrGlad
PetrGlad / dip.sh
Created August 6, 2019 14:56
Get IP of a docker container
#!/bin/bash
docker inspect $1 | jq -r ".[0].NetworkSettings.Networks.${2:-bridge}.IPAddress"