Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
echo "Foo"
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName phpzend
DocumentRoot /var/www/zend/public
<Directory />
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
<?php
$mongoDb = new Mongo;
$article = $mongoDb->blog->article->findOne(array(
'_id' => new MongoId($_GET['_id'])
));
ob_start();
?>
<!DOCTYPE html>
@Cacodaimon
Cacodaimon / backup.sh
Created September 26, 2012 15:11 — forked from karussell/backup.sh
Backup ElasticSearch with rsync
# TO_FOLDER=/something
# FROM=/your-es-installation
DATE=`date +%Y-%m-%d_%H-%M`
TO=$TO_FOLDER/$DATE/
echo "rsync from $FROM to $TO"
# the first times rsync can take a bit long - do not disable flusing
rsync -a $FROM $TO
# now disable flushing and do one manual flushing
<?php
class BlogController extends Zend_Controller_Action
{
public function indexAction()
{
try {
$model = new Application_Model_Article;
$this->view->articles = $model->fetchAll();
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Routing;
using MongoDB.Driver;
using MongoDB.Bson;
@Cacodaimon
Cacodaimon / article.phtml
Created October 2, 2012 19:56
Used @ cacodaemon.de
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>MVC Test Blog</title>
</head>
<body>
<header>
<h1>MVC Test Blog</h1>
</header>
@Cacodaimon
Cacodaimon / Index.aspx
Created October 2, 2012 20:00
Used @ cacodaemon.de
<%@ Page Title="" Language="C#" MasterPageFile="/Views/Shared/Site.master" Inherits="System.Web.Mvc.ViewPage<MongoDB.Driver.MongoCursor>" %>
<asp:Content ID="Content" ContentPlaceHolderID="MainContent" runat="server">
<% foreach (Blog.Article article in this.ViewData.Model) { %>
<article>
<h2><a href="<%= Url.Action("ShowArticle", "Blog", new RouteValueDictionary(new { id = article.Id })) %>"><%= article.Title %></a></h2>
<span><%= article.Date %></span>
<p><%= article.Text %></p>
<p></p>
<% if (article.Comments == null) { %>
<p>Comments: <a href="<%= Url.Action("ShowArticle", "Blog", new RouteValueDictionary(new { id = article.Id })) %>#comments">[0]</a></p>
@Cacodaimon
Cacodaimon / server.js
Created October 15, 2012 18:19
nodejs simple chat server [email protected]
var net = require('net');
function Clients () {
var clients = new Array()
var clientCounter = 0
var Client = function (socket, name) {
this.send = function(msg) {
this.socket.write(msg + '\n')
}
#!/bin/bash
for num in {1..1000}; do
netcat localhost 1337 &
done