Skip to content

Instantly share code, notes, and snippets.

View shimondoodkin's full-sized avatar

Shimon Doodkin shimondoodkin

View GitHub Profile
// Copyright 2009 Ryan Dahl <ry@tinyclouds.org>
#ifndef SRC_OS_H_
#define SRC_OS_H_
#include <node.h>
#include <v8.h>
#include <sys/types.h>
#include <pwd.h> /* getpwuid() */
#include <grp.h> /* getgrgid() */
// Copyright 2009 Ryan Dahl <ry@tinyclouds.org>
#include <v8.h>
#include <node.h>
#include <node_os.h>
#include <sys/types.h>
#include <sys/time.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
var types = {
'.3gp' : 'video/3gpp',
'.a' : 'application/octet-stream',
'.ai' : 'application/postscript',
'.aif' : 'audio/x-aiff',
'.aiff' : 'audio/x-aiff',
'.asc' : 'application/pgp-signature',
'.asf' : 'video/x-ms-asf',
'.asm' : 'text/x-asm',
'.asx' : 'video/x-ms-asf',
@tsmith
tsmith / gist:758517
Created December 29, 2010 13:04
three minute cloud server illustration with node-control
/*global require */
// Illustration-only for a mailing list discussion - not a recommended pattern
// for production because of root usage. Untested.
// http://groups.google.com/group/nodejs/browse_thread/thread/b41ad5d727d8dff8
// usage example:
// node thisfile.js local server:create
// node thisfile.js local server:stop <IP>
// node thisfile.js local server:start <IP>
@7shi
7shi / BitWriter.bas
Created April 13, 2012 14:20
VBA版Deflate
' public domain
Option Explicit
Private FOut%
Private buf() As Byte
Private bufp&, cur&, bit%
Public Sub BitWriter_Init(FO%)
ReDim buf(4095)
FOut = FO
@andrewdeandrade
andrewdeandrade / app.js
Created June 29, 2012 18:19
Node.js ('child_process').spawn bug with SSH
var spawn = require('child_process').spawn
var instance = {
ipAddress: "0.0.0.0"
};
var awsPreSharedKeyPath = '~/.ssh/aws-preshared-key.pem'; // make sure key has permissions 600 with chmod
var spawnArgs = [ '-tt', // force teletype since ssh uses a psuedo-terminal
@adammw
adammw / README.md
Created August 3, 2012 06:30
Node.js for Raspberry Pi

Node.js for Raspberry Pi

Pre-built binaries

Recent releases have been pre-built using cross-compilers and this script and are downloadable below.

If you have found these packages useful, give me a shout out on twitter: @adammw

@jacknab
jacknab / gist:4026553
Created November 6, 2012 18:28 — forked from strangerstudios/gist:1389944
Paid Memberships Pro Extra Checkout/Profile Fields Example
<?php
/*
Adding First and Last Name to Checkout Form
*/
//add the fields to the form
function my_pmpro_checkout_after_password()
{
if(!empty($_REQUEST['firstname']))
$firstname = $_REQUEST['firstname'];
// (c) copyright unscriptable.com / John Hann | LegendLee
// License MIT
// For more robust promises, see https://github.com/briancavalier/when.js.
// last edited by LegendLee(legendlee1314@gmail.com)
function Promise() {
this._thens = [];
}
Promise.prototype = {
#!/usr/bin/env python
"""Translate text_to_translate using microsoft translator service."""
import json
import xml.etree.ElementTree as etree
try:
from urllib import urlencode
from urllib2 import urlopen, Request
except ImportError: # Python 3
from urllib.parse import urlencode
from urllib.request import urlopen, Request