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 lxml import etree | |
import os.path | |
import os | |
import sys | |
import re | |
import urllib2 | |
import urlparse | |
import logging | |
class Chapter(object): |
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
function framesLinks() { | |
$('.framelink').toggle(function() { | |
$(this).text('links with frames'); | |
$(this).parents('h2').nextAll('.libraries').first().find('li a').each(function() { | |
$(this).attr('href', $(this).attr('href').replace(/\/frames$/, '')); | |
}); | |
}, function() { | |
$(this).text('links without frames'); | |
$(this).parents('h2').nextAll('.libraries').first().find('li a').each(function() { | |
$(this).attr('href', $(this).attr('href') + '/frames'); |
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
mongo = db.getMongo(); | |
dbs = mongo.getDB('admin').runCommand({listDatabases: 1}); | |
dbs.databases.forEach(function (d) { | |
if (/^_test/.test(d.name)) { | |
printjsononeline({dropping: d.name}); | |
mongo.getDB(d.name).dropDatabase() | |
} | |
}); |
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 self.julian_date | |
+ def self.julian_date(t=Time.now) | |
# consistent for duration of process | |
- @julian_date ||= utc_to_submission(Time.now).strftime('%y%j') | |
+ @julian_date ||= utc_to_submission(t).strftime('%y%j') | |
end |
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
[nelhage@aeronautique:~]$ pry | |
[1] pry(main)> require 'mongo' | |
=> true | |
[2] pry(main)> Mongo::Connection.new['nelhage']['things'].insert({'type' => 'string', :type => 'string'}) | |
=> BSON::ObjectId('52794ae096bae530ad000001') | |
[3] pry(main)> | |
[nelhage@aeronautique:~]$ mongo nelhage | |
MongoDB shell version: 2.4.6 | |
connecting to: nelhage |
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
#include <unistd.h> | |
#include <sys/epoll.h> | |
#include "lib.h" | |
#define DEPTH 6 | |
#define FANOUT 1000 | |
void add_many(int parent, int child) { | |
int i; |
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
%%%%%%%%%%%%%%%%%%%%%%%%% datatypes.sty %%%%%%%%%%%%%%%%%%%%%%%%%% | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
%% | |
%% Commands Provided: | |
%% | |
%% \DECLARETYPE{Foo} | |
%% \DECLARESUBTYPE{Foobar}{Foo} | |
%% | |
%% \PRESETS{Foobar}{STUFF} |
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
\PRESETS{Char}{ | |
\FD\MYdesc {} %% badge description | |
\FD\MYstats {} %% use \newstat to add stats | |
% \newstat\MYcr {Combat Rating}{CR}{2} %% for DarkWater-style combat | |
\newstat\MYpsi {$\psi$}{$\psi$}{$7,9,11,13$} | |
\newstat\MYdrunk {$\iota$}{$\iota$}{0} | |
\newstat\MYdelta {$\delta$}{$\delta$}{} | |
\newstat\MYtau {$\tau$}{$\tau$}{10} |
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
package main | |
import "log" | |
func main() { | |
var a [128]byte | |
log.Printf("len(a) = %d", len(a)) | |
log.Printf("cap(a) = %d", cap(a)) | |
log.Printf("len(a[:10]) = %d", len(a[:10])) | |
log.Printf("cap(a[:10]) = %d", cap(a[:10])) |
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
/* Excerpted from https://github.com/mongodb/mongo/blob/ea83ad3103fef1664e9385d48537c4163344ce8a/src/mongo/util/debug_util.h#L37 */ | |
// The following declare one unique counter per enclosing function. | |
// NOTE The implementation double-increments on a match, but we don't really care. | |
#define MONGO_SOMETIMES( occasion, howOften ) for( static unsigned occasion = 0; ++occasion % howOften == 0; ) | |
#define SOMETIMES MONGO_SOMETIMES | |
#define MONGO_OCCASIONALLY SOMETIMES( occasionally, 16 ) | |
#define OCCASIONALLY MONGO_OCCASIONALLY |