Skip to content

Instantly share code, notes, and snippets.

The script:

var http = require('http')
var fs = require('fs')


http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'})
  res.end("hello world")
}).listen(3000);
#import <Foundation/Foundation.h>
@interface NSData (MD5)
- (NSString *)MD5String;
@end
#import <CommonCrypto/CommonDigest.h>
@implementation NSData (MD5)
- (NSString *)MD5String {
unsigned char result[16];
CC_MD5(self.bytes, self.length, result);

Install Graphite

pkgin up
pkgin in py27-graphite-web ap22-py27-wsgi

If pkgin says the package cannot be found, do this:

<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='export'>
<service name='network/djbdns' type='service' version='0'>
<create_default_instance enabled='true'/>
<dependency name='dep0' grouping='require_all' restart_on='error' type='service'>
<service_fmri value='svc:/milestone/multi-user:default'/>
</dependency>
<exec_method name='start' type='method' exec='tinydns &amp;' timeout_seconds='10'>
<method_context working_directory='/opt/local/etc/tinydns'>
example openvpn config, from a site, to a Joyent zone, under SDC7:
----------------------------------------------------------------------------------------------------------------
example config:
server end, in joyent cloud, pick an IP address: 10.4.4.1
client ent, at home, pick an IP address: 10.4.4.2
in this example, I'm calling that network a /24, or 255.255.255.0 netmask
--------------------
on "the customer end": (my example, on my linux OpenWRT router at home)
zipstream = require "zipstream"
fs = require "fs"
async = require "async"
class StreamingResponse
filename: ""
files: []
streaming: true
###
@papertigers
papertigers / mdb.md
Last active August 29, 2015 14:20 — forked from tjfontaine/mdb.md

MDB is unlike most debuggers you've experienced.

It is not a source level debugger like gdb or lldb or even Node's builtin debugger

Generally used for postmortem analysis.

Postmortem is for Production and Development

We operate mostly on core files, though you can attach to running processes as well.

@papertigers
papertigers / 0-README.md
Last active August 29, 2015 14:26 — forked from bahamas10/0-README.md
Joyent Manta Functions
@papertigers
papertigers / diff.swift
Created November 15, 2016 04:57 — forked from simme/diff.swift
Utility for diffing two arrays of arrays.
enum DiffModification<T: Equatable> {
case inserted(position: NSIndexPath, value: T)
case deleted(position: NSIndexPath, value: T)
case moved(position: NSIndexPath, newPosition: NSIndexPath, value: T)
}
extension DiffModification: CustomDebugStringConvertible {
var debugDescription: String {
switch self {
case .inserted(let position, let value):
@papertigers
papertigers / no_compute_resources_available.md
Created November 22, 2016 22:32 — forked from bahamat/no_compute_resources_available.md
Diagnosing "No Compute Resources Available" messages in Triton.

No Compute Resources Available

This error is somewhat ambiguious because there is seemingly no indication which resource is exhausted.

Triton chooses compute nodes with a subcomponent called sdc-designation (also refered to as , DAPI). The full DAPI log for a provision job is embedded in the CNAPI log file and can be extracted with the workflow job uuid and the following script.

#!/bin/bash

set -o errexit