Skip to content

Instantly share code, notes, and snippets.

View davit's full-sized avatar

Davit davit

  • Web Intelligence
  • Tbilisi
View GitHub Profile
@davit
davit / gist:4951974
Last active December 13, 2015 17:58
<?php
class Figure // Chessboard - Rook coordinates and its motion:
{
private $x, $y;
// setting initial position of the Rook:
public function SetCoords($absc, $oord) {
if (($absc>=1 and $absc<=8) and ($oord>=1 and $oord<=8)) {
$this->x = $absc;
Being With And Without You
It's like a dream at night you enter
All around you is pale and blue,
As the only part of this world that matters
Is the gift of dreaming which is You!
Suddenly thrown into fairiest of tales,
Is the experience of seeing your face
@davit
davit / User.java
Created December 23, 2013 11:44
Java user login homework
package cst.dave;
/**
* Created with IntelliJ IDEA.
* User: root
* Date: 12/23/13
* Time: 3:32 PM
* To change this template use File | Settings | File Templates.
*/
public class User {
@davit
davit / Servlet.java
Created December 23, 2013 11:45
Java homework
package cst.dave;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.*;
import javax.servlet.http.*;
/**
* Created with IntelliJ IDEA.
* User: david
@davit
davit / download-script
Last active June 30, 2024 03:40
A small bash script that downloads, extracts and removes the zip/gz file.
#!/bin/sh
if [[ $1 =~ \.zip$ ]]; then
wget $1 && sudo unzip *.zip && sudo rm *.zip
elif [[ $1 =~ \.gz$ ]]; then
wget $1 && sudo tar -zxvf *.gz && sudo rm *.gz
fi
@davit
davit / port by service
Last active January 1, 2016 18:09
A linux script for finding a port number according to a service (e.g. http: 80)
#!/bin/bash
# This one displays both service and port number colored in red (most likely):
egrep --color -o -m 1 '^'$1' *[0-9]+' /etc/services
# This one displays only the port number:
egrep -o -m 1 '^'$1'\s+[0-9]+' /etc/services | grep -P -o '\d+$'
@davit
davit / dcommit.sh
Last active August 29, 2015 14:07
This script should be used together with "exportdb" script. FOR LOCAL USE ONLY!!!
#!/bin/bash
program_name=`basename $0`
function print_usage() {
echo -e "Usage: ${program_name} [-i module1 module2 ... ] [-e database_name] [-m \"git commit message\"]"
exit "$1"
}
function install_modules() {
@davit
davit / cdrupal.sh
Last active August 29, 2015 14:07
Download and install drupal using drush (by no means should this be used in an unsafe environment)
#!/bin/bash
drupal_version=$1
site_name=$2
db_user=$3
db_pass=$4
db_name=$5
function print_usage() {
echo -e "Usage: $0 drupal_version site_name db_user db_pass db_name"
<?php
$has_event_class = 'has-event-false';
$events = array(
0 => array(
'city' => 'Tbilisi',
'start_date' => '2014-11-18 09:00',
'end_date' => '2014-11-18 12:00',
'name' => 'Meeting with Jesus'
),
$calendar = array(
9 => array(
0 => array(),
1 => array(),
2 => array(),
3 => array(
"start_date" => 9,
"end_date" => 12,
"event_name" => "Cool Event0"
),