Skip to content

Instantly share code, notes, and snippets.

View MilesDowe's full-sized avatar

Miles Dowe MilesDowe

View GitHub Profile
@MilesDowe
MilesDowe / run_pipenv_in_running_jupyter_instance.md
Last active August 18, 2022 20:46
A way to specify a pipenv environment while in a running Jupyter Lab/Notebook/Hub instance.

Steps grabbed from: https://stackoverflow.com/a/47296960

Adding a kernel based on your venv

Inside of your target venv workspace:

pipenv install ipykernel
pipenv run python -m ipykernel install --user --name=<name-of-pipenv-venv>
@smparekh
smparekh / config.fish
Last active May 10, 2022 16:52
Using CodeArtifact as Pypi mirror for Pipenv
set -x AWS_PROFILE default # replace
set -x AWS_REGION us-east-1 # replace
set -x CODEARTIFACT_DOMAIN foo # replace
set -x CODEARTIFACT_DOMAIN_ID 123456789 # replace
set -x CODEARTIFACT_REPOSITORY somepypi # replace
function codeartifact_login
set -Ux CODEARTIFACT_TOKEN (aws --profile $AWS_PROFILE codeartifact get-authorization-token --domain $CODEARTIFACT_DOMAIN --domain-owner $CODEARTIFACT_DOMAIN_ID --query authorizationToken --output text)
set -Ux PIPENV_PYPI_MIRROR "https://aws:$CODEARTIFACT_TOKEN@$CODEARTIFACT_DOMAIN-$CODEARTIFACT_DOMAIN_ID.d.codeartifact.$AWS_REGION.amazonaws.com/pypi/$CODEARTIFACT_REPOSITORY/simple/"
end
#!/bin/bash
###
### my-script — does one thing well
###
### Usage:
### my-script <input> <output>
###
### Options:
### <input> Input file to read.
### <output> Output file to write. Use '-' for stdout.
@DGrady
DGrady / oracle-query.org
Last active March 21, 2024 11:57
Example of querying an Oracle database using Python, SQLAlchemy, and Pandas

Query Oracle databases with Python and SQLAlchemy

N.B. SQLAlchemy now incorporates all of this information in its documentation; I’m leaving this post here, but recommend referring to SQLAlchemy instead of these instructions.

Install requirements

  1. We’ll assume you already have SQLAlchemy and Pandas installed; these are included by default in many Python distributions.
  2. Install the cx_Oracle package in your Python environment, using either pip or conda, for example:
@mingfang
mingfang / convert id_rsa to pem
Last active July 20, 2024 14:14
Convert id_rsa to pem file
openssl rsa -in ~/.ssh/id_rsa -outform pem > id_rsa.pem
chmod 600 id_rsa.pem
@yasushiyy
yasushiyy / oracle.md
Last active February 26, 2020 05:13
Oracle Hacks

Not-so-known Oracle commands

Simulate ORA-600

Execute as SYSDBA.

execute dbms_system.ksdwrt(2,'ORA-600: test');

Output in alert.log:

@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 27, 2024 16:01
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@kgaughan
kgaughan / gist:2491663
Created April 25, 2012 17:54
Parsing a comma-separated list of numbers and range specifications in Python
from itertools import chain
def parse_range(rng):
parts = rng.split('-')
if 1 > len(parts) > 2:
raise ValueError("Bad range: '%s'" % (rng,))
parts = [int(i) for i in parts]
start = parts[0]
end = start if len(parts) == 1 else parts[1]
if start > end:
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream