Skip to content

Instantly share code, notes, and snippets.

View mappum's full-sized avatar
⛓️

Matt Bell mappum

⛓️
View GitHub Profile
var irc = require('irc'),
dcpu = require('dcpu16'),
http = require('http'),
querystring = require('querystring');
var channels = ['#0x10c-dev', '#0x10c-blah', '#0x10c'];
var client = new irc.Client('irc.freenode.net', 'mappumbot', {
channels: channels
});
var irc = require('irc'),
dcpu = require('dcpu16'),
http = require('http'),
querystring = require('querystring');
var channels = ['#0x10c-dev', '#0x10c-blah', '#0x10c'];
var client = new irc.Client('irc.freenode.net', 'mappumbot', {
channels: channels
});
Apr 30 04:34:19 alpha sshd[17767]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=c-71-228-12-226.hsd1.il.comcast.net user=mappum
Apr 30 04:34:22 alpha sshd[17767]: Failed password for mappum from 71.228.12.226 port 59435 ssh2
Apr 30 04:34:44 alpha sshd[17769]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=563407cb.rev.stofanet.dk user=mappum
Apr 30 04:34:46 alpha sshd[17769]: Failed password for mappum from 86.52.7.203 port 44646 ssh2
Apr 30 04:34:48 alpha sshd[17769]: Failed password for mappum from 86.52.7.203 port 44646 ssh2
Apr 30 04:34:54 alpha sudo: mappum : TTY=pts/5 ; PWD=/home/mappum/0x10code ; USER=root ; COMMAND=/usr/sbin/ufw status
Apr 30 04:35:01 alpha sshd[17775]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=c-71-228-12-226.hsd1.il.comcast.net user=mappum
Apr 30 04:35:03 alpha sshd[17775]: Failed password for mappum from 71.228.12.226 port 59436 ssh2
Apr 30 04:35:2

feed

Feed is a simple yet flexible node.js middleware for connect/express that comes with a built-in websocket client (using Socket.io). It allows for the easy creation and access of feeds, which are collections of content items that are organized and filtered by tags (for example, comments in a thread or an activity feed of friends). MongoDB is used for storage.

The content that feeds are made up of are called Items. Items are models with a list of tags added to them, and Feeds are just lists of tags for filtering the saved Items.

Feeds can be sorted time-based (such as an activity feed or notification log) or score-based (like a Reddit comment section, sorted by the score of each comment) and organized by tags.

Usage

First, require the module.

node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Cannot read property 'states' of undefined
at EmbeddedDocument.isDirectModified (/home/mappum/aptt/node_modules/mongoose/lib/document.js:673:36)
at EmbeddedDocument.set (/home/mappum/aptt/node_modules/mongoose/lib/document.js:417:17)
at EmbeddedDocument.parent (/home/mappum/aptt/node_modules/mongoose/lib/document.js:993:45)
at EmbeddedDocument.EmbeddedDocument (/home/mappum/aptt/node_modules/mongoose/lib/types/embedded.js:19:15)
at new EmbeddedDocument (/home/mappum/aptt/node_modules/mongoose/lib/schema/documentarray.js:26:17)
at DocumentArray.SchemaArray (/home/mappum/aptt/node_modules/mongoose/lib/schema/array.js:48:19)
var Schema = require('mongoose').Schema,
ObjectId = Schema.ObjectId,
Transaction = require('./transaction.js');
var Comment = module.exports = new Schema({
'author': String,
'body': String,
'date': Date,
'parent': ObjectId,
###
q-3.coffee
Facebook Hacker Cup Qualifications - Problem 3
###
# takes in two strings of input, and returns the nth value of m
f = (input1, input2) ->
# parse the input strings to get the variable values
split = input1.split ' '
n = Number split[0]
@mappum
mappum / gist:19b5f12edd001b33a72f
Last active August 29, 2015 14:03
Type-checking annotation in vanilla Javascript
// It's possible to add your own quasi language constructs in JS using comments and Function#toString.
// (Doesn't survive minification)
// (You might need to modularize the execution of the annotations)
function checkType(f) {
return function(a) {
var type = f.toString().match(/\/\/(.*)\n/)[1].trim();
if(type !== typeof(a)) throw new Error('Invalid type');
return f(a);
}
@mappum
mappum / Makefile
Last active August 29, 2015 14:16 — forked from jbenet/Makefile
vmname="PXE Booter"
iso=/ipfs/QmdTmSQtCz9D6vt2AbvQkYo3edFcTYoU7FDmDD7bPWDccA/ipfs.iso
define notfound
$(iso) not found
make sure the daemon is running and mounted:
ipfs daemon &
ipfs mount
endef
export notfound
Bot is initialized. HEAD: 192b96a98368f547dce6855800a955bd72554136
/home/bot/botwillacceptanything/voting.js:101
var voteFileName = 'https://raw.githubusercontent.com/' + PR.head.repo.own
^
ReferenceError: PR is not defined
at handlePR (/home/bot/botwillacceptanything/voting.js:101:63)
at Array.forEach (native)
at /home/bot/botwillacceptanything/main.js:85:9
at /home/bot/botwillacceptanything/node_modules/github/api/v3.0.0/pullRequests.js:64:17
at IncomingMessage.<anonymous> (/home/bot/botwillacceptanything/node_modules/github/index.js:782:21)