Skip to content

Instantly share code, notes, and snippets.

@zuckercode
zuckercode / ZipCoordinates.php
Created October 23, 2012 23:14
Phalcon ZipCoordinates Model
<?php
namespace Application\Backend\Models;
/**
*
*/
class ZipCoordinates extends \Phalcon\Mvc\Model
{
/**
@zuckercode
zuckercode / setup_innodb_opengeodb.sql
Created October 23, 2012 22:44
setup_innodb_opengeodb
SET NAMES 'utf8';
BEGIN;
/*
* Table structure for table 'geodb_type_names'
*/
create table geodb_type_names (
type_id integer not null,
type_locale varchar(5) not null,
@zuckercode
zuckercode / setup_myisam_opengeodb.sql
Created October 23, 2012 22:43
setup_myisam_opengeodb
SET NAMES 'utf8';
BEGIN;
/*
* Table structure for table 'geodb_type_names'
*/
create table geodb_type_names (
type_id integer not null,
type_locale varchar(5) not null,
@zuckercode
zuckercode / gist:3942110
Created October 23, 2012 22:26
opengeodb select
/* select one test zip */
SELECT zc_id, zc_location_name, zc_lat, zc_lon
FROM zip_coordinates
WHERE zc_zip = '13187';
/* calculate with the found data from above the zip in the radius < 20km */
SELECT
zc_zip,
zc_location_name,
ACOS(
@zuckercode
zuckercode / gist:3942008
Created October 23, 2012 22:13
opengeodb Umkreissuche
/* http://opengeodb.org/wiki/OpenGeoDB_-_Umkreissuche */
/* create zip table */
CREATE TABLE `zip_coordinates` (
zc_id INT NOT NULL auto_increment PRIMARY KEY,
zc_loc_id INT NOT NULL ,
zc_zip VARCHAR( 10 ) NOT NULL ,
zc_location_name VARCHAR( 255 ) NOT NULL ,
zc_lat DOUBLE NOT NULL ,
zc_lon DOUBLE NOT NULL
@zuckercode
zuckercode / install_opengeodb.sh
Created October 23, 2012 21:01
Installer for opengeodb
#!/bin/bash
# - INSTALL instructions:
# mkdir /your/preferred/path/opengeodb
# cd /your/preferred/path/opengeodb
# - copy this script to install_opengeodb.sh
# - make script executable:
# chmod +x install_opengeodb.sh
# - edit you mysql credentials
#
@zuckercode
zuckercode / gist:3794092
Created September 27, 2012 13:46
x largest files in all directories
du -hsx * | sort -rh | head -10
@zuckercode
zuckercode / gist:3790075
Created September 26, 2012 19:35
webcyradm sql strcuture
# ************************************************************
# Sequel Pro SQL dump
# Version 3408
#
# http://www.sequelpro.com/
# http://code.google.com/p/sequel-pro/
#
# Host: 127.0.0.1 (MySQL 5.5.27-1~dotdeb.0)
# Datenbank: mail
# Erstellungsdauer: 2012-09-26 19:30:53 +0000
@zuckercode
zuckercode / gist:3720747
Created September 14, 2012 08:27
add new user with zsh as default shell
#!/bin/bash
read -p "please provide a name for a new user:" name
if [ "$name" == "" ]; then
echo "You did not entered a user name, so no user will be added."
exit;
fi
USER=$name
HOME=/home/$USER
@zuckercode
zuckercode / gist:3714230
Created September 13, 2012 13:20
redmine installer
# add database 'redmine' and user 'redmine' to mysql
aptitude -y install ruby libruby libopenssl-ruby libpgsql-ruby rubygems apache2 libapache2-mod-passenger
aptitude -y install subversion
aptitude -y install install libmysql-ruby libmysqlclient-dev
aptitude install libpq-dev libsqlite3-dev libmagick9-dev graphicsmagick-libmagick-dev-compat
cd /var/www
svn co http://redmine.rubyforge.org/svn/branches/2.0-stable redmine
cd redmine
cp config/database.yml.example config/database.yml
vim config/database.yml