Skip to content

Instantly share code, notes, and snippets.

View xenozauros's full-sized avatar

Oleg Kleshchook xenozauros

  • Semrush.com
  • St.-Petersburg, Russia
View GitHub Profile
@xenozauros
xenozauros / hex2hsl.js
Last active May 7, 2024 09:21
Javascript: HEX to RGB to HSL
function hexToHSL(hex) {
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
r = parseInt(result[1], 16);
g = parseInt(result[2], 16);
b = parseInt(result[3], 16);
r /= 255, g /= 255, b /= 255;
var max = Math.max(r, g, b), min = Math.min(r, g, b);
var h, s, l = (max + min) / 2;
if(max == min){
h = s = 0; // achromatic
@xenozauros
xenozauros / hook.py
Last active August 29, 2015 14:24
Puppet: Gitlab WebHook processing with nginx and r10k. Integration with RequestTracker
#!/usr/bin/python
import sys
import json
import smtplib
import gitlab
import re
from subprocess import call,check_output,STDOUT
gitlab_server=''
@xenozauros
xenozauros / fetch_news_win.py
Last active December 23, 2015 06:49
Windows version of news fetcher script. Here is link to Win executable build: http://yadi.sk/d/-1c4Ec8c9TZuY
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import json
import urllib2
from urllib import urlencode
import json
import os
import os.path
import sys
import time
@xenozauros
xenozauros / fetch_news.py
Last active December 23, 2015 06:29
Simple script to collect news from vkontakte. It can be used to find some rent or sales news in your own city
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import json
import urllib2
from urllib import urlencode
import json
import os
import os.path
import sys