This file contains 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
import Base.rem, Base.div, Base.divrem | |
unsigned_type(::Int8) = Uint8 | |
unsigned_type(::Int16) = Uint16 | |
unsigned_type(::Int32) = Uint32 | |
unsigned_type(::Int64) = Uint64 | |
unsigned_type(::Int128) = Uint128 | |
immutable SignedMultiplicativeInverse{T<:Signed} | |
divisor::T | |
multiplier::T |
This file contains 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
immutable AListWrapper{Name}; end | |
immutable AList{Keys<:(AListWrapper...),Types} <: Associative | |
v::Types | |
end | |
macro alist(args...) | |
keys = Array(Any, length(args)) | |
values = Array(Any, length(args)) | |
for i = 1:length(args) | |
if !Base.Meta.isexpr(args[i], :(=>)) |
This file contains 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
immutable CheapMulBool | |
x::Bool | |
end | |
immutable Negated{T} | |
x::T | |
end | |
immutable BitWrapper | |
x::Vector{Uint64} | |
end | |
Base.getindex(x::BitWrapper, i) = CheapMulBool(!Base.unsafe_bitgetindex(x.x, i)) |
This file contains 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
if (platform == "win") { | |
libc = ctypes.open("Ws2_32.dll"); | |
var dnsapi = ctypes.open("Dnsapi.dll"); | |
var DNS_RECORD = new ctypes.StructType("DNS_RECORD"); | |
DNS_RECORD.define([{"pNext":DNS_RECORD.ptr}, {"pName":ctypes.char.ptr}, {"wType":ctypes.unsigned_short}, | |
{"wDataLength":ctypes.unsigned_short}, {"DW":ctypes.unsigned_long}, {"dwTtl":ctypes.unsigned_long}, | |
{"dwReserved":ctypes.unsigned_long}, {"pNameHost":ctypes.char.ptr}]); | |
var DnsQuery = dnsapi.declare("DnsQuery_A", ctypes.winapi_abi, ctypes.int, ctypes.char.ptr, ctypes.unsigned_short, | |
ctypes.unsigned_long, ctypes.voidptr_t, DNS_RECORD.ptr, ctypes.voidptr_t); |
This file contains 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
{ | |
"translatorID": "bc03b4fe-436d-4a1f-ba59-de4d2d7a63f7", | |
"label": "CSL JSON", | |
"creator": "Simon Kornblith", | |
"target": "json", | |
"minVersion": "3.0b3", | |
"maxVersion": "", | |
"priority": 100, | |
"inRepository": true, | |
"translatorType": 3, |
This file contains 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
// PY-APPSCRIPT | |
self.asApp.make(new=k.custom_document_property, at=self.asDoc, with_properties={k.name:docPropertyName, k.value:docPropertyValue}) | |
// SCRIPTING BRIDGE | |
NSAppleEventDescriptor *rd = [NSAppleEventDescriptor recordDescriptor]; | |
[rd setDescriptor:[NSAppleEventDescriptor descriptorWithString:currentPropertyName] forKeyword:'pnam']; | |
[rd setDescriptor:[NSAppleEventDescriptor descriptorWithString:currentPropertyValue] forKeyword:'DPVu']; | |
[doc->sbApp sendEvent:'core' id:'crel' parameters:'kocl', @"mCDP", 'insh', doc->sbDoc, 'prdt', rd]; |
This file contains 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/bin/python | |
LINE_WIDTH = 2; | |
CIRCLE_RADIUS = 6 | |
IMG_SIZE = 16; | |
NUM_ARCS = 20; | |
import subprocess; | |
p = subprocess.Popen(["gs", "-dSAFER", "-dNOPAUSE", "-r72", "-sDEVICE=pngalpha", | |
"-sOutputFile=arcs.png", "-"], stdin=subprocess.PIPE); |
This file contains 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
var AsyncComparator = function(list) { | |
this.listsAtCurrentLevel = []; | |
this.listsAtNextLevel = []; | |
this.listMerged = []; | |
for(var i=0; i<list.length; i++) { | |
this.listsAtCurrentLevel[i] = [list[i]]; | |
} | |
}; | |
AsyncComparator.prototype.getA = function() { |
This file contains 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
<rdf:RDF | |
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | |
xmlns:res="http://purl.org/vocab/resourcelist/schema#" | |
xmlns:z="http://www.zotero.org/namespaces/export#" | |
xmlns:dcterms="http://purl.org/dc/terms/" | |
xmlns:address="http://schemas.talis.com/2005/address/schema#" | |
xmlns:foaf="http://xmlns.com/foaf/0.1/" | |
xmlns:bibo="http://purl.org/ontology/bibo/" | |
xmlns:link="http://purl.org/rss/1.0/modules/link/"> | |
<z:UserItem rdf:about="http://zotero.org/users/67180/items/4BUASI6R"> |
This file contains 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 HDF5, JLD | |
const MATRIX_SIZE = 1000 | |
# Write test file | |
x = rand(MATRIX_SIZE, MATRIX_SIZE) | |
jld = jldopen("test.jld", "w") | |
write(jld, "x", x) | |
close(jld) | |
macro s() |