Skip to content

Instantly share code, notes, and snippets.

View abdullahdevrel's full-sized avatar
👋
Ask me about IPinfo & IP info!

Abdullah abdullahdevrel

👋
Ask me about IPinfo & IP info!
View GitHub Profile
@abdullahdevrel
abdullahdevrel / ipinfo-country-redirect.js
Created April 29, 2024 05:14
Redirect traffic based on IP Geolocation with IPinfo.io
// Define a function named getJSON that takes a URL and a callback function as parameters
var getJSON = function(url, callback) {
// Create a new XMLHttpRequest object
var xhr = new XMLHttpRequest();
// Open a GET request to the specified URL asynchronously
xhr.open('GET', url, true);
// Specify the expected response type as JSON
xhr.responseType = 'json';
// Define an event handler for when the request completes
@abdullahdevrel
abdullahdevrel / cidr_ip_count.json
Created December 6, 2022 18:33
cidr to IP count as a JSON
{
"/32": 1,
"/31": 2,
"/30": 4,
"/29": 8,
"/28": 16,
"/27": 32,
"/26": 64,
"/25": 128,
"/24": 256,
@abdullahdevrel
abdullahdevrel / cidr_ip_count.json
Created December 6, 2022 18:29
cidr, ip address count, subnet mask and wildcard mask reference
[
{
"cidr": "/32",
"subnet_mask": "255.255.255.255",
"wildcard_mask": "0.0.0.0",
"number_of_ip_address": 1
},
{
"cidr": "/31",
"subnet_mask": "255.255.255.254",
@abdullahdevrel
abdullahdevrel / US_state_codes_list.json
Created October 24, 2022 01:55
List/Array of all US (United States of America) state abbreviations/code (Python, Javascript, Typescript, JSON) | Prettyprinted and Minified both versions.
[
"AK",
"AL",
"AR",
"AZ",
"CA",
"CO",
"CT",
"DC",
"DE",
@abdullahdevrel
abdullahdevrel / US_state_codes_dict.json
Last active October 24, 2022 01:55
Dictionary/Object of all US (United States of America) state abbreviations/code (Python, Javascript, Typescript, JSON) | Prettyprinted and Minified versions.
{
"AK": "Alaska",
"AL": "Alabama",
"AR": "Arkansas",
"AZ": "Arizona",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DC": "District of Columbia",
"DE": "Delaware",