Skip to content

Instantly share code, notes, and snippets.

View maanas's full-sized avatar

Maanas Royy maanas

  • Maanas Network
  • India
View GitHub Profile
sudo openssl req -new -newkey rsa:2048 -nodes -keyout /etc/pki/tls/private/domain.com.key -out /etc/pki/tls/private/domain.com.csr
#!/bin/bash
case "${1:-''}" in
'start')
if test -f /tmp/selenium.pid
then
echo "Selenium is already running."
else
DISPLAY=:7 java -jar /usr/local/lib/selenium/selenium-server-standalone-2.4.0.jar -port 4444 > /var/log/selenium/selenium-output.log 2> /var/log/selenium/selenium-error.log & echo $! > /tmp/selenium.pid
echo "Starting Selenium..."

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

@maanas
maanas / paginated_collection.js
Created November 23, 2012 01:54 — forked from io41/paginated_collection.js
Pagination with Backbone.js
// includes bindings for fetching/fetched
var PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage');
typeof(options) != 'undefined' || (options = {});
this.page = 1;
typeof(this.perPage) != 'undefined' || (this.perPage = 10);
},
fetch: function(options) {
@maanas
maanas / nginx.sh
Created November 4, 2012 02:01 — forked from makevoid/nginx.sh
nginx init.d file for centos/rhel - /etc/init.d/nginx
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
@maanas
maanas / README.markdown
Created October 15, 2012 08:11 — forked from lukemorton/README.markdown
Running Carbon and StatsD as Daemon on Centos init.d file for statsd and carbon on Centos

Forged by Maanas Royy from command logs

#Centos 6.3 x86_64

Install the required dependencies

yum install -y git gcc gcc-c++ zlib-devel curl curl-devel openssl

Install node

git clone git://github.com/joyent/node.git
cd node