Setup:
$ mongo
> use pubsub
> db.createCollection('messages', { capped: true, size: 100000 })
> db.messages.insert({})
| #!/bin/sh | |
| # | |
| # Shell script that configures gnome-terminal to use solarized theme | |
| # colors. Written for Ubuntu 11.10, untested on anything else. | |
| # | |
| # Solarized theme: http://ethanschoonover.com/solarized | |
| # | |
| # Adapted from these sources: | |
| # https://gist.github.com/1280177 | |
| # http://xorcode.com/guides/solarized-vim-eclipse-ubuntu/ |
| var mongoose = require('mongoose'); | |
| var db = mongoose.createConnection('127.0.0.1', 'test'); | |
| // Make schema | |
| var schema = mongoose.Schema({ name: String }); | |
| // Create subscribers collection | |
| var subscribers = []; | |
| // Hook `save` post method |
| <?php | |
| $ghost = 'XXX.XXX.XXX.XXX'; | |
| $guser = 'USER_NAME'; | |
| $gpwd = 'PASSWORD'; | |
| $gdbname = 'DB_NAME'; | |
| $db = mysql_connect($ghost, $guser, $gpwd) or die("Could not connect: " . mysql_error()); | |
| mysql_select_db ($gdbname, $db) or die (mysql_error($db)); |
| #!/usr/bin/python | |
| # -*- coding: utf-8 -*- | |
| import urllib2 | |
| import ast | |
| import re | |
| def get_items_of_post(address): | |
| url = "https://api.vk.com/method/wall.getById?posts=" + address + "&extended=1©_history_depth=2" | |
| response = urllib2.urlopen(url) | |
| text = response.read() |
| # Author: Pieter Noordhuis | |
| # Description: Simple demo to showcase Redis PubSub with EventMachine | |
| # | |
| # Update 7 Oct 2010: | |
| # - This example does *not* appear to work with Chrome >=6.0. Apparently, | |
| # the WebSocket protocol implementation in the cramp gem does not work | |
| # well with Chrome's (newer) WebSocket implementation. | |
| # | |
| # Requirements: | |
| # - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby |
| #!/usr/bin/env ruby | |
| require "webrick" | |
| =begin | |
| WEBrick is a Ruby library that makes it easy to build an HTTP server with Ruby. | |
| It comes with most installations of Ruby by default (it’s part of the standard library), | |
| so you can usually create a basic web/HTTP server with only several lines of code. | |
| The following code creates a generic WEBrick server on the local machine on port 1234, |
| #include<stdlb.h> | |
| #include<stdio.h> | |
| int isSubsetSum1(int arr[], int n, int sum) | |
| { | |
| /* The value of subset[i][j] will be true if there is a | |
| subset of set[0..j-1] */ | |
| int subset[sum+1][n+1]; | |
| int i,j; | |
| #include<stdlb.h> | |
| #include<stdio.h> | |
| int isSubsetSum1(int arr[], int n, int sum) | |
| { | |
| /* The value of subset[i][j] will be true if there is a | |
| subset of set[0..j-1] */ | |
| int subset[sum+1][n+1]; | |
| int i,j; | |
| package main | |
| import( | |
| "fmt" | |
| "reflect" | |
| ) | |
| func main(){ | |
| // iterate through the attributes of a Data Model instance | |
| for name, mtype := range attributes(&Dish{}) { |