Skip to content

Instantly share code, notes, and snippets.

@paradoxxxzero
paradoxxxzero / null.py
Last active Apr 14, 2021
sqlalchemy 1.14 sql syntax error for joinedload on relationship with comparison to null and entity with query_expression as null
View null.py
from sqlalchemy import create_engine, Column, Integer, String, ForeignKey
from sqlalchemy.orm import (
declarative_base,
joinedload,
query_expression,
relationship,
sessionmaker,
)
engine = create_engine(
View stream_test.py
from time import sleep
from flask import Flask, Response
app = Flask(__name__)
@app.route("/")
def hello():
def gen(*args):
View ~!.config!systemd!user!img-serve.service
[Unit]
Description=Image server
[Service]
ExecStart=/usr/bin/python /etc/butterfly/themes/material-dark-bg/img-serve.py
[Install]
WantedBy=default.target
@paradoxxxzero
paradoxxxzero / style.sass
Created Jun 24, 2016
Butterfly theme to work with img-serve.py
View style.sass
@import 'https://fonts.googleapis.com/css?family=Anonymous+Pro:400,700'
$font-family: 'Anonymous Pro', monospace
$font-size: 1.3em
$fg: darken(#AABBC3, 5%)
$bg: #212121
$active-bg: rgba(0, 0, 0, 0.19)
$colors: #000000, rgba(211, 66, 62, 1), #8BD649, #FAD430, #c792ea, rgba(255, 83, 112, 1), #8EACE3, #DDDDDD, #656565, #F77669, #91b859, #ffcb6b, rgba(199, 146, 234, 1), #ff5370, #B2CCD6, rgba(217, 245, 221, 1)
@paradoxxxzero
paradoxxxzero / img-serve.py
Created Jun 24, 2016
Serve random non-nsfw anime wallpaper from wallhaven to localhost:42424/img
View img-serve.py
from flask import Flask, redirect
from random import choice
from pyquery import PyQuery as pq
app = Flask(__name__)
usable_images = []
for page in range(1, 10):
d = pq(url='https://alpha.wallhaven.cc/search?categories=010&purity=100&ratios=16x9&sorting=views&order=desc&page=%d' % page)
usable_images.extend(list(d.find('[data-wallpaper-id]').map(lambda _, x: x.attrib['data-wallpaper-id'])))
View gist:93005e78d232cf7ea9c6
#!/usr/bin/env python
import soundcloud
from clize import clize, run
from subprocess import call
@clize
def sc_load(tracks='', likes='', tags='', group=''):
opts = {}
if likes:
@paradoxxxzero
paradoxxxzero / gist:5780303
Last active Dec 18, 2015
Natural cubic spline
View gist:5780303
# -*- coding: utf-8 -*-
# This file is part of pygal
#
# A python svg graph plotting library
# Copyright © 2012-2013 Kozea
from __future__ import division
def cubic_interpolate(x, a, precision=250):
    """Takes a list of (x, a) and returns an iterator over
View gist:3775510
var _rcokt_farms = $('.farmtown_owned a').map(function () { return JSON.parse(atob($(this).attr('href')).split(String.fromCharCode(0))[0]).id;}),
_rcokt_town = $('.ftr_undefined').attr('id').split('_')[2],
_rcokt_token = game_definition_object.csrfToken,
_rcokt_link = $('<a>');
$('#links').append($('<li>').append(_rcokt_link));
function claim_okt() {
$.ajax({
url: 'http://fr38.grepolis.com/game/oktoberfest?action=start_production&town_id=' + _rcokt_town + '&h=' + _rcokt_token,
View gist:3761652
var _rc_ = {};
$('#memo_icon').remove();
$('<a>').attr('id', '_rc_claim').addClass('town_control').css({left: '322px', backgroundPosition: "-323px 9px"}).text('+').on('click', _rc_start).insertBefore($('#city_overview'));
function _rc_start () {
if (webkitNotifications && webkitNotifications.checkPermission() != 0) {
webkitNotifications.requestPermission();
}
if(!_rc_.hasOwnProperty(Game.townId)) {
View offliberpy.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Version 2, December 2004
#
# Copyright (C) 2012 paradoxxx_zero
#
# Everyone is permitted to copy and distribute verbatim or modified
# copies of this license document, and changing it is allowed as long