Skip to content

Instantly share code, notes, and snippets.

View betodealmeida's full-sized avatar
💭
Code code code

Beto Dealmeida betodealmeida

💭
Code code code
View GitHub Profile
import random
fawmers = [
"beto",
"mahtowin",
"carleybaer",
"wylddandelyon",
"florian",
"donna",
"newukenewyork",
<script>
<![CDATA[
/*
* Firefox doesn't support `disable-output-escaping="yes"`,
* so we need to unescape the HTML content manually.
*
* See this bug ticket from 2001 (!): https://bugzilla.mozilla.org/show_bug.cgi?id=98168
*/
function isFirefox() {
return navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
@betodealmeida
betodealmeida / recover_source_code.md
Created May 17, 2024 15:47 — forked from simonw/recover_source_code.md
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
sql> SELECT assignees, labels, reactions, author_association FROM "https://api.github.com/repos/apache/superset/issues" WHERE assignees != '[]' AND labels != '[]' LIMIT 2;
assignees labels reactions author_association
---------------------------- ---------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ --------------------
["betodealmeida"] ["data:connect:drill"] [{"url": "https://api.github.com/repos/apache/superset/issues/27028/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0}] NONE
["mistercrunch", "rusackas"] ["P1"] [{"url":
import logging
from typing import Any, Dict, Generic, List
from flask_appbuilder import Model
from marshmallow import Schema, fields
from superset import security_manager
from superset.connectors.sqla.models import SqlaTable
from superset.datasets.dao import DatasetDAO
from superset.datasets.commands.exceptions import (
Loaded your LOCAL configuration at [/Users/beto/Projects/github/superset/superset_config.py]
Endpoint Methods Rule
------------------------------------------------ --------- -------------------------------------------------------------------------------------
AccessRequestsModelView.action_post POST /accessrequestsmodelview/action_post
AccessRequestsModelView.add GET, POST /accessrequestsmodelview/add
AccessRequestsModelView.delete GET, POST /accessrequestsmodelview/delete/<pk>
AccessRequestsModelView.edit GET, POST /accessrequestsmodelview/edit/<pk>
AccessRequestsModelView.list GET /accessrequestsmodelview/list/
AccessRequestsModelView.show GET /accessrequestsmodelview/show/<pk>
AlertView.list GET /alert/list/
@betodealmeida
betodealmeida / docker-superset_superset_config.py
Created June 6, 2022 20:54 — forked from PedroMartinSteenstrup/docker-superset_superset_config.py
Basic implementation of Snowflake pass-through authentication in Superset
# --------------------------------------
# Snowflake OAuth
# --------------------------------------
SNOWFLAKE_ACCOUNT = os.getenv('SNOWFLAKE_ACCOUNT') or None
if SNOWFLAKE_ACCOUNT:
SNOWFLAKE_SECURITY_INTEGRATION_CLIENT_ID = os.getenv('SNOWFLAKE_SECURITY_INTEGRATION_CLIENT_ID')
SNOWFLAKE_SECURITY_INTEGRATION_CLIENT_SECRET = os.getenv('SNOWFLAKE_SECURITY_INTEGRATION_CLIENT_SECRET')
SNOWFLAKE_OAUTH_AUTHORIZATION_ENDPOINT = f'https://{SNOWFLAKE_ACCOUNT}.snowflakecomputing.com/oauth/authorize'
// (*) All in the spirit of open-source and open-hardware
// Janost 2016 Sweden
 
// The Tiny-TS Touch Synthesizer
// https://janostman.wordpress.com/the-tiny-ts-diy-touch-synthesizer/
 
// Copyright 2016 DSP Synthesizers Sweden.
//
// Author: Jan Ostman
//
/* A MIDI pedal for the Critter & Guitari Organelle.
*
* An expression pedal sends CC numbers 21-24, depending on
* the switch pressed. A sustain pedal sends CC 25 to control
* the Aux button.
*/
#include <Bounce.h>
const int midiChannel = 15;
@betodealmeida
betodealmeida / asyncio_ssl_example.py
Created September 14, 2021 23:51 — forked from messa/asyncio_ssl_example.py
Python asyncio + SSL TCP client/server example
#!/usr/bin/env python3
import asyncio
import multiprocessing
import os
import ssl
from time import sleep
port = 9000