Skip to main content

Posts

Mail server

 Here's how to set up a mail server on Linux with Apache: Prerequisites and Components You'll need a Linux server (Ubuntu/CentOS), Apache web server, and mail server software like Postfix (SMTP) and Dovecot (IMAP/POP3).  Install these packages using your distribution's package manager. Basic Setup First, install required packages: sudo apt update sudo apt install postfix dovecot-imapd dovecot-pop3d apache2 Configure Postfix by editing /etc/postfix/main.cf : Set myhostname to your domain Configure mydomain and myorigin Set inet_interfaces = all Define mydestination with your domains Dovecot Configuration Edit /etc/dovecot/dovecot.conf : Enable protocols (imap, pop3) Set mail location ( mail_location = maildir:~/Maildir ) Configure authentication mechanisms Apache Integration Apache typically serves webmail interfaces like Roundcube or SquirrelMail. Install a webmail client: sudo apt install roundcube Configure Apache virtual host to serve the webmai...

Ruby data types

  Ruby Basic Data Types are fundamental building blocks that store different kinds of information. Ruby is dynamically typed, meaning variables don't need explicit type declarations, and everything in Ruby is an object with built-in methods. 1. Numbers: Ruby handles integers and floating-point numbers seamlessly: # Integers age = 25 big_number = 1_000_000 # Underscores for readability puts age.class # Integer # Floats height = 5.9 pi = 3.14159 puts height.class # Float # Number operations puts 10 + 5 # 15 puts 10.0 / 3 # 3.3333333333333335 puts 10 / 3 # 3 (integer division) puts 2 ** 8 # 256 (exponentiation) 2. Strings: Strings are sequences of characters with powerful manipulation methods: name = "Alice" greeting = 'Hello' # Single or double quotes message = "Hello, #{name}!" # String interpolation puts name.length # 5 puts name.upcase # ALICE puts name.downcase ...

Network monitoring with Ruby

This is all about using Ruby to check on network stuff — but the golden rule here is: only do this on networks and systems you own or have permission to test. Same idea as it being fine to check if your own front door is locked, but not okay to go around checking your neighbors' doors. Checking if a "port" is open Think of your computer or router like an apartment building with a bunch of numbered doors (called ports ). Some doors are unlocked (open) because a service is listening there — like a web server sitting behind door 80. Others are locked (closed). require 'socket' def scan_port(host, port) begin socket = TCPSocket.new(host, port) # try knocking on the door socket.close # say bye, we're just checking puts "Port #{port} is open on #{host}" true rescue false # if it errors out, the door's closed/locked end end Then this checks a handful of common "doors" on a device (here,...

Ruby OS Interaction

Ruby isn't just for shuffling numbers and text around — it can also reach out and poke the actual operating system: run commands, create files, check what machine it's running on, all that. Here's what that looks like, broken down simply. Running commands like you would in a terminal There are a few different ways to tell Ruby "hey, run this shell command for me": output = `ls -la` # backticks: run it, hand me back whatever it printed puts output Think of backticks like texting a friend "what's in your fridge?" and they text back the whole list. success = system("mkdir test_dir") # just tells you true/false: did it work? This one doesn't care what the command printed — just whether it succeeded or not. files = %x{find . -name "*.rb"} # same idea as backticks, just different-looking syntax require 'open3' stdout, stderr, status = Open3.capture3("ls /nonexistent") Open3 is the "gro...

Ruby

Ruby is a programming language made in 1995 by a Japanese guy nicknamed "Matz."  His whole goal was to make a language that makes programmers happy, not just computers. So Ruby reads almost like plain English and doesn't make you jump through a ton of hoops. Let's break down what that actually means, piece by piece. Getting it on your computer Windows: download something called RubyInstaller Mac: it's already there, but you'll want to grab a newer version using Homebrew ( brew install ruby ) Linux: use your normal package manager ( apt install ruby etc.) If you're doing a lot of Ruby stuff, there are tools (rbenv, RVM) that let you switch between different Ruby versions like changing outfits. The basics: storing information In Ruby, you just make up a name and shove a value into it — no need to say "this is a number" or "this is text" first: name = "Alice" # text (called a "string") age = 25 ...

HTML Attributes

  HTML Attributes are special properties that provide additional information about HTML elements.  They are written inside the opening tag and consist of a name-value pair, typically formatted as attribute="value" .  Attributes modify element behavior, appearance, or provide metadata that browsers and other tools can use. Common Global Attributes: id : Provides a unique identifier for an element class : Assigns CSS classes for styling style : Applies inline CSS styles title : Adds tooltip text on hover lang : Specifies the language of element content data-* : Creates custom data attributes Element-Specific Attributes: Different HTML elements have specialized attributes: <a> uses href for links and target for opening behavior <img> uses src for image source and alt for accessibility text <input> uses type , name , placeholder , and required <form> uses action and method Key Attribute Types Shown: Structural : id , class ...

packet-switching X.25

  X.25 is a packet-switching protocol suite developed by the ITU-T in the 1970s for wide area networking over unreliable communication links.  It operates at the first three layers of the OSI model and was widely used for connecting remote terminals and computers over public data networks, particularly before reliable digital infrastructure became commonplace. Architecture and Operation: X.25 uses virtual circuits to establish connections between endpoints.  It employs three protocol layers: X.25 Packet Layer Protocol (Layer 3), LAPB (Link Access Procedure Balanced) at Layer 2, and typically operates over serial interfaces at Layer 1.  The protocol provides both Switched Virtual Circuits (SVCs) that are established on-demand and Permanent Virtual Circuits (PVCs) that are pre-configured. Key Features: Built-in error detection and correction at multiple layers Flow control to prevent buffer overflow Virtual circuit multiplexing over single physical links Store...