Skip to content

Instantly share code, notes, and snippets.

View RonnyPfannschmidt's full-sized avatar
🦖
catching up with backlog

Ronny Pfannschmidt RonnyPfannschmidt

🦖
catching up with backlog
View GitHub Profile
# current method
obj = session.query(Foo).get(id) # select * from foo where id=?
obj.bar = session.query(Bar).get(bar_id) # select * from bar where id=?
# what i want:
obj = session.query(Foo).get(id) # select * from foo where id=?
obj.bar = session.hollow(Bar, bar_id) # invented name, no query should happen until i use attributes of obj.bar
# what i want to avoid
@RonnyPfannschmidt
RonnyPfannschmidt / index.html
Last active August 29, 2015 14:09
the app thats failing me
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1> stuff</h1>
</body>
</html>
@RonnyPfannschmidt
RonnyPfannschmidt / shell.sh
Created August 2, 2015 09:23
tox shortcoming example
# this does not work since docs is not a factor
$ tox -e docs-html # will build html docs
$ tox -e docs-pdf # will build pdf docs
- name: test
hosts: application
roles:
- {role: deployment, app: "{{applications[0]}}", }
- {role: deployment, app: "{{applications[1]}}", when: '{{applications|length > 1}}' }
- {role: deployment, app: "{{applications[2]}}", when: '{{applications|length > 2}}' }
- {role: deployment, app: "{{applications[3]}}", when: '{{applications|length > 3}}' }
- {role: deployment, app: "{{applications[4]}}", when: '{{applications|length > 4}}' }
- {role: deployment, app: "{{applications[5]}}", when: '{{applications|length > 5}}' }
- {role: deployment, app: "{{applications[6]}}", when: '{{applications|length > 6}}' }
{ config, pkgs, ... }:
let enabled = {enable = true;}; in
{
boot.loader.grub = {
enable = true;
version = 2;
device = "/dev/sda";
};
security.sudo.wheelNeedsPassword = false;
@RonnyPfannschmidt
RonnyPfannschmidt / build.nix
Created June 11, 2016 12:39
enpass test build setup using nixpkgs from git
with import <nixpkgs> {};
import ./enpass {
inherit (pkgs) dpkg patchelf openssl glib mesa libpulseaudio zlib dbus;
inherit stdenv fetchurl makeWrapper;
inherit (pkgs.xorg) libX11 libXext libXScrnSaver;
qt = pkgs.qt56;
}
class foo(Element)
exists = sentaku.ContextualMethod()
@exists.implemented_for(ViaDB)
def exists(self):
"""
Checks if the PXE server already exists
"""
return self.db.exists("pxe_servers", name=self.name)
@tagged
class Maybe(object):
@construct
def Nothing(self):
pass
@construct
def Just(self, data: int):
pass
# written in browser#
class ChangeProxy(object):
def __init__(self, observed, tracker):
self.__observed = observed
self.__tracker = tracker
def __getattr__(self, key):
if key in self.__tracker:
return self.__tracker[key]
@RonnyPfannschmidt
RonnyPfannschmidt / out.txt
Created September 1, 2016 06:15
borg check output
$ borg check -v --debug borg
using builtin fallback logging configuration
29 self tests completed in 0.12 seconds
Starting repository check
Index object count mismatch. 3379815 != 3379816
Completed repository check, errors found.