Skip to content

Instantly share code, notes, and snippets.

import pulumi
import pulumi_gcp as gcp
import pulumi_kubernetes as k8s
from network import network, subnet1
from common import gcp_project, gcp_zone
provider_cfg = pulumi.Config("gcp")
gcp_region = provider_cfg.get("region", "europe-north1")
@dastanko
dastanko / app.py
Created November 19, 2017 06:43
sample wsgi app
from werkzeug.routing import Map, Rule
from werkzeug.serving import run_simple
from werkzeug.wrappers import Request, Response
class WebApplication(object):
def __init__(self, router=None) -> None:
self.router = router
def dispatch_request(self, request):
@dastanko
dastanko / test_register_user.py
Created November 9, 2017 08:47
tdd of bussiness logic
import unittest
class AlreadyRegisteredUserWithSuchEmailException(Exception):
pass
class RegisterUser(object):
def __init__(self, user_storage):
self.user_storage = user_storage
@dastanko
dastanko / ruby_rails_windows.md
Last active September 2, 2015 11:30 — forked from KelseyDH/ruby_rails_windows.md
Ruby on Rails Microsoft Windows Troubleshooting Tips

##Ruby on Rails Windows Troubleshooting Tips & Survival Guide

###Intro/Overview

The Ruby on Rails Windows Troubleshooting tips & Survival Guide is a random catalogue of issues I faced working with Ruby on Rails on Windows (Windows 7 specifically). This guide is not exhaustive, but covers many of the challenges that causes Windows Ruby developers to jump ship to Linux or Mac. If you're reading this guide then you're probably new to Ruby/Rails, so also included is more general beginner advice to help you get going.

####Personal Side Note

Before you follow this guide, I strongly recommend you consider using Linux or Mac OS X for Ruby Development instead. Reckless, and looking to prove a point; I ignored this strongly given advice while learning Ruby/Rails at a coding bootcamp. While I eventually did succeeed in getting Ruby on Rails to work in Windows, it was not easy, and I easily lost 40+ hours on StackOverFlow to Windows/Ruby configuration issues--time I could have devoted to lear

@dastanko
dastanko / Boxstarter
Last active August 29, 2015 14:11 — forked from mwrock/Boxstarter
function Exists-Drive {
param($driveletter)
(New-Object System.IO.DriveInfo($driveletter)).DriveType -ne 'NoRootDirectory'
}
function Create-Directories {
param($drive)
foreach($directory in $directories){
Write-Host "$($drive)$($directory)"
1
00:04:14,588 --> 00:04:17,925
<i>We interrupt scheduled programming</i>
<i>to bring you this breaking news.</i>
2
00:04:18,133 --> 00:04:20,260
<i>Good afternoon.</i>
<i>In the last several minutes...</i>
#/usr/bin/perl
use strict;
use LWP::Simple qw(getstore);
use LWP::UserAgent;
use HTTP::Cookies;
use Getopt::Long;
my $DIR_TO_SAVE = 'VKplaylist';
my ($cfile, $file, $exclude, $login, $pass, $cookie, $browser, $response, @links, @files, $num, $artist, $title, @excludes, @excluded);
$cfile = 'cookie.dat';
#coding=utf-8
from unittest import TestCase
class XmlSerializable(object):
def to_xml(self):
raise NotImplementedError("This must implemented in all XmlSerializable objects")
class Document(XmlSerializable):
@dastanko
dastanko / runner.py
Created December 7, 2013 18:59 — forked from carljm/runner.py
"""
An alternative Django ``TEST_RUNNER`` which uses unittest2 test discovery from
a base path specified in settings, rather than requiring all tests to be in
``tests`` module of an app.
If you just run ``./manage.py test``, it'll discover and run all tests
underneath the ``TEST_DISCOVERY_ROOT`` setting (a path). If you run
``./manage.py test full.dotted.path.to.test_module``, it'll run the tests in
that module (you can also pass multiple modules).
@dastanko
dastanko / djvu2pdf
Created August 17, 2013 16:55
bash:convertToPDF
#!/bin/bash
# convert DjVu -> PDF
# usage: djvu2pdf.sh <file.djvu>
# depends on ddjvulibre package, To install package run `sudo apt-get install ddjvulibre`
i="$1"
echo "------------ converting $i to PDF ----------------";
o="`basename $i .djvu`"
o="$o".pdf