Skip to content

Instantly share code, notes, and snippets.

View dusnm's full-sized avatar

Dušan Mitrović dusnm

View GitHub Profile
@dusnm
dusnm / http_status_codes.php
Created October 1, 2020 21:46
PHP constants with descriptions of the most commonly used HTTP status codes
<?php
declare(strict_types=1);
/**
* Standard response for successful HTTP requests.
* The actual response will depend on the request method used.
* In a GET request, the response will contain an entity corresponding to the requested resource.
* In a POST request, the response will contain an entity describing or containing the result of the action.
*/
define('HTTP_STATUS_OK', 200);
@dusnm
dusnm / umcn_checksum.go
Last active October 28, 2021 22:49
A small go program calculating the UMCN (Unique Master Citizen Number) checksum for the numbers of former Yugoslav republics.
/*
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Licensed under the GNU General Public License, Version 3.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* https://www.gnu.org/licenses/gpl-3.0.txt
*
* Unless required by applicable law or agreed to in writing, software
@dusnm
dusnm / dictionary.py
Created April 20, 2022 19:31
Python "dictionary"
#!/usr/bin/env python3
import sys
import requests
from termcolor import colored
from requests.exceptions import JSONDecodeError
from typing import Dict, Union
def make_api_request(word: str) -> Union[Dict, None]:
url = f"https://api.dictionaryapi.dev/api/v2/entries/en/{word}"
@dusnm
dusnm / openpgp.md
Created May 7, 2022 19:18
Keyoxide verification
@dusnm
dusnm / apache-wordpress.conf
Last active May 18, 2022 09:41
Example Apache configuration for wordpress
<IfModule mod_ssl.c>
<VirtualHost *:443>
# Basic config
ServerName example.org
ServerAdmin webmaster@example.org
DirectoryIndex index.php index.html /index.php
# This is a directory where wordpress is installed.
# Depending on the operating system, either http or www-data
# must have ownership and r,w permissions.
@dusnm
dusnm / umcn.py
Last active July 23, 2023 23:33
Матични број
#!/usr/bin/env python3
import sys
from datetime import date
def parse_umcn_dob(dob: str) -> date:
day = int(dob[0:2])
month = int(dob[2:4])
year = int(f"2{dob[4:7]}") if dob[5] == "0" else int(f"1{dob[4:7]}")