Skip to content

Instantly share code, notes, and snippets.

View rlcarrca's full-sized avatar

Robert Carr rlcarrca

View GitHub Profile
{
"basics": {
"name": "Robert L Carr",
"label": "",
"picture": "",
"email": "robertlcarr@gmail.com",
"phone": "(650) 430-5034",
"website": "http://registry.jsonresume.org/rlcarrca",
"summary": "An accomplished hands-on technologist offering over 20 years of demonstrated career success development. Experienced in all phases of software engineering and management from concept to continuing engineering: Market requirements, technology licensing, standards, architectural and engineering specifications, resource planning, recruiting, performance evaluations, budgets, scheduling, contract negotiation, customer support, etc.. Extensive experience leading operations for Technology and Application development within a diverse range of industries. Proven ability to conceptualize and deliver complex technology solutions. Strong understanding of the relationship between technology and strategic business interests. ",
"location": {
@rlcarrca
rlcarrca / app.py
Created February 23, 2018 16:11
Upload a file to the server using bottle
from __future__ import unicode_literals
import os
from bottle import route, request, static_file, run, response
@route('/')
def root():
return static_file('test.html', root='.')
@route('/upload', method='POST')
def do_upload():
def loadCommandLineArgs():
parser = argparse.ArgumentParser()
parser.add_argument("-r", "--regen", help="Generate reports for all dates",
default=False, action="store_true")
return parser.parse_args()
@rlcarrca
rlcarrca / python-paged-ldap-snippet-2.4.py
Created August 18, 2017 21:58 — forked from mattfahrner/python-paged-ldap-snippet-2.4.py
This snippet allows you to do a Python LDAP search with paged controls. The latest version now supports Python "ldap" 2.4. Many thanks to Ilya Rumyantsev for doing the 2.4 legwork.
#! /usr/bin/python
import sys
import ldap
from ldap.controls import SimplePagedResultsControl
from distutils.version import LooseVersion
# Check if we're using the Python "ldap" 2.4 or greater API
LDAP24API = LooseVersion(ldap.__version__) >= LooseVersion('2.4')
@rlcarrca
rlcarrca / auth.py
Created August 18, 2017 21:58 — forked from ibeex/auth.py
Python LDAP (ActiveDirectory) authentication
import ldap
def check_credentials(username, password):
"""Verifies credentials for username and password.
Returns None on success or a string describing the error on failure
# Adapt to your needs
"""
LDAP_SERVER = 'ldap://xxx'
# fully qualified AD user name
LDAP_USERNAME = '%s@xxx.xx' % username
@rlcarrca
rlcarrca / librets_install.txt
Created June 18, 2017 01:02 — forked from dmpeters/librets_install.txt
librets installations with python bindings only
# Debian 7 x64, Ubuntu 14.04 x64, Ubuntu 12.04.4 x64
*NOTE (tested on Digital Ocean VM's w/ > 512MB of RAM - gcc runs out of memory on VM's <= 512 MB)
apt-get update
aptitude safe-upgrade
apt-get install build-essential libboost-all-dev libcurl4-gnutls-dev autoconf antlr swig python-dev
*NOTE (for python 3 support add 'python3-dev' to the end of line 5)
cd /tmp
wget https://github.com/NationalAssociationOfRealtors/libRETS/archive/1.6.1.tar.gz
import sys
from boto.sqs.connection import SQSConnection
conn=SQSConnection('AWS_ACCESS_KEY_ID','AWS_SECRET_KEY')
q=conn.get_queue(sys.argv[1])
attrib = q.get_attributes("ApproximateNumberOfMessages")
print int(attrib['ApproximateNumberOfMessages'])
Go to: chrome://settings/searchEngines
Add a new search engine with the following settings
Gif | Gif | https://www.google.com/search?q=%s&tbm=isch&tbs=itp:animated
Type gif in the address bar press TAB and enter your search query
'''
Determination of the day of the week
Jan 1st 1 AD is a Monday in Gregorian calendar.
So Jan 0th 1 AD is a Sunday [It does not exist technically].
Every 4 years we have a leap year. But xy00 cannot be a leap unless xy divides 4 with reminder 0.
y/4 - y/100 + y/400 : this gives the number of leap years from 1AD to the given year. As each year has 365 days (divdes 7 with reminder 1), unless it is a leap year or the date is in Jan or Feb, the day of a given date changes by 1 each year. In other case it increases by 2.
y -= m<3 : If the month is not Jan or Feb, we do not count the 29th Feb (if it exists) of the given year.
So y + y/4 - y/100 + y/400 gives the day of Jan 0th (Dec 31st of prev year) of the year. (This gives the reminder with 7 of the number of days passed before the given year began.)
@rlcarrca
rlcarrca / get_metadata.sh
Last active May 6, 2023 03:57
RETS server connectivity via curl
curl \
--digest \
--user-agent "MyCurlClient/1.0" \
-o data/metadata.xml \
--show-error \
--dump-header data/headers.txt \
-u "username:password" \
--header "RETS-Version: RETS/1.5" \
--cookie-jar data/cookies.txt \
--cookie data/cookies.txt \