Skip to content

Instantly share code, notes, and snippets.

@kacinskas
kacinskas / upstart-script-sceleton
Last active December 15, 2015 12:39
Upstart script skeleton
#
# put it in /etc/init/app-name.conf
#
# Usage run:
# start app-name
# stop app-name
description "Eldes Alarm Server (Ukmerges g. gate)"
author "eldes - http://eldes.lt"
@kacinskas
kacinskas / upstart-skeleton
Last active December 15, 2015 12:39
upstart script skeleton
description "Eldes Alarm Server (Ukmerges g. gate)"
author "tk - http://tadas.kacinskas.eu"
# used to be: start on startup
# until we found some mounts weren't ready yet while booting:
start on started mountall
stop on shutdown
# Automatically Respawn:
respawn
@kacinskas
kacinskas / gist:5202876
Created March 20, 2013 07:15
Auto-start a shell script on Ubuntu Server
Got a shell script that you want automatically run at bootup on Ubuntu Server Edition? Here’s how:
Create a script in the /etc/init.d/ directory
Make the script executable
$ sudo chmod +x /etc/init.d/myscript.sh
Make the script start at bootup
$ sudo update-rc.d myscript.sh defaults
Note: the option “defaults” puts a link to start your script in runlevels 2, 3, 4 and 5, and puts a link to stop in runlevels 0, 1 and 6.
@kacinskas
kacinskas / gist:5102801
Last active December 14, 2015 14:49
Simple scroll to top button example
Demo - http://jsfiddle.net/tadas/uRwGX/1/
/* ---------------------------- */
// Scroll to top
/* ---------------------------- */
$(function() {
var $simpleScrollTop=$('#scrolltop');
$(window).scroll(function() {
if($(this).scrollTop() != 0) {
@kacinskas
kacinskas / gist:4538987
Created January 15, 2013 14:21
LINUX SERVER Postfix start/stop/restart
//Postfix
$ sudo /etc/init.d/postfix start/stop/restart/...
//mail quene
$ mailq
@kacinskas
kacinskas / gist:4343535
Created December 20, 2012 07:24
LINUX: benchmark webapp
siege -c20 www.google.co.uk -b -t30s
# With the following command, we’ll test Google with 20 concurrent connections for 30 seconds, and then get a nice report at the end
@kacinskas
kacinskas / gist:4258862
Created December 11, 2012 14:14
LINUX: count connections to machine
Count all: netstat -an | wc -l
Filter by port: netstat -an | grep :80 | wc -l
Group by status: netstat -ant | awk '{print $6}' | sort | uniq -c | sort -n
@kacinskas
kacinskas / gist:4249085
Created December 10, 2012 07:42
LINUX : put SSH keys on server
cat ~/.ssh/id_rsa.pub | ssh hostname 'cat >> ~/.ssh/authorized_keys'
-OR-
sh-copy-id -i ~/.ssh/id_rsa.pub username:[email protected]
@kacinskas
kacinskas / gist:4249069
Created December 10, 2012 07:38
LINUX : permanently add keys to ssh agent with config
Create file 'config' in '~/.ssh':
IdentityFile ~/.ssh/identity
IdentityFile ~/.ssh/id_rsa
IdentityFile ~/.ssh/gitid
@kacinskas
kacinskas / gist:4231401
Created December 7, 2012 07:06
LINUX: copy ssh key to remote host
ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host