Skip to content

Instantly share code, notes, and snippets.

View pplonski's full-sized avatar
😄
Enjoy programming and writing

Piotr pplonski

😄
Enjoy programming and writing
View GitHub Profile
@korakot
korakot / js_link.py
Created August 6, 2018 04:38
Calling python function from JS in Colab
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yangshun
yangshun / docusaurus-copy-button.md
Last active April 4, 2023 07:07
How to add the "Copy" button to code blocks in Docusaurus

Adding "Copy" (to Clipboard) Button

If you would like to add a button to your fenced code blocks so that users may copy the code, you can do so in Docusaurus. You will have to add some code to your Docusaurus project, as seen below.

Under static/js, create a file called code-block-buttons.js with the following:

// Turn off ESLint for this file because it's sent down to users as-is.
/* eslint-disable */
window.addEventListener('load', function() {
import openml
import pandas as pd
openml.config.apikey = "aaas8a89sd87as87d8as7d98a" # it is some fake API key, please set your key here!
dataset_id = 1590 # Adults data set, see https://www.openml.org/d/1590
# get data directly fom openml
dataset = openml.datasets.get_dataset(dataset_id)
(X, y, categorical, names) = dataset.get_data(
@pplonski
pplonski / read_only_user_in_postgres.sql
Created March 4, 2019 10:42
Read only user in postgres database
-- 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;
import numpy as np
import pandas as pd
from sqlalchemy import create_engine
import psycopg2
import time
host = "host-address-here"
user = "db-user-here"
password = "db-password"
db = "db-name"
@rmiyazaki6499
rmiyazaki6499 / deploy-django.md
Last active May 8, 2024 08:00
Deploying a Production ready Django app on AWS

Deploying a Production ready Django app on AWS

In this tutorial, I will be going over to how to deploy a Django app from start to finish using AWS and EC2. Recently, my partner Tu and I launched our app Hygge Homes (a vacation home rental app for searching and booking vacation homes based off Airbnb) and we wanted to share with other developers some of the lessons we learned along the way.

Following this tutorial, you will have an application that has:

  • An AWS EC2 server configured to host your application
  • SSL-certification with Certbot
  • A custom domain name
  • Continuous deployment with Github Actions/SSM Agent
@pplonski
pplonski / dashboard_mercury.ipynb
Created February 26, 2022 14:14
Dashboard Notebook with Mercury
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.