Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
function usageexit() {
printf "Usage: %s output.ps [file..]\n" $(basename $0)
exit 2
}
if (($# < 2))
then
usageexit
@wbzyl
wbzyl / z8p.c
Created November 6, 2011 09:32
z dwóch pętli jedna
#include <stdio.h>
int suma_liczb(int tablica[], int size);
int iloczyn_liczb(int tablica[], int size);
void minmax(int tablica[], int size, int* min, int* max);
int main() {
int liczby[6]; // x = liczby[0], y = liczby[1], z = liczby[2]
int najmniejsza, najwieksza;
printf("podaj pierwsza liczbe calkowita: ");
@wbzyl
wbzyl / mongo.sh
Created November 17, 2011 16:21
Uruchamianie MongoDB
#! /bin/bash
function usageexit() {
echo "Usage: $(basename $0) [PORT] [other mongodb options]" >&2
exit 1
}
dbpath=$HOME/.data/var/lib/mongodb
config_file=$HOME/bin/mongodb.config
@wbzyl
wbzyl / redis.conf
Created November 17, 2011 21:58
Uruchamianie Redis
#
# Values to be changed
#
port 6379
#
pidfile /home/wbzyl/.data/var/run/redis.pid # mkdir -p ~/.nosql/var/run/
#
bind 0.0.0.0
#
# The filename where to dump the DB
@wbzyl
wbzyl / data-markdown.user.js
Created November 22, 2011 11:01 — forked from paulirish/data-markdown.user.js
*[data-markdown] - use markdown, sometimes, in your HTML
// ==UserScript==
// @name Use Markdown, sometimes, in your HTML.
// @author Paul Irish <http://paulirish.com/>
// @link http://git.io/data-markdown
// @match *
// ==/UserScript==
// If you're not using this as a userscript just delete from this line up. It's cool, homey.
@wbzyl
wbzyl / modal.html
Created December 9, 2011 08:12 — forked from makeusabrew/modal.html
Twitter Bootstrap - basic dialog box invocation via JavaScript
<!-- set up the modal to start hidden and fade in and out -->
<div id="myModal" class="modal hide fade">
<!-- dialog contents -->
<div class="modal-body">
Hello world!
</div>
<!-- dialog buttons -->
<div class="modal-footer">
<a href="#" class="btn primary">OK</a>
</div>
@wbzyl
wbzyl / ws.c
Created December 11, 2011 08:56
Program korzystający z plików.
#include <stdio.h>
int main(int argc, char *argv[]) {
int c;
int nb = 0; /* liczba znaków odstępu */
int nt = 0; /* liczba znaków tabulacji */
int nl = 0; /* liczba znaków nowego wiersza */
FILE *fin, *fout;
if ((fin = fopen(argv[1], "r")) == NULL) {
@wbzyl
wbzyl / rails32_app_template_for_elasticsearch.rb
Created December 14, 2011 18:46
Rails application template: Elasticsearch
# ===================================================================================================================
# Template for generating a no-frills Rails application with support for ElasticSearch full-text search via Tire
# ===================================================================================================================
#
# This file creates a basic, fully working Rails application with support for ElasticSearch full-text search
# via the Tire gem [http://github.com/karmi/tire].
#
# You DON'T NEED ELASTICSEARCH INSTALLED, it is installed and launched automatically by this script.
#
# Requirements
@wbzyl
wbzyl / chat.rb
Created January 4, 2012 22:42 — forked from rkh/chat.rb
Simple Chat Application using the Sinatra Streaming API
# coding: utf-8
require 'sinatra'
set server: 'thin', connections: []
get '/' do
halt erb(:login) unless params[:user]
erb :chat, locals: { user: params[:user].gsub(/\W/, '') }
end
get '/stream', provides: 'text/event-stream' do
@wbzyl
wbzyl / percolated-twitter.rb
Created January 11, 2012 21:09 — forked from karmi/percolated-twitter.rb
Reversed or “Real Time” Search in ElasticSearch
# Reversed or “Real Time” Search in ElasticSearch
# ====================================================================================
# You may have come across the term “realtime search” lately
# (eg. [here](http://engineering.socialcast.com/2011/05/realtime-search-solr-vs-elasticsearch/))
# and wondered what all the fuss is about.
#
# Well, the usual workflow with search engines goes like this:
#
# 1. You index some documents.