Skip to content

Instantly share code, notes, and snippets.

View jvilk's full-sized avatar

John Vilk jvilk

View GitHub Profile
@jvilk
jvilk / dropbox.d.ts
Created August 27, 2016 01:14
dropbox.d.ts, auto-generated
declare module DropboxTypes {
interface DropboxOptions {
// An access token for making authenticated requests.
accessToken: string;
// The client id for your app. Used to create authentication URL.
clientId: string;
// Select user is only used by team endpoints. It specifies which user the team access token should be acting as.
selectUser?: string;
}
@jvilk
jvilk / explode.c
Last active March 16, 2016 00:47
explode.c
/* explode.c -- Not copyrighted 1992 by Mark Adler
version c7, 27 June 1992 */
/* You can do whatever you like with this source file, though I would
prefer that if you modify it and redistribute it that you include
comments to that effect with your name and the date. Thank you.
History:
vers date who what
@jvilk
jvilk / JVMTypes.d.ts
Created December 13, 2015 20:57
Tuple Usage Example
This file has been truncated, but you can view the full file.
// TypeScript declaration file for JVM types. Automatically generated by doppioh.
// http://github.com/plasma-umass/doppio
import DoppioJVM = require('../src/doppiojvm');
import JVMThread = DoppioJVM.VM.Threading.JVMThread;
import Long = DoppioJVM.VM.Long;
import ClassData = DoppioJVM.VM.ClassFile.ClassData;
import ArrayClassData = DoppioJVM.VM.ClassFile.ArrayClassData;
import ReferenceClassData = DoppioJVM.VM.ClassFile.ReferenceClassData;
import Monitor = DoppioJVM.VM.Monitor;
import ClassLoader = DoppioJVM.VM.ClassFile.ClassLoader;
@jvilk
jvilk / doppioh.js
Created October 5, 2015 21:34
TypeScript Source Map Bug
/// <reference path="../vendor/DefinitelyTyped/node/node.d.ts" />
/*
* Doppioh is DoppioJVM's answer to javah, although we realize the 'h' no longer
* has a meaning.
*
* Given a class or package name, Doppioh will generate JavaScript or TypeScript
* templates for the native methods of that class or package.
*
* Options:
* -classpath Where to search for classes/packages.
@jvilk
jvilk / dosbox.conf
Created January 14, 2015 06:03
Oregon Trail dosbox.conf
# This is the configurationfile for DOSBox 0.74. (Please use the latest version of DOSBox)
# Lines starting with a # are commentlines and are ignored by DOSBox.
# They are used to (briefly) document the effect of each option.
[sdl]
# fullscreen: Start dosbox directly in fullscreen. (Press ALT-Enter to go back)
# fulldouble: Use double buffering in fullscreen. It can reduce screen flickering, but it can also result in a slow DOSBox.
# fullresolution: What resolution to use for fullscreen: original or fixed size (e.g. 1024x768).
# Using your monitor's native resolution with aspect=true might give the best results.
# If you end up with small window on a large screen, try an output different from surface.
@jvilk
jvilk / disableRightClickMenu.js
Created January 8, 2015 06:07
Disable right click menu
/**
* Disables the right click menu for the given element.
*/
function disableRightClickContextMenu(element) {
element.addEventListener('contextmenu', function(e) {
if (e.button == 2) {
// Block right-click menu thru preventing default action.
e.preventDefault();
}
});
@jvilk
jvilk / EC2 Tools
Created January 8, 2014 01:34
These are all of the EC2 tools.
$ ls -1 *.cmd
ec2-activate-license.cmd
ec2-add-group.cmd
ec2-add-keypair.cmd
ec2-allocate-address.cmd
ec2-assign-private-ip-addresses.cmd
ec2-associate-address.cmd
ec2-associate-dhcp-options.cmd
ec2-associate-route-table.cmd
ec2-attach-internet-gateway.cmd
// Copyright 2009 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
@jvilk
jvilk / gist:5426578
Created April 20, 2013 16:42
This code snippet appears to be nondeterministic in Node. Maybe I'm doing something wrong?
var buff = new Buffer(2);
buff[0] = 256;
console.log(buff[0]);
console.log(buff[1]);
buff.write("Ā", 0, 1);
console.log(buff[0]);
console.log(buff[1]);
console.log(buff.readInt8(0));