Skip to content

Instantly share code, notes, and snippets.

View adamori's full-sized avatar
🫠

Adam Alidibirov adamori

🫠
View GitHub Profile
@adamori
adamori / z.sh
Created February 2, 2025 16:12
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
@adamori
adamori / reactive-vue-axios.md
Created November 12, 2023 14:19
Extension of the Axios library for use with Vue.js. The main purpose is to integrate a loading indicator (using Vue's Ref type) with Axios requests to automatically change state of loading state.

Axios Loading State Reactivity

Extension of the Axios library for use with Vue.js. The main purpose is to integrate a loading indicator (using Vue's Ref type) with Axios requests to automatically change state of loading state.

Check the example project

Steps

  1. Create or insert into existing env.d.ts file located on the same directory with tsconfig.json. If you don't use typescript in your project, skip
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(".")