Skip to content

Instantly share code, notes, and snippets.

@bkreider
bkreider / nginx.conf
Created February 19, 2020 18:27
Resty proxy domain socket to conda
server {
listen unix:/tmp/conda.sock;
root /Users/bkreider/mine/resty/html;
location / {
# conda
proxy_pass https://repo.anaconda.com/;
proxy_pass_header Server;

Keybase proof

I hereby claim:

  • I am bkreider on github.
  • I am bkreider (https://keybase.io/bkreider) on keybase.
  • I have a public key ASDTruum1_oiV2cChOTQoJtzGJcCnh8p5SjaEWPTN3PHvwo

To claim this, I am signing this object:

"""
Generally used like this:
1. fab show_status # shows mongo replication status
2. fab kill_master # kills the current master - only if the replicaset has no failures, see "safe" flag
3. fab start_down_mongo # brings up down machine
"""
import os.path
import subprocess
from pyspark import SparkContext
from pyspark import SparkConf
import os
import sys
if __name__ == "__main__":
conf = SparkConf()
conf.setAppName("version-check")
#!/usr/bin/env python
import os
import sys
import stat
import os.path
import getpass
def walktree(top, callback):
@bkreider
bkreider / conda-build
Created October 27, 2014 18:43
increment conda build number
#!/opt/anaconda/bin/python
"""
Check to see if the build number conflicts with a local built package. If
so, set the ENVIRON variable BINSTAR_BUILD with a non-conflicting number
"""
import os
import sys
import os.path
import subprocess
@bkreider
bkreider / ripython.sh
Created June 14, 2014 22:10
remote ipython
#!/bin/bash
#
# remote ipython:
#
# This starts a remote ipython kernel. Downloads the kernel connection file,
# and starts a local ipython console connected to the remote machine.
#
# Features:
# - Automatically starts remote kernel
# - Copies remote file into ~/.ripython/<hostname.json>
@bkreider
bkreider / ipython_name.py
Created June 14, 2014 20:38
Ipython notebook name
# http://stackoverflow.com/questions/12544056/how-to-i-get-the-current-ipython-notebook-name
import json
import os
import urllib2
import IPython
from IPython.lib import kernel
connection_file_path = kernel.get_connection_file()
connection_file = os.path.basename(connection_file_path)
kernel_id = connection_file.split('-', 1)[1].split('.')[0]
@bkreider
bkreider / vz_setup
Created June 5, 2014 14:22
VZ configuration
def configure_vzkernel():
def run_in_vz(veid, cmd):
# Use pty so commands with sudo in them work
sudo("vzctl exec %s '%s'" % (veid, cmd), pty=True)
log.info("Downloading Centos6 VZ template")
sudo("wget http://download.openvz.org/template/precreated/centos-6-x86_64.tar.gz")
sudo("mv centos-6-x86_64.tar.gz /vz/template/cache")
@bkreider
bkreider / gist:678372e271e9c4c81fa2
Created June 5, 2014 14:21
Stunnel configuration
def setup_stunnel():
sudo("rm -f /etc/stunnel/stunnel.conf")
put("stunnel.conf", "/etc/stunnel/stunnel.conf", use_sudo=True)
sudo("rm -f /etc/init.d/stunnel")
put("stunnel", "/etc/init.d/stunnel", use_sudo=True)
sudo("chkconfig stunnel on")
with settings(warn_only=True):
sudo("mkdir -p /var/run/stunnel")
sudo("chown nobody:nobody /var/run/stunnel")