Skip to content

Instantly share code, notes, and snippets.

@brianv0
brianv0 / macs.txt
Created August 26, 2015 19:48
Macs at SLAC
1. Active Directory, which is enabled by this, may break Kerberos/kinit/AFS from your mac. Mostly, kinit is used by Active Directory and kinit remembers the last domain you used if you omit the username and password, and your mac will frequently kinit to [email protected], so when you go to kinit without parameters, it will kinit to the windows kerberos server. I think you may be able to just alias kinit to 'kinit [email protected]', provider you have the correct kerberos configuration (I can provide you with one). AFS installation is tricky, but it does in fact work on macs.
1a. I've noticed long delays occasionally when logging in/out of my machine, and this seems to be exacerbated when using a Mac remotely over spotty wifi. This is apparently a known issue on Macs.
2. A Case-Insensitive file system is the default on a Mac, but if you manually reinstalled your OS with a case-sensitive file system, CrashPlan won't work out of the box. There is a fix for this:
http://support.code42.com/CrashP
@brianv0
brianv0 / macs.txt
Created August 26, 2015 19:48
Macs at SLAC
1. Active Directory, which is enabled by this, may break Kerberos/kinit/AFS from your mac. Mostly, kinit is used by Active Directory and kinit remembers the last domain you used if you omit the username and password, and your mac will frequently kinit to [email protected], so when you go to kinit without parameters, it will kinit to the windows kerberos server. I think you may be able to just alias kinit to 'kinit [email protected]', provider you have the correct kerberos configuration (I can provide you with one). AFS installation is tricky, but it does in fact work on macs.
1a. I've noticed long delays occasionally when logging in/out of my machine, and this seems to be exacerbated when using a Mac remotely over spotty wifi. This is apparently a known issue on Macs.
2. A Case-Insensitive file system is the default on a Mac, but if you manually reinstalled your OS with a case-sensitive file system, CrashPlan won't work out of the box. There is a fix for this:
http://support.code42.com/CrashP
@brianv0
brianv0 / git-backup.bash
Created September 12, 2015 00:45
Git repository backup and bundler
#!/bin/bash
repolist="$1"
while IFS='' read -r repo || [[ -n "$repo" ]]; do
local_dir=$(basename "$repo")
if [ -e "$local_dir" ]; then
echo "Repo exists, updating $local_dir..."
git --git-dir $local_dir remote update
else
@brianv0
brianv0 / complete-example.sql
Last active February 12, 2025 14:13
Intro to SQL
DROP TABLE Event;
DROP TABLE Run;
-- SQLite actually turns foreign keys off by default
PRAGMA foreign_keys = ON;
CREATE TABLE Run (
id INTEGER PRIMARY KEY,
startTime DATETIME,
quality VARCHAR
@brianv0
brianv0 / PathUtils.java
Created September 28, 2015 22:33
PathUtils
package org.srs.vfs;
import java.nio.file.InvalidPathException;
/**
*
* @author bvan
*/
public class PathUtils {
@brianv0
brianv0 / howiswho.py
Last active March 2, 2016 01:58
Find "Who is Hiring" posts
import os
import bs4
import requests
import re
import time
def get_page(href):
print "Getting page:" + href
time.sleep(2)
if not href:
@brianv0
brianv0 / nsortfolders.py
Created October 20, 2015 17:50
Retrieve Numeric Folders from datacat and sort them numerically
from datacat import client_from_config_file
from datacat.model import Folder
import os
client = client_from_config_file()
def is_valid_folder(child):
try:
if isinstance(child, Folder) and float(child.name):
return True
@brianv0
brianv0 / example.py
Created October 22, 2015 22:24
HMAC SRS Auth
from auth import HMACAuthSRS
import requests
key_id = "..." #
secret_key = "..." #
url = "http://somewhere.slac.stanford.edu/SomeApplication"
auth = HMACAuthSRS(key_id, secret_key, url)
# See http://docs.python-requests.org/en/latest/user/quickstart/
@brianv0
brianv0 / app.py
Created December 4, 2015 00:40
Basic Flask App
from flask import Flask
app = Flask(__name__)
from toy import toy_blueprint
app.register_blueprint(toy_blueprint)
if __name__ == '__main__':
app.run()
@brianv0
brianv0 / installer.py
Last active January 8, 2016 20:40
sconsinstaller
import httplib
#import logging
#logging.basicConfig(level=logging.DEBUG)
#httplib.HTTPConnection.debuglevel = 1
def getData( request ):
'''queries the database for the requested information'''
servername = "glast-ground.slac.stanford.edu"
conn = httplib.HTTPConnection( servername )
conn.putrequest( 'GET', request )