Skip to content

Instantly share code, notes, and snippets.

Avatar

Robert Frazier robfraz

View GitHub Profile
View using_ssh_keys_with_github.md

1. Generate an SSH key-pair

First up, generate yourself an SSH key pair - unless you already have one you can reuse, in which case skip this step.

Notes on this step:

  • Replace anything in block caps below with something meaningful - it's just a comment that gets stored with the key to help you tell what it's used for in the future.
  • It will ask you if you want to password-protect (i.e. encrypt) the private half of the key pair. If you're using a Mac, I recommend you set a password as Git integrates with the MacOS keychain really nicely. I'm not familiar with how to setup 'transparent' password-protected private keys on other operating systems, so best to just set no password unless you know what you're doing.
ssh-keygen -t rsa -b 4096 -C "YOUR_NAME github key YOUR_EMAIL_ADDRESS@DOMAIN.COM" -f ~/.ssh/id_rsa_github
@robfraz
robfraz / df_to_bigquery_example.py
Last active Apr 19, 2018
Example upload of Pandas DataFrame to Google BigQuery via temporary CSV file
View df_to_bigquery_example.py
from pathlib import Path
from tempfile import NamedTemporaryFile
import numpy as np
import pandas as pd
from google.cloud.bigquery import Client, SchemaField
def main():
View gist:7884543
[01:45:18][rob@Pestilence2] ~/cloudant/dbcore> cat rel/remsh
#!/bin/bash
if [ -z $NODE ]; then
if [ -z $1 ]; then
NODE=1
else
NODE=$1
fi
fi
@robfraz
robfraz / gist:5564935
Created May 12, 2013
check bulk insert
View gist:5564935
def check_bulk_insert(self, response):
# Some basic checks
assert_that(response.status_code, is_(accepted()),
"Bulk docs POST failed")
assert_that(response.json(), is_(instance_of(list)),
"Bulk docs insert didn't return a list")
# Now ensure that none of the individual document inserts had an error.
if type(response.json()) == list:
for insert_result in response.json():
View pythonrc.py
import inspect
import sys
def src(obj):
"""Read the source of an object in the interpreter."""
def highlight(source):
try:
import pygments
You can’t perform that action at this time.