Skip to content

Instantly share code, notes, and snippets.

View reidransom's full-sized avatar

Reid Ransom reidransom

View GitHub Profile
from sshtunnel import SSHTunnelForwarder
import pymysql
from pandas import read_sql
from log import logger
class SSHSQLConn:
def __init__(
self,
db_uname="wolf_rendall",
@reidransom
reidransom / python-web-developer.md
Last active September 16, 2020 16:28
Python web developer job posting

Python Web Developer (Remote)

At Premiere, we are working with a large dataset to build software solutions for order/status tracking, global pricing management, targeted marketing, and sales analytics.

We’re looking for a web developer experienced with Python and interested in learning new technologies to join our team. You’ll work with our remote team to build great products that delight the people using them.

Who you are...

  • You’re a critical thinker. You’re able to be highly effective with very few directions.
  • You have excellent communication skills. Most communication will be via email or Skype so you will need to convey your ideas clearly and concisely.
  • You are super smart and have either a degree in Computer Science or equivalent work experience.
grep -r <find> <path> | awk -F':' '{print $1}' | xargs sed -i 's/<find>/<replace>/g'
var casper = require('casper').create({
viewportSize: {
width: 1920,
height: 1080
},
verbose: true,
logLevel: 'debug'
});
var utils = require('utils');
@reidransom
reidransom / field.html
Created June 8, 2016 13:44
Simple Crispy Field Layout Template (Non-Radio/Checkbox)
{% load crispy_forms_field %}
<{% if tag %}{{ tag }}{% else %}div{% endif %} id="div_{{ field.auto_id }}" class="form-group{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if form_show_errors%}{% if field.errors %} has-error{% endif %}{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
{% if field.label and form_show_labels %}
<label for="{{ field.id_for_label }}" class="control-label {{ label_class }}{% if field.field.required %} requiredField{% endif %}">
{{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
</label>
{% endif %}
<div class="controls {{ field_class }}">
{% crispy_field field %}
@reidransom
reidransom / pre-commit.sh
Created March 28, 2016 19:07
Pre-commit hook to check for debug statements
#!/bin/sh
GREP_COLOR='4;5;37;41'
EXIT_STATUS=0
cd "$( dirname "$( dirname "$( dirname ${BASH_SOURCE[0]} )" )" )"
commitcheck () {
FILES=$1
FORBIDDEN=$2
@reidransom
reidransom / gist:f4b72503e714e4db00a0
Last active November 23, 2015 16:30
Replace-All for edX Courses
$ mongo
> show dbs #optional
> use edxapp
> show collections #optional
> db.modulestore.find({'_id.category':'html'}).snapshot().forEach( function (e) {
e.definition.data.data = e.definition.data.data.replace(/http\:\/\/docs\.google\.com/g, '//docs.google.com');
db.modulestore.save(e);
})
# A more complex replace
@reidransom
reidransom / gist:75927abacecabde58903
Created May 29, 2015 15:48
Normalize any object for json serialization
class NormalizeData(object):
SERIALIZABLE_TYPES = [str, int, bool, float, list, dict, type(None)]
def __init__(self, element):
self.element = element
def execute(self):
if isinstance(self.element, dict):
self.iterate_dict()

In your js:

;(function () {
    window.lcms = window.lcms || {}
    window.lcms.initSomething = function (config) {
        doStuffWith(config.var_name)
        $.ajax(config.whatever_url)
    }
}).call(this);
@reidransom
reidransom / gist:2c699837044898ec6227
Last active September 11, 2015 16:32
Setup a python3 venv
pyvenv-3.4 ~/venv/myvenv --without-pip
. ~/venv/myvenv/bin/activate
curl -O https://bootstrap.pypa.io/ez_setup.py
python ez_setup.py
easy_install pip