Skip to content

Instantly share code, notes, and snippets.

View inadarei's full-sized avatar

Irakli Nadareishvili inadarei

View GitHub Profile
git clone https://github.com/git/git
cp git/contrib/completion/git-completion.bash ~/git-completion.sh
cp git/contrib/completion/git-prompt.sh ~/git-prompt.sh
@inadarei
inadarei / bash_profile.sh
Created March 30, 2011 03:59
bash_profile source
source $HOME/git-completion.sh
source $HOME/git-prompt.sh
export GIT_PS1_SHOWDIRTYSTATE=true
txtylw='\033[1;33m' # Yellow
fgcolor="\033[0m" # unsets color to term's fg color
twolevelprompt='$([ "$PWD" != "${PWD%/*/*/*}" ] && echo "/...${PWD##${PWD%/*/*}}" || echo "$PWD")'
gitprompt='$(__git_ps1 "[%s]")'
export PS1="\[$txtylw\] $twolevelprompt\[$fgcolor\]$gitprompt"'\$ '
@inadarei
inadarei / report.jsp
Created March 30, 2011 04:03
JBoss Memory Monitor
<%@ page import="java.lang.management.*" %>
<%@ page import="java.util.*" %>
<html>
<head>
<title>JVM Memory Monitor</title>
</head>
<body>
<%
Iterator iter = ManagementFactory.getMemoryPoolMXBeans().iterator();
@inadarei
inadarei / shell
Created May 2, 2011 16:06
PEAR Dependencies for Jenkins
pear channel-discover pear.pdepend.org
pear channel-discover pear.phpmd.org
pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
pear install pdepend/PHP_Depend
pear install phpmd/PHP_PMD
pear install phpunit/phpcpd
pear install phpunit/phploc
@inadarei
inadarei / nginx
Created May 8, 2011 23:10
Debian Lenny Nginx Startup Script
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
@inadarei
inadarei / nodedaemon.sh
Created June 24, 2011 18:40
Daemonize Node.js
#!/bin/bash
## Node.js App Launcher
## Usage: ./nodedaemon.sh /home/apps/projectname/app.js
## Baesed on: http://pastebin.com/wNJNkbjg
# name=`basename $1` # For when/if we want to use scriptname
name=`dirname $1 | xargs -0 basename` # When/if we want to use last folder name as project name
cd `dirname $1`
@inadarei
inadarei / checkCatalina.sh
Created June 30, 2011 16:09
Check Status of Two Running Tomcats
#!/bin/sh
###
# Accepts 1 or 2 as argument (Order # of Tomcat server to work with)
###
function checkCatalina(){
if [[ $# -ne 1 ]]; then
echo -1 && return
fi
@inadarei
inadarei / server.php
Created July 7, 2011 21:34
Tiny HTTP Server in PHP
#!/usr/bin/env php -q
<?php
/**
* Copied with minor fixes from: http://www.jezra.net/blog/proof_of_concept_webserver_written_in_PHP
*/
date_default_timezone_set('America/New_York');
//function get_include_contents
@inadarei
inadarei / dso.search.js
Created September 15, 2011 18:20
dso.search
dso.search = function() {
var data = false;
var search = $('#search');
var template = _.template('<li><a href="<%=url%>"><span class="title"><%=title%></span><small><%=subtitle%></small><small class="date"><%=date%></small></a></li>');
var find = function(phrase) {
if (!data) return $.ajax({
url: '/search.json',
dataType: 'json',
success: function(resp) {
data = _(resp).chain()
@inadarei
inadarei / dateToArray.js
Created October 3, 2011 23:32 — forked from BigBlueHat/dateToArray.js
dateToArray - handy for emitting CouchDB keys based on dates
function dateToArray(ts, length, utc) {
var length = length || 6,
d = new Date(ts),
utc = Boolean(local) || true;
if (utc) {
return [d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate(), d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(), d.getUTCMilliseconds()].slice(0, length);
} else {
return [d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds()].slice(0, length);
}