Skip to content

Instantly share code, notes, and snippets.

View jtotoole's full-sized avatar

James O'Toole jtotoole

View GitHub Profile
@jtotoole
jtotoole / superset_config.py
Created May 21, 2020 18:54
superset configuration file
import os
import random
import string
from flask_appbuilder.const import AUTH_DB
def randomString(stringLength=10):
letters = string.ascii_lowercase
return ''.join(random.choice(letters) for i in range(stringLength))
@jtotoole
jtotoole / superset_init_error.txt
Last active May 20, 2020 22:15
superset init error
2020-05-20 22:07:50,651:INFO:root:Creating database reference for examples
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/cryptography/utils.py", line 36, in _check_byteslike
memoryview(value)
TypeError: memoryview: a bytes-like object is required, not 'NoneType'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1175, in _execute_context
context = constructor(dialect, self, conn, *args)
File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 862, in _init_compiled
@jtotoole
jtotoole / keybase.md
Created July 12, 2018 22:33
keybase.md

Keybase proof

I hereby claim:

  • I am jtotoole on github.
  • I am jtotoole (https://keybase.io/jtotoole) on keybase.
  • I have a public key ASALgS9mN_FttonRyPfdvXA0KiDkG1Js82cxCUSz5JL51go

To claim this, I am signing this object:

The right way

<link rel="canonical" href="www.example.com/article"/>
<meta property="og:url" content="www.example.com/article"/>
<meta name="twitter:url" value="(some link that redirects to www.example.com/article)"/>

The wrong way

GET casterisk-articles/_search?timeout=480000
{
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"term": {
"apikey" : "agenda.weforum.org"
GET casterisk-1day-2016.01,casterisk-1day-2016.02,casterisk-1day-2016.03,casterisk-1day-2016.04,casterisk-1day-2014.04,casterisk-1day-2014.05,casterisk-1day-2014.06,casterisk-1day-2014.07,casterisk-1day-2014.08,casterisk-1day-2014.09,casterisk-1day-2014.10,casterisk-1day-2014.11,casterisk-1day-2014.12,casterisk-1day-2015.*,casterisk-raws,casterisk-5min-2016.04.18,casterisk-5min-2016.04.15,casterisk-5min-2016.04.17,casterisk-5min-2016.04.14,casterisk-5min-2016.04.16,casterisk-5min-2016.04.19/url/_search?ignore_unavailable&timeout=60000&search_type=count&routing=cmswire.com
{
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"term": {
"apikey": "cmswire.com"
@jtotoole
jtotoole / wp-bugfix.php
Created April 13, 2016 18:55
Fix for bug in Parse.ly Wordpress plugin
private function get_categories($postId, $delimiter='/') {
$tags = array();
$categories = get_the_category($postId);
foreach( $categories as $category ) {
$hierarchy = get_category_parents($category, FALSE, $delimiter);
$hierarchy = rtrim($hierarchy, '/');
array_push($tags, $hierarchy);
}
// take last element in the hierarchy, a string representing the full parent->child tree,
// and split it into individual category names