Skip to content

Instantly share code, notes, and snippets.

View adamori's full-sized avatar
🌴
On vacation

Adam Alidibirov adamori

🌴
On vacation
View GitHub Profile
@adamori
adamori / z.sh
Last active August 8, 2025 17:02
Setups oh-my-zsh with zsh-autosuggestions and zsh-syntax-highlighting plugins
#!/bin/bash
# Function to check if a command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
}
# Function to log messages
log() {
echo "[$(date +'%Y-%m-%d %H:%M:%S')] $1"
@adamori
adamori / hetzner_firewall_manager.py
Last active September 25, 2024 16:01
This Python script manages temporary firewall rules for a Hetzner Cloud server, ideal for use in CI/CD pipelines like GitHub Actions. It allows temporary SSH access from a specific IP address during automated tasks.
import os
import sys
import requests
import logging
import argparse
from typing import Optional
from dotenv import load_dotenv
from dataclasses import dataclass
# Configure root logger
import math
def is_simple_number(n):
if n < 2:
return False
elif n == 2:
return True
elif n % 2 == 0:
return False
else:
@adamori
adamori / assignment3.md
Created March 7, 2023 14:12
Доказать логическое тождество (формульно) и проверить его с помощью построения таблицы истинности. Уточнение задания. Доказательство истинности можно реализовать программно. Для этого надо написать код, вычисляющий правую и левую части доказываемого тождества, и сравнить полученные результаты. Рекомендуется использовать предварительно написанные…

image

def formula(x, y, z):
    return (x <= (y == z)) == ((x <= y) == (x <= z))

test_cases = [
    (False, False, False), #1
 (False, False, True), #2
@adamori
adamori / Pierce Arrow.md
Last active March 7, 2023 13:10
Разработать функцию, реализующую логическую операцию «стрелка Пирса». С ее помощью построить таблицу истинности для этой операции.
def pierce_arrow(a, b):
  return not(a or b)
a b f
0 0 1
0 1 1
1 0 0
@adamori
adamori / assignment_1.md
Created March 7, 2023 13:01
Разработать функцию, реализующую логическую операцию «штрих Шеффера». С ее помощью построить таблицу истинности для этой операции.
def schaeffers_stroke(a, b):
    return not (a and b)
a b f
0 0 1
0 1 1
1 0 1
import datetime
import os
import pandas as pd
import ijson
# Get a list of all JSON files in the current directory
json_files = [f for f in os.listdir('.') if f.endswith('.json')]
# If there are no JSON files, print an error message and exit
if not json_files:
import os
import sys
import traceback
from collections import namedtuple
from pathlib import Path
import re
import torch
import torch.hub
print(f"Enter 'exit' to close")
while(True):
text = input("Enter your promt: ")
if text == 'exit':
exit()
words = text.split()
num_words = len(words)
num_dots = text.count(".")
@adamori
adamori / pdfemailsender.ps1
Last active December 25, 2022 23:57
This script regularly checks a specified folder for new PDF files, extracts certain data from them, and sends the PDF files to a specified email address with the extracted data included in the subject and body of the email message. https://youtu.be/UnhiEivi0J0
# Set the email server and login credentials
$smtpServer = "smtp.gmail.com"
$username = "username@gmail.com"
$password = "password"
$sendTo = "username@gmail.com"
# Create a PSCredential object using the login credentials
$credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $username, $(ConvertTo-SecureString -String $password -AsPlainText -Force)