Skip to content

Instantly share code, notes, and snippets.

View dawidbeno's full-sized avatar
🚀
Writes quality code

Dávid Beňo dawidbeno

🚀
Writes quality code
View GitHub Profile
@dawidbeno
dawidbeno / python_data_structures.py
Created August 14, 2025 09:12
Python basic built-in data structures
# python_data_structures.py
#
# Description: A quick reference and example guide for the basic built-in
# data structures in Python: Lists, Tuples, Dictionaries, and Sets.
# --- 1. Lists ---
# An ordered and mutable (changeable) collection of items.
# Use cases: Storing collections of items that might need to change,
# like a to-do list or a list of users.
@dawidbeno
dawidbeno / get_location.php
Created April 29, 2025 09:35
Get location based on IP address
<?php
// Get the client's IP address
$ip = $_SERVER['REMOTE_ADDR'];
echo "Request IP: " . $ip . "<br><br>";
echo "<h3>Method 1: Using cURL</h3>";
// Method 1: Using cURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, "http://ipinfo.io/" . $ip . "/json");