Skip to content

Instantly share code, notes, and snippets.

@vestel
vestel / crazyQuery.sql
Last active November 7, 2017 23:36
MySQL specific adventure about table creation
-- RUN ONLY ONCE TO DEPLOY PROCEDURE & FUNCTION INTO DB
DELIMITER $$
-- FUNCTION TAKES STRING, DELIMITER AND POSITION
-- AND RETURNS SUBSTRING OF DEFINED POSITION BY DELIMITERS
-- IF DELIMITER NOT FOUND OR OUT OF RANGE WILL RETURN '' (empty string)
-- Example: SPLIT_STR('ABRA / SCHWABRA / KADABRA',' / ',3) returns 'KADABRA'
--
-- IF DELIMITER NOT FOUND OR OUT OF RANGE WILL RETURN '' (empty string)
-- Example: SPLIT_STR('-/-',',',1) returns ''
@vestel
vestel / gist:9837acc6cff8bf9f761d
Created September 12, 2014 10:47
Header in Flask
from flask import Flask, request, Response
import unittest
app = Flask(__name__)
@app.route('/')
def index():
response = Response("Done", 200)
for k,v in request.headers:
response.headers.add(k,v)
@vestel
vestel / gist:a8984cf1de1993dc42ea
Created June 10, 2014 07:55
Never bitch about helping NPC with his rat problem :)
So. my DM threw out our last campaign and told us all to show up next session with just our dice. leaving our collected materials and sheets behind. When we arrived he gave us a choice of 0 level NPCs. We were now shit-tier nobodies in a shit-tier town in a shit-tier kingdom in shit-tier nowhere.
Our party consisted of The village blacksmith who can't really make anything much better than simple or martial weapons. and even then can mostly just make horseshoes and nails and shit. The village healer. does not into magic. does not into potions beyond herbal teas. and does not into healing beyond a vague understanding of good hygiene and drinking fresh water. A farmer. A fisherman.
We started off on a fine new morning. and found out that the local innkeeper had rats in the cellar. eating up his foodstuffs and doing your typical low-level rat shenanigans from every RPG. We were offered the chance to try and locate some sort of wandering adventurer to handle this. We chose to settle the affair ourself.
Total pa
@vestel
vestel / tag.py
Last active August 29, 2015 13:57
tag.py
#!/sevabot
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
import re
import Skype4Py
from sevabot.bot.stateful import StatefulSkypeHandler
@vestel
vestel / gist:9268671
Created February 28, 2014 10:22
Support several Python versions
try: from cStringIO import StringIO # cStringIO is faster, but not everywhere available
except ImportError:
try: from StringIO import StringIO # default, should work in any python 2 environement
except ImportError:
try: from io import StringIO # exception for python 3
except ImportError:
raise NotFoundDependencies # some strange version or problem with dependencies
@vestel
vestel / index.html
Last active December 28, 2015 11:09
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Trader Room</title>
<link type="text/css" href="https://account.forex4you.com/themes/default/styles/main.css?22" rel="stylesheet"/>
<link type="text/css" href="rborder.css?22" rel="stylesheet"/>
</head>
<body>
set fish_credentials_color blue
set fish_git_dirty_color red
function parse_git_dirty
git diff --quiet HEAD ^&-
if test $status = 1
set_color $fish_git_dirty_color
echo -n "Δ"
set_color normal
end
@vestel
vestel / README
Created November 17, 2012 00:17
Adds Suunto HR information (from Movescount) to workout in Endomondo
# This is draft version
# so code is ugly
# Possible todos:
* Code cleanup :)
* Accept filenames from command lines
* Create new file from date
* Create missing Trackpoints (for location based sports, like swimming)
* Refactor merge (do believe it might go slow on long distance run)
* Update sport name in file
@vestel
vestel / gist:2043875
Created March 15, 2012 11:59
aigarius-autonose-issue22-log
Traceback (most recent call last):
File "/home/aigarius/.cache/0install.net/implementations/sha256=69730523263f37581d813bf443f6ca9d528055968d95124d1558baebd0a4f5ec/paragram/process/base_process.py", line 254, in _receive
handler(*args)
File "/home/aigarius/.cache/0install.net/implementations/sha256=2d679d7310c3255a76b420568242890dfbd04d5e4ed60a88d088335f6f8bf8cc/autonose/ui/shared/main.py", line 36, in process
event.affect_page(self.page)
File "/home/aigarius/.cache/0install.net/implementations/sha256=2d679d7310c3255a76b420568242890dfbd04d5e4ed60a88d088335f6f8bf8cc/autonose/shared/test_result.py", line 127, in affect_page
page.test_complete(self)
File "/home/aigarius/.cache/0install.net/implementations/sha256=2d679d7310c3255a76b420568242890dfbd04d5e4ed60a88d088335f6f8bf8cc/autonose/ui/shared/page.py", line 202, in test_complete
raise ValueError("unknown status type: %s" % (test.state,))
ValueError: unknown status type: skipped
@vestel
vestel / test.py
Created March 14, 2012 09:33
AutonoseIssue22
import unittest
class TestAutonoseFail(unittest.TestCase):
def test_crash(self):
self.skipTest("This test should be skipped")
def test_fail(self):
self.fail("Should fail")