Skip to content

Instantly share code, notes, and snippets.

View rautamiekka's full-sized avatar

Jouni Järvinen rautamiekka

View GitHub Profile
@rautamiekka
rautamiekka / IPv4 universal complete RegEx with options.txt
Created July 25, 2017 20:57
IPv4 universal complete RegEx with options
NOTE: Each RegEx is a single line and Java users, for example, need to mind Java's additional requirements (such as escaping escape characters), otherwise they should work in every RegEx flavor.
This code ain't my work originally, I modified it.
-------------------------------------------------------------------------
No support to get the individual sections:
```
(?:[1-9]?[0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.(?:[1-9]?[0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.(?:[1-9]?[0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.(?:[1-9]?[0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])
```
<div class="metadata">
<h2>
<a href="http://evil-m.deviantart.com/art/Memories-of-a-Warlord-679806065">Memories of a Warlord</a>
</h2>
<p class="mavatar">
<a target="_self" href="http://evil-m.deviantart.com/"><img class="avatar" src="http://a.deviantart.net/avatars/e/v/evil-m.jpg?11" alt=":iconevil-m:" title="Evil-M"></a>
</p>
<ul>
@rautamiekka
rautamiekka / color_meter.py
Created November 13, 2016 19:03
Calculate difference in percentage between 2 hex colors
"""
This function is a direct Python 2.7+ translation of
https://gist.github.com/mailtruck/2411659
Will exit if executed without importing.
--rautamiekka
"""
if __name__ == '__main__':
from sys import exit as sysexit
sysexit(1)