Skip to content

Instantly share code, notes, and snippets.

@SonyaEick
SonyaEick / Matrix Code Challenge
Last active December 16, 2022 22:12
Nearly complete code challenge for an interview.
# 1234 837 654 95 67 21
# 1234 83 7654 9 567 21
Def inner_matrix(side, rows):
If not side:
For r in rows:
print(rows[-1])
rows.pop()
Else:
@SonyaEick
SonyaEick / model.py
Created August 21, 2014 14:53
DataDork files
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey
from sqlalchemy.orm import sessionmaker, relationship, backref, scoped_session
from flask.views import MethodView
USER_COLS = ["id", "email", "password", "age"]
engine = create_engine("sqlite:///ratings.db", echo=True)
@SonyaEick
SonyaEick / auth_user.py
Last active December 17, 2019 14:49
Cisco Snippets
import requests
class HTTPMethod:
GET = 1
POST = 2
PUT = 3
DELETE = 4
class NSAPI:
""" Class that talks to Service Catalog via NS API """
@SonyaEick
SonyaEick / view-login.py
Created October 25, 2013 16:00
A small snippet of code I've written that is ready for production. Super simple, straight forward login process. Written as an alternative to signing up/in with twitter. Tech: Python, Flask, Jinja
@blueprint.route('/register', methods=['GET','POST'])
def register():
if request.method == 'GET':
return render_template('influencer/register.jt')
data = request.form.to_dict()
# pass data to validation lib to be validated
result = v.influencer_register(data)
if result.is_valid():
#check for duplicate
active_influencer = get_influencer_by_email(result.get_value('email'))
@SonyaEick
SonyaEick / snowjob.py
Created December 24, 2012 06:18 — forked from sontek/snowjob.py
#!/usr/bin/env python
import os
import random
import time
import platform
snowflakes = {}
try:
# Windows Support
@SonyaEick
SonyaEick / Twain.py
Created October 10, 2012 03:25
Organizing Twain
# open twain.txt, "copy" the data into 'text', then close the file.
def words_counted():
text =''
f = open('twain.txt')
for line in f:
newline = line.strip()
text += ' '+ newline
f.close()
text = text.split(' ') # define 'text' as the file 'text' split by spaces