Skip to content

Instantly share code, notes, and snippets.

{
"c_key": "ConsumerKey",
"c_sec": "ConsumerSecret",
"t_key": "TokenKey",
"t_sec": "TokenSecret"
}
// compile with g++-4.7 -std=c++11 -pthread threadtest.cpp -o threadtest
#include <iostream>
#include <thread>
#include <cstdlib>
#include <chrono>
static const int num_threads = 10;
int main() {
package main
import (
"math/rand"
)
// mux takes two streams and turns them into one stream
func merge(a, b chan []byte) chan []byte {
o := make(chan []byte)
go func() {

I was chasing down another issue (slow "Save As") and thought these two issues may have been related (with QuickLook being the common broken link). Unfortunately, my "Save As" dialog is still miserably slow on the initial load; but IconServicesAgent hasn't gone above 30MB and he rarely makes an appearance in the Console!

Some of these steps may not be necessary, but here are all of the steps I took that inadverdently put IconServicesAgent back in its place. Note: all commands are a single-line, if they appear to be multiple that's just the forum formatting.

  1. Check for any QuickLooks related .plist files. In a terminal: mdfind com.apple.quicklook. -name .plist

  2. I only had files at the system level (specifically within /System/Library/LaunchAgents/). If you have others, modify the directions below to take that into account (re-introducing plist files from the system level back up to the user).

  3. Make some temporary directories to store these plist files, just in case: mkdir ~/tmp-quicklook

# Two very basic functions for searching just the input code of an IPython notebook
# Written because I often want to search notebooks for snippets but the giant output
# of embedded encoded images makes it difficult.
# Ipython's nbconvert can be used to extract just the input, but this requires
# writing to a separate file and can be quite slow when used with large notebooks.
# Additionally, find/xargs can be used with igrep when the name of the notebook isn't known.
# icat could be used to convert an IPython notebook to a standard python file if
# the notebook does not contain whole-cell magics.
  1. General Background and Overview
# MAB Algos by Sergey Feldman
import numpy as np
from matplotlib import pylab as plt
#from mpltools import style # uncomment for prettier plots
#style.use(['ggplot'])
# generate all bernoulli rewards ahead of time
def generate_bernoulli_bandit_data(num_samples,K):
CTRs_that_generated_data = np.tile(np.random.rand(K),(num_samples,1))
object ABTest extends App{
case class Rate(successes:Int, failures:Int) {
override def toString = "[Successes: %d, Failures: %d]".format(successes, failures)
}
def BbeatsA(a:Rate, b:Rate) = {
val mu = Beta(1 + a.successes, 1 + a.failures).mean - Beta(1 + a.failures, 1 + b.failures).mean
val sigma = math.pow(Beta(1 + a.successes, 1 + a.failures).variance + Beta(1 + b.successes, 1 + b.failures).variance, 0.5)
100.0 * Gaussian.cdf(0, mu, sigma)
# -*- coding: utf-8 -*-
"""
LICENSE: BSD (same as pandas)
example use of pandas with oracle mysql postgresql sqlite
- updated 9/18/2012 with better column name handling; couple of bug fixes.
- used ~20 times for various ETL jobs. Mostly MySQL, but some Oracle.
to do:
save/restore index (how to check table existence? just do select count(*)?),
finish odbc,
import numpy as np
import os
import sys
from collections import defaultdict
from git import Repo
from scipy.sparse import csc_matrix
path = sys.argv[1]
extensions = [".py", ".pyx", ".pxd"]