Skip to content

Instantly share code, notes, and snippets.

View rsubra13's full-sized avatar
🎯
Focusing

Ramki Subramanian rsubra13

🎯
Focusing
  • Arizona State University
  • Vancouver
View GitHub Profile
@oinopion
oinopion / read-access.sql
Created October 5, 2016 13:00
How to create read only user in PostgreSQL
-- Create a group
CREATE ROLE readaccess;
-- Grant access to existing tables
GRANT USAGE ON SCHEMA public TO readaccess;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
-- Grant access to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess;
@dmpayton
dmpayton / food_reminder.py
Created April 21, 2014 22:32
Food Reminder
#!/usr/bin/env python
"""
Sends an SMS reminder to eat food at 10a, 1p, 4p, 7p, and 10p.
cron: 0 10,13,16,19,22 * * * /path/to/food_reminder.py
"""
from twilio.rest import TwilioRestClient
@robcowie
robcowie / mysqldb_query_generator.py
Created February 7, 2011 16:05
Memory-efficient, streaming query generator with MySQLdb
from MySQLdb.cursors import SSDictCursor
def iterate_query(query, connection, arraysize=1):
c = connection.cursor(cursorclass=SSDictCursor)
c.execute(query)
while True:
nextrows = c.fetchmany(arraysize)
if not nextrows:
break