Skip to content

Instantly share code, notes, and snippets.

@cldershem
cldershem / Cargo.lock
Last active October 31, 2018 17:48
Azul errors on Ubuntu 18.04
[[package]]
name = "adler32"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "android_glue"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@cldershem
cldershem / lesson.py
Last active April 27, 2017 18:39 — forked from Ethan-Arrowood/instructions.py
FCC-Python-Variable-Challenge created by Ethan.Arrowood - https://repl.it/HTLB/5
"""
Title: Variables
Description/Explanation/Lesson:
Variables in Python are defined using the '=' (pronounced: 'is') operator.
Example: `my_age = 18`
Variables can contain values such as strings, numbers, lists, class
instances, and many more things!
class LivingBeing(object):
breathes = True
needs_water = True
def cease_living():
pass
class Plant(LivingBeing):
has_eyes = False
@cldershem
cldershem / keybase.md
Created August 1, 2014 15:08
Verification for keybase.io

Keybase proof

I hereby claim:

  • I am cldershem on github.
  • I am cldershem (https://keybase.io/cldershem) on keybase.
  • I have a public key whose fingerprint is 7252 D881 7137 2C07 B481 722E B6F7 2902 7B80 5B8C

To claim this, I am signing this object:

def get_dict(test_file):
"""
Takes a csv as test_file and using first line as header, returns dict.
"""
with open(test_file, 'r') as f:
keys = next(f).strip().split(';')
for line in f:
line = dict(zip(keys, line.strip().split(';')))
yield line
@cldershem
cldershem / forms.py
Created November 15, 2013 06:42
Flask/WTForms/Jinja2 tag list headaches.
from flask.ext.wtf import Form, RecaptchaField
from wtforms import (TextField, TextAreaField, PasswordField,
SubmitField, BooleanField)
from wtforms.validators import Email, EqualTo, Required
from models import User, Post, Page, Unity
from mongoengine.queryset import DoesNotExist
from utils import makeSlug, TagListField
from flask.ext.pagedown.fields import PageDownField
@cldershem
cldershem / flask-pagedown-errors
Created November 5, 2013 22:15
flask-pagedown install errors.
(venv)cldershem@cldershem-laptop:~/hg-Python$ pip install flask-pagedown
Downloading/unpacking flask-pagedown
Downloading Flask-PageDown-0.1.0.tar.gz
Running setup.py egg_info for package flask-pagedown
file flask_pagedown.py (for module flask_pagedown) not found
Requirement already satisfied (use --upgrade to upgrade): Flask in ./venv/lib/python2.7/site-packages (from flask-pagedown)
Requirement already satisfied (use --upgrade to upgrade): WTForms in ./venv/lib/python2.7/site-packages (from flask-pagedown)
Requirement already satisfied (use --upgrade to upgrade): Werkzeug>=0.7 in ./venv/lib/python2.7/site-packages (from Flask->flask-pagedown)
Requirement already satisfied (use --upgrade to upgrade): Jinja2>=2.4 in ./venv/lib/python2.7/site-packages (from Flask->flask-pagedown)
@cldershem
cldershem / traceback
Created October 22, 2013 00:08
vim powerline issues
Error detected while processing VimEnter Auto commands for "*":
2013-10-21 20:06:41,304:ERROR:vim:syntastic:Exception while computing segment: i
nvalid expression
Error detected while processing VimEnter Auto commands for "*":
Traceback (most recent call last):
Error detected while processing VimEnter Auto commands for "*":
File "/home/cldershem/.local/lib/python2.7/site-packages/powerline/theme.py",
line 89, in get_segments
Error detected while processing VimEnter Auto commands for "*":
contents = segment['contents_func'](pl=self.pl, segment_info=segment_info, *
@cldershem
cldershem / __init__.py
Last active June 30, 2019 15:44
going from flask-login to flask-security. I'm not clear on how to not use flask-principal. since i have to change so many different things over, i'd like to do this one piece at a time. i may end up using flask-principal in the long run..but if i don't i'd like to get this running without it.
from flask import Flask
from flask.ext.mongoengine import MongoEngine
#from flask.ext.login import LoginManager
from flask.ext.bcrypt import Bcrypt
from flask_debugtoolbar import DebugToolbarExtension
from flask.ext.mail import Mail
app = Flask(__name__)
app.config.from_object('config')
@cldershem
cldershem / admin.py
Last active December 21, 2015 13:39
Adding the model "Post" to my admin views makes someone quite angry. The repo with the rest of the code can be found at https://github.com/cldershem/homelessgaffer .
from flask.ext.admin import (Admin, BaseView, AdminIndexView, expose)
from app import app, db
from flask.ext.admin.contrib.mongoengine import ModelView
from models import User, Post, Page
from utils import CKTextAreaField
class AdminView(BaseView):
@expose('/')
def index(self):
return self.render('index.html')