Skip to content

Instantly share code, notes, and snippets.

View mappum's full-sized avatar
⛓️

Matt Bell mappum

⛓️
View GitHub Profile
###
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]

Keybase proof

I hereby claim:

  • I am mappum on github.
  • I am mappum (https://keybase.io/mappum) on keybase.
  • I have a public key ASAnYrDZQA4Hnziay_XGDFlCIhfUCgLLgI6Mv9Z_7VU6cgo

To claim this, I am signing this object:

extern crate time;
extern crate rocksdb;
extern crate rand;
use rand::prelude::*;
const NODES: u64 = 10000000;
const KEY_LENGTH: usize = 30;
const DATA_LENGTH: usize = 200;
'use strict'
var EventEmitter = require('events')
var electronEval = require('electron-eval')
var watt = require('watt')
class Daemon extends EventEmitter {
constructor (opts) {
super()
this.daemon = electronEval(opts)
var extrude = require('extrude-by-path')
var matScale = require('gl-mat4/scale')
var toStl = require('serialize-stl')
function createCirclePath (r, fn) {
var circle = []
for (var i = 0; i <= fn; i++) {
var theta = Math.PI*2/fn*i
circle.push([r * Math.cos(theta), r * Math.sin(theta), 0, theta + 0.15])
}
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,
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)

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.

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
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
});