Skip to content

Instantly share code, notes, and snippets.

# For a comment on this SO answer: http://stackoverflow.com/a/19726078/781938
import pandas as pd
# create a DataFrame with two columns: 'a' and 'A'
data = pd.DataFrame({'a':[1],'A':[2]})
# print the result
print data
# prints:
@grisaitis
grisaitis / gist:172068ac532e13b46d8289e4838d04a2
Created October 3, 2018 19:19
Create postgres connection in python using `PG*` environment variables
import os
assert os.environ['PGUSER'] != '', os.environ
connection_string = \
'postgresql://{user}:{password}@{host}/{database}'.format(
user=os.environ['PGUSER'],
password=os.environ['PGPASSWORD'],
host=os.environ['PGHOST'],
database=os.environ['PGDATABASE'])
@grisaitis
grisaitis / demo.py
Last active August 25, 2022 15:22
Symbolic differentiation
from symdiff import Term, Polynomial
expression = "4x**3 - x"
polynomial = Polynomial.from_string(expression)
print("Polynomial:", polynomial)
print("Differentiated:", polynomial.differentiate())
@grisaitis
grisaitis / altair.ipynb
Last active August 25, 2022 15:22
altair.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@grisaitis
grisaitis / stackoverflow_question_22381497.ipynb
Created October 12, 2019 18:44
stackoverflow.com/questions/22381497
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@grisaitis
grisaitis / Readme.md
Last active December 11, 2019 20:46 — forked from underscorenygren/Readme.md
Metropolitan Opera Rush Ticket Sniper

What it is

The Met Sniper script is a simple way to get access to rush tickets from the Metropolitan Opera. It is a script you install, which will run on the rush tickets page, constantly reloading until it sees that tickets are available, and navigate you to the page where you can claim them.

This should give you enough time to complete the purchase flow.

How it works

@grisaitis
grisaitis / tcga_bigquery_tables.ipynb
Created August 25, 2022 15:13
demo of GDC's google buckets with TCGA data, and their BigQuery tables with metadata thereof
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
'''
script to fetch all GCS URIs of diagnostic whole slide images of TCGA SKCM, to copy to your google bucket
'''
from io import StringIO
import json
import pandas as pd
import requests