Skip to content

Instantly share code, notes, and snippets.

View guenp's full-sized avatar

Guen Prawiroatmodjo guenp

View GitHub Profile
@guenp
guenp / motherduck_client.py
Last active December 12, 2024 17:42 — forked from d3rpd3rp/gist:244eb8c0aea66ce12c5696644f2cb772
example class for cursor factory
import threading
from duckdb import DuckDBPyConnection
# from duckdb_provider.hooks.duckdb_hook import DuckDBHook
import duckdb
SHARE_URI = "md:_share/s2/7564f992-2f93-4799-bce2-1637445b2881"
DB_PATH = "md:"
@guenp
guenp / README.md
Created December 2, 2024 21:22
Minimal `dbt-duckdb` example with MotherDuck

dbt-example-motherduck

Prerequisites

This example requires Poetry. You can use pipx with pipx install poetry to install it. For further instructions, see docs.

Instructions

To get started with a sample project using dbt and MotherDuck, first create and activate a new Python environment using Poetry.

@guenp
guenp / README.md
Last active November 28, 2024 13:42
"A Duck in the hand is worth two in the Cloud: Data preparation and analytics on your laptop with DuckDB" demo

"A Duck in the hand is worth two in the Cloud: Data preparation and analytics on your laptop with DuckDB" demo

Link to slides

This is the code used for the demo.

To download the EBD data, go to https://ebird.org/data/download/ebd.

To create a new virtual environment and install the dependencies, run

@guenp
guenp / README.md
Last active October 15, 2021 07:22
Grover's algorithm: Large circuit with repeating blocks
@guenp
guenp / circuit.json
Last active October 15, 2021 07:21
Teleport: Simple example with classical feedback
{
"qubits": [
{
"id": 0,
"numChildren": 1
},
{
"id": 1,
"numChildren": 1
},
@guenp
guenp / .block
Created October 14, 2021 04:39 — forked from mbostock/.block
Force-Directed Graph
license: gpl-3.0
height: 600
redirect: https://observablehq.com/@d3/d3-force-directed-graph
@guenp
guenp / Dockerfile
Last active October 9, 2021 19:29
Girls Who Code Saturday Morning Oct 10th 2021
# This uses the latest Docker image built from the samples repository,
# defined by the Dockerfile in Build/images/samples.
FROM mcr.microsoft.com/quantum/samples:latest
# Mark that this Dockerfile is used with the samples repository.
ENV IQSHARP_HOSTING_ENV=SAMPLES_HOSTED
# Make sure the contents of our repo are in ${HOME}.
# These steps are required for use on mybinder.org.
USER root
@guenp
guenp / README.md
Created September 30, 2021 19:06 — forked from adamelliotfields/windows-ssh-no-password-with-keys-wsl2.md
Windows SSH Server with Password-less Key Authentication and Default WSL2 Shell

Windows SSH Server with Password-less Key Authentication and Default WSL2 Shell

Disclaimer: I am not a Windows Admin and I'm not even that good with PowerShell.

I wanted to be able to SSH into my Windows laptop directly into Linux. I also wanted to disable password authentication and only allow public key (RSA in my case) authentication.

Scott Hanselman wrote a blog post on how to make your default WSL2 distro your default shell for SSH. Windows OS Hub published an article on using public key

@guenp
guenp / Dockerfile.ssh
Created April 1, 2020 03:48
Docker container with SSH for remote PyCharm interpreter
RUN apt-get update && apt-get install -y openssh-server
RUN mkdir /var/run/sshd
ARG DOCKER_SSH_PASS
RUN echo "root:${DOCKER_SSH_PASS}" | chpasswd
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
@guenp
guenp / simple_args_parsing.sh
Created May 25, 2019 00:25 — forked from jehiah/simple_args_parsing.sh
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"