Skip to content

Instantly share code, notes, and snippets.

Stanislav Komanec netman92

Block or report user

Report or block netman92

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am netman92 on github.
  • I am netman92 (https://keybase.io/netman92) on keybase.
  • I have a public key whose fingerprint is BAF5 3BAD F692 83F8 EEE0 D538 8E90 5ACC 7160 5676

To claim this, I am signing this object:

View keybase.md

Keybase proof

I hereby claim:

  • I am netman92 on github.
  • I am netman92 (https://keybase.io/netman92) on keybase.
  • I have a public key whose fingerprint is BAF5 3BAD F692 83F8 EEE0 D538 8E90 5ACC 7160 5676

To claim this, I am signing this object:

@netman92
netman92 / singleton.py
Last active Aug 29, 2015 — forked from 1st/singleton.py
Singleton implantation on Python
View singleton.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class Singleton(type):
def __call__(self, *args, **kwargs):
if 'instance' not in self.__dict__:
self.instance = super(Singleton, self).__call__(*args, **kwargs)
return self.instance
View 1
#!/usr/bin/python
def solution(X, A):
n = len(A)
right = sum(1 for item in A if item != X)
left = 0
for k, element in enumerate(A, start=1):
if element == X:
left += 1
View gist:f39c18b5bd4f19db3a6e
#!/usr/bin/python
def line_intersection(line1, line2):
xdiff = (line1[0][0] - line1[1][0], line2[0][0] - line2[1][0])
ydiff = (line1[0][1] - line1[1][1], line2[0][1] - line2[1][1])
def det(a, b):
return a[0] * b[1] - a[1] * b[0]
div = det(xdiff, ydiff)
@netman92
netman92 / pq_config.py
Created Sep 11, 2014
Compute Postgres config
View pq_config.py
# -*- coding: utf-8 -*-
ram = raw_input("Ram? [GB] ") or 8
connections = raw_input("Number of expected sim. connections? ") or 1000
ram = float(ram)
connections = int(connections)
shared_buffers = "%0.0fMB" % ((ram*1024)/4)
@netman92
netman92 / maintance.php
Last active Dec 20, 2015
Maintance page
View maintance.php
<?php
header('HTTP/1.1 503 Service Unavailable');
header('Retry-After: 300'); // 5 minutes in seconds
$site = $_SERVER["HTTP_HOST"];
$language = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,5);
switch ($language) {
case "sk-SK":
You can’t perform that action at this time.