Skip to content

Instantly share code, notes, and snippets.

@redanium
redanium / fields.py
Created March 27, 2022 02:16 — forked from yprez/fields.py
Django rest framework - Base64 image field
import base64
from django.core.files.base import ContentFile
from rest_framework import serializers
class Base64ImageField(serializers.ImageField):
def from_native(self, data):
if isinstance(data, basestring) and data.startswith('data:image'):
# base64 encoded image - decode
// show pdf in the editor
// pdf is uploaded using the video/media button
// then its tag is converted from video to pdf at beforeSetContent
tinymce.init({
selector: 'textarea#Description',
plugins: 'print preview fullpage paste importcss searchreplace autolink autosave save directionality code visualblocks visualchars fullscreen image link media codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists wordcount imagetools textpattern noneditable help charmap quickbars emoticons ',
menubar: 'file edit view insert format tools table help',
@redanium
redanium / bluetooth_serial.md
Created September 19, 2022 22:26 — forked from 0/bluetooth_serial.md
Connecting a Bluetooth device for serial communication on Arch Linux.

The following are instructions for connecting a Bluetooth device for serial communication on Arch Linux using BlueZ 5.31.

Prerequisites

The following packages are required:

  • bluez: bluetoothd
  • bluez-utils: bluetoothctl, rfcomm
@redanium
redanium / ideviceforward
Created October 21, 2022 01:25 — forked from gabrc52/ideviceforward
Forward iOS device from host to guest (OSX-KVM)
#!/bin/bash
# Debug
set -o xtrace
GUEST_IP=192.168.122.221
HOST_IP=192.168.122.1
# Wipe the current usbfluxd, usbmuxd, and socat:
sudo killall usbfluxd
@redanium
redanium / graph_models.md
Created November 4, 2022 01:30 — forked from rg3915/graph_models.md
Generate graphic model Django with PyGraphViz pygraphviz pydot generate model graph model 2020

How to generate graphic model Django with PyGraphViz?

sudo apt-get install -y graphviz libgraphviz-dev pkg-config
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install pygraphviz
pip uninstall pyparsing
pip install -Iv https://pypi.python.org/packages/source/p/pyparsing/pyparsing-1.5.7.tar.gz#md5=9be0fcdcc595199c646ab317c1d9a709
@redanium
redanium / medusa-config.js
Created December 18, 2023 16:54 — forked from vladimirpekez/medusa-config.js
Medusa config /backend/medusa-config.js
const dotenv = require("dotenv");
let ENV_FILE_NAME = "";
switch (process.env.NODE_ENV) {
case "production":
ENV_FILE_NAME = ".env.production";
break;
case "staging":
ENV_FILE_NAME = ".env.staging";
break;

How to enable embedded Superset dashboards in React/Next.js with CSV exporing

Permissions settings on Gamma role:

For Gamma role:

  • can read on EmbeddedDashboard
  • can export on Chart
  • can export on Dashboard
  • can csv on Superset
  • can this form get on CsvToDatabaseView
  • can this form post on CsvToDatabaseView (probably not required but I have it set)