This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scipy.stats import pearsonr | |
from random import choice | |
def experiment(max_family_size, trials_per_family_size): | |
number_of_sibs = [] | |
not_firstborn = [] | |
for num_sibs in range(1,max_family_size+1): | |
for subject in range(trials_per_family_size): | |
birthrank = choice(range(num_sibs)) | |
number_of_sibs.append(num_sibs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from turtle import * | |
from cmath import phase | |
# TODO: use _multiple turtles_ to trace points with different escape times (awesome) | |
# TODO: optimize sort order to avoid awkward radial lines | |
def z_n_escape_time(c, n): | |
z = 0 | |
for i in range(n): | |
z = z**2 + c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/share/sage-4.8-linux-64bit-ubuntu_10.04.3_lts-x86_64-Linux/sage | |
from math import cos, sin, exp, pi, e | |
from sage.all import * | |
# Terrible ad hoc code follows | |
x1 = var('x1') | |
x2 = var('x2') | |
x3 = var('x3') | |
x4 = var('x4') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
#Change this to your username to run this script for you. | |
#Make sure it makes the name in the 'lesswrong.com/user/USERNAME/comments/ url. | |
username = "Will_Newsome" | |
def parse_page url | |
puts $pages |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from subprocess import check_output | |
def factorize(n): | |
if n == 0 or n == 1: | |
return {} | |
output = check_output(["factor", str(n)]).decode('utf-8') | |
factors = list(map(int, output.split(": ")[1].split(' '))) | |
factorization = {(f, factors.count(f)) for f in set(factors)} | |
return factorization |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def has_many(self, association, class_name, foreign_key = None, primary_key = "id"): | |
foreign_key = foreign_key or self.__class__.__name__.lower()+"_id" | |
search = lambda: eval(class_name).where({foreign_key: self.__dict_[primary_key]}) | |
setattr(self, association, search) | |
def belongs_to(self, association, class_name, foreign_key = None, primary_key = "id"): | |
foreign_key = foreign_key or class_name.lower()+"_id" | |
search = lambda: eval(class_name).where({primary_key: self.__dict__[foreign_key]}) | |
setattr(self, association, search) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# using cURL works fine ... | |
Jons-MacBook-Pro:deploy zmd$ curl -X GET -H "X-Auth-Token: $TOKEN" $SERVER/v1/$USER/Storage_Container_A/ -i | |
HTTP/1.1 200 OK | |
Content-Length: 58 | |
X-Container-Object-Count: 3 | |
Accept-Ranges: bytes | |
X-Timestamp: 1387591147.17947 | |
X-Container-Bytes-Used: 47428 | |
Content-Type: text/plain; charset=utf-8 | |
X-Trans-Id: tx9b60e656fed54149a21b0-0052b88667 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ssdc)Jons-MacBook-Pro:swiftstackdotcom zmd$ vagrant up | |
Bringing machine 'dev' up with 'virtualbox' provider... | |
[dev] Setting the name of the VM... | |
[dev] Clearing any previously set forwarded ports... | |
[dev] Creating shared folders metadata... | |
[dev] Clearing any previously set network interfaces... | |
[dev] Preparing network interfaces based on configuration... | |
[dev] Forwarding ports... | |
[dev] -- 22 => 2222 (adapter 1) | |
[dev] -- 8000 => 8888 (adapter 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vagrant@precise64:/etc/init.d$ ./vboxadd | |
Usage: ./vboxadd {start|stop|restart|status|setup} | |
vagrant@precise64:/etc/init.d$ sudo !! | |
sudo ./vboxadd | |
Usage: ./vboxadd {start|stop|restart|status|setup} | |
vagrant@precise64:/etc/init.d$ sudo ./vboxadd setup | |
Removing existing VirtualBox DKMS kernel modules ...done. | |
Removing existing VirtualBox non-DKMS kernel modules ...done. | |
Building the VirtualBox Guest Additions kernel modules | |
The make utility was not found. If the following module compilation fails then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
var job_postings_data = JSON.parse($("#job_postings_data").html()); | |
for (var job in job_postings_data) { | |
var job_item_selector = "#" + job + "-item"; | |
$(job_item_selector).on("click", function(e) { | |
var this_job = job; | |
e.preventDefault(); | |
$(".job-post-item").removeClass("selected"); | |
$(this).addClass("selected"); |
OlderNewer