Skip to content

Instantly share code, notes, and snippets.

@wbzyl
wbzyl / couchdb
Created September 15, 2011 18:55
CouchDB init.d script for Linux / Fedora 15
#!/bin/sh -e
### BEGIN INIT INFO
# Provides: couchdb
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Apache CouchDB init script
# Description: Apache CouchDB init script for the database server.
@wbzyl
wbzyl / elevation-rails.rb
Created October 21, 2011 11:34
Elevation for Rails 3.1
# -*- coding: utf-8 -*-
# Zamiast Google image graph api
# użyć biblioteki JavaScript [dygraphs](http://dygraphs.com/)
require 'json' # zbędne w Rails
require 'active_support/core_ext' # ditto
require 'net/http' # Ruby Standard Library
require 'geo-distance' # dopisać gem 'geo-distance' do Gemfile
@wbzyl
wbzyl / html5-boilerplate.rb
Created October 21, 2011 19:24
Application template file for Rails 3.1+
# Template file for Rails 3.1+
#
# TODO:
# see README.md for additional information.
def ask_wizard(text)
ask "\033[36m" + "wizard".rjust(10) + "\033[0m" + " #{text}"
end
remove_file 'public/index.html'
<html>
<head>
<title>The page is temporarily unavailable</title>
<style>
body { font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body bgcolor="white" text="black">
<table width="100%" height="100%">
<tr>
/* wypisz zestawienie temperatur Fahrenheita-Celsjusza
dla f = 0,20,...300 */
#include <stdio.h>
int main() {
int fahr, celsius;
int lower, upper, step;
lower=0; /* dolna granica temperatur */
/* wypisz zestawienie temperatur Fahrenheita-Celsjusza
dla f = 0,20,...300; wersja zmiennopozycyjna */
#include <stdio.h>
int main() {
float fahr, celsius;
int lower, upper, step;
lower=0; /* dolna granica temperatur */
/* wypisz zestawienie temperatur Fahrenheita-Celsjusza
dla f = 0,20,...300; pętla for */
#include <stdio.h>
int main() {
int fahr;
for (fahr=0; fahr<=300; fahr=fahr+20) {
printf("%3d%6.1f\n",fahr,(5.0/9.0)*(fahr-32));
/* Obliczamy liczbę PI -- niespodzianki arytmetyki całkowitej. */
#include <stdio.h>
double metoda_iv(int liczba_iteracji)
{
int licznik;
double wynik = 4, znak = -1;
liczba_iteracji += 3;
/* wypisz zestawienie temperatur Fahrenheita-Celsjusza
argumenty wywołania programu */
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
int lower; /* dolna granica temperatur */
int upper; /* górna granica */
#include <stdio.h>
#include <stdlib.h>
/* wykorzystanie powłoki sh do wywołania programów:
popen, system, pclose */
/* obie funkcje powinny być zadeklarowane w stdio.h (a nie są?) */
FILE *popen(const char *, const char *);
int pclose(FILE *);