Skip to content

Instantly share code, notes, and snippets.

@sh4nks
sh4nks / Dracula.sublime-color-scheme
Created February 4, 2021 14:37
Dracula Color Scheme customizations
// Documentation at https://www.sublimetext.com/docs/color_schemes.html
{
"variables":
{
},
"globals":
{
},
"rules":
@sh4nks
sh4nks / cli.py
Created December 9, 2020 09:23
flask shell with ipython
def get_version(ctx, param, value):
if not value or ctx.resilient_parsing:
return
message = (
"<project> %(version)s using Flask %(flask_version)s on "
"Python %(python_version)s"
)
click.echo(
message
% {
@sh4nks
sh4nks / audit_mixin.py
Created December 4, 2020 10:15 — forked from mjhea0/audit_mixin.py
Useful SQLAlchemy Mixins
from datetime import datetime
from sqlalchemy import Column, Integer, DateTime, ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declared_attr
from flask_security import current_user
class AuditMixin(object):
created_at = Column(DateTime, default=datetime.now)
updated_at = Column(DateTime, default=datetime.now, onupdate=datetime.now)
@sh4nks
sh4nks / dev_run.py
Created August 23, 2020 16:44 — forked from skariel/dev_run.py
hot reloading automation for sqlc, quicktemplates etc
#!python -u
import os
import sys
import glob
import time
import signal
import queue
from subprocess import Popen, getoutput, PIPE
from multiprocessing import Process, Queue
from watchdog.observers import Observer
# MS Tracking
0.0.0.0 a.ads1.msn.com
0.0.0.0 a.ads2.msads.net
0.0.0.0 a.ads2.msn.com
0.0.0.0 a.rad.msn.com
0.0.0.0 a-0001.a-msedge.net
0.0.0.0 a-0002.a-msedge.net
0.0.0.0 a-0003.a-msedge.net
0.0.0.0 a-0004.a-msedge.net
import simplejson
import sqlalchemy
from sqlalchemy import String
from sqlalchemy.ext.mutable import Mutable
class JSONEncodedObj(sqlalchemy.types.TypeDecorator):
"""Represents an immutable structure as a json-encoded string."""
impl = String
==> Making package: lxqt-panel-git 0.7.0.45.g125dea7-1 (Sat 5 Jul 08:25:18 CEST 2014)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
-> Updating lxqt-panel git repo...
Fetching origin
==> Validating source files with sha256sums...
lxqt-panel ... Skipped
==> Extracting sources...
-> Creating working copy of lxqt-panel git repo...
"""
This test will use the default permissions found in
flaskbb.utils.populate
"""
import pytest
from flaskbb.user.models import User
from flaskbb.forum.models import Forum, Category, Topic, Post
from flaskbb.utils.permissions import *
@sh4nks
sh4nks / lv02.c
Created January 11, 2014 14:54
lv02
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
int calc_total(int numbers[], int len) {
int total = 0;
for(int i = 0; i < len; i++) {
total += numbers[i];
}
@sh4nks
sh4nks / app.py
Last active December 25, 2015 20:59
integrate flaskbb in another app
from flask import Flask
from werkzeug.serving import run_simple
from werkzeug.wsgi import DispatcherMiddleware
from flaskbb.user.models import User
from flaskbb import create_app as flaskbb
from flaskbb.configs.development import DevelopmentConfig as Config
from flask.ext.login import LoginManager
from flask.ext.sqlalchemy import SQLAlchemy