Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

José Antunes theholy7

🎯
Focusing
View GitHub Profile
@theholy7
theholy7 / sql_to_df.py
Last active Sep 8, 2018
psycopg2, pandas and python
View sql_to_df.py
import os
import pandas.io.sql as sqlio
import psycopg2
from dotenv import load_dotenv, find_dotenv
load_dotenv(find_dotenv())
SQL_USER = os.environ.get('SQL_USER')
SQL_PASS = os.environ.get('SQL_PASS')
@theholy7
theholy7 / firefox_update.md
Created Apr 10, 2019
Update Firefox in Ubuntu (download and command line instructions)
View firefox_update.md

First, download firefox. Then:

$ # Untar the download
$ tar xjf firefox-<version-num>.tar.bz2
$ # Remove current firefox
$ sudo rm -r /opt/firefox
$ # Move new firefox to old firefox location
$ sudo mv ~/Downloads/firefox /opt/firefox
View authed_resource.py
class AuthorizedResource(Resource):
"""
We created this AuthorizedResource from Resource
because the user authorization was being made after payload
validation. This way a non-auth'ed user was able to sniff the
payload that was required by the endpoint.
By wrapping dispatch_request with the requires_auth function,
we check for user authentication first.
"""
@requires_auth
@theholy7
theholy7 / mysql_loadtest.py
Created Jun 19, 2020
Load testing script for MySQL database
View mysql_loadtest.py
import time
import logging
from locust import TaskSet, User, between, task, events
import mysql.connector
TEST_QUERY = '''
SELECT COUNT(*) FROM YOUR_TABLE_HERE;
'''
You can’t perform that action at this time.