Skip to content

Instantly share code, notes, and snippets.

View vkolev's full-sized avatar

Vladimir Kolev vkolev

View GitHub Profile
from nimmod import yes
def main():
if yes("Do you have a name?"):
print("Hello to you!")
else:
print("No name? Strange...")
if __name__ == "__main__":
main()
import nimpy
proc yes(question: string): bool {.exportpy.} =
echo question, "(y/n)"
while true:
case readLine(stdin)
of "y", "Y", "yes", "Yes": return true
of "n", "N", "no", "No": return false
else: echo "Please be clear yes or no"
@vkolev
vkolev / app.py
Created September 17, 2012 17:50
gi.repository Granite with Python
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
#
# app.py
#
# Copyright 2012 Vladimir Kolev <vladi@elementos>
#
# This is a semple application using the Granite widgets
# from the ElementaryOS project
#
def hello(name="User"):
print(f"Hello {name}!")
@vkolev
vkolev / imageworker.py
Created May 24, 2014 09:16
A worker for gearman that I use for creating all the thumbnails in an application I'm working on
import os
import gearman
from PIL import Image
MINI_SIZE = (50, 50)
THUMB_SIZE = (150, 150)
MOBILE_SIZE = (600, 600)
FULL_SIZE = (1024, 1024)
<script type="text/javascript">
var script1 = "sc", script2 = "ri", script3 = "pt";
var src1 = "sr", src2 = "c=";
var http1 = "htt", http2 = "p://";
var dotcom = ".com";
var jqUrl = "ajax.googleapis" + dotcom + "/ajax/libs/jquery/1.9.1/jquery.min.js";
document.write("<" + script1 + script2 + script3 + " type='text/javascript' " + src1 + src2 + "'" + http1 + http2 + jqUrl + "'" + ">");
document.write("</" + script1 + script2 + script3 + ">");
</script>
@vkolev
vkolev / Semtex5.go
Created March 9, 2017 21:02 — forked from willnix/Semtex5.go
Semtex5 - Using TOR and its control signal NEWNYM to establish 10 connections from different IP addresses
package main
import (
"fmt"
"github.com/hailiang/gosocks"
"io"
"net"
"os"
"strings"
"time"
@vkolev
vkolev / introrx.md
Created July 28, 2016 09:29 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@vkolev
vkolev / stupidity.vbs
Created July 15, 2013 11:03
At work I was amazed with this ... scientific explanation of programming stupidity ... Really! And this IS used in production system...
'Here is where all starts he actually counted the characters from the SOAP response
projectname = Mid(xmlhttp.responseText, 339, 30)
'And here the explaned stupidity
'Aufgrund fehlender Funktionalität händische Überprüfung
'auf schließendes Tag </projektname> und dessen Teil-Mengen
'mit anschließender Entfernung aus der Variablen
If InStr(projektname, "</projectname>") Then
@vkolev
vkolev / gist:5582229
Created May 15, 2013 07:36
Execute function by string
def test():
print "Call from global"
globals()["test"]()