Skip to content

Instantly share code, notes, and snippets.

@robfraz
robfraz / using_ssh_keys_with_github.md
Created April 4, 2018 09:30
Using SSH keys with GitHub

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 April 19, 2018 10:47
Example upload of Pandas DataFrame to Google BigQuery via temporary CSV file
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():
#
# Copyright 2009 New England Biolabs <davisp@neb.com>
#
# This file is part of the nebgb package released under the MIT license.
#
import calendar
import datetime
import itertools
import re
@danieleggert
danieleggert / GPG and git on macOS.md
Last active April 22, 2024 07:46
How to set up git to use the GPG Suite

GPG and git on macOS

Setup

No need for homebrew or anything like that. Works with https://www.git-tower.com and the command line.

  1. Install https://gpgtools.org -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for https://keybase.io
  3. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  4. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys
@appeltel
appeltel / openssl_fix_python_crypto_osx10.11.sh
Last active July 29, 2016 12:32
Get openssl deps working for python crypto on OSX 10.11 with brew
# remove your wheels
rm -r ~/Library/Caches/pip/wheels/*
# update brew
brew update
brew upgrade
brew install openssl #if needed
brew unlink openssl #if needed
# add some flags variables to your environment so your builds
# can find openssl headers and shared libs
export ARCHFLAGS="-arch x86_64"
./runtesty.py -i suites/replication/test_many_repl.py -f ~/auth-testy003.json --db_name=fizz --db_url=testy003-admin.cloudant.com/fizz --timeout=700
even if all replications finish (which is rare) bogged down dbs make test hang trying to clean up
@vinoski
vinoski / fd_setsize_on_osx.md
Last active November 7, 2017 06:20
How to raise the maximum number of file descriptors when building Erlang/OTP on OS X.

When you build Erlang/OTP on OS X, it unfortunately defaults to handling a maximum of 1024 file descriptors. You can get around this limitation with the right combination of configuration options and manual changes to a generated config file.

First, go into your unpacked Erlang/OTP source directory and run the following command, replacing the value 10000 with whatever value you want for max file descriptors:

perl -i -pe 's/(define\s+FD_SETSIZE\s+)\d+/\1 10000/' erts/config.h.in 

Next, when you run configure in your Erlang/OTP source directory, be sure to include the right CFLAGS setting, as shown below:

CFLAGS='-DREDEFINE_FD_SETSIZE -DFD_SETSIZE=15000 -D_DARWIN_UNLIMITED_SELECT' ./configure --enable-kernel-poll <other options>
@zacharyvoase
zacharyvoase / pythonrc.py
Created May 4, 2011 13:31 — forked from benhodgson/pythonrc.py
Python startup file with completion, history and colored source browsing.
import inspect
import sys
def src(obj):
"""Read the source of an object in the interpreter."""
def highlight(source):
try:
import pygments