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
#
# /etc/rc.d/init.d/selenium
#
# chkconfig: 345 95 28
# description: Starts/Stops Selenium server
# processname: selenium
#
. /etc/init.d/functions
#!/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 / supervisord.conf
Created August 31, 2013 09:21
supevisord configuration file
; localhost supervisor config file.
;
; For more information on the config file, please see:
; http://supervisord.org/configuration.html
;
; Note: shell expansion ("~" or "$HOME") is not supported. Environment
; variables can be expanded using this syntax: "%(ENV_HOME)s".
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
@maanas
maanas / supervisord
Created August 31, 2013 09:19
System Startup Script for supervisord in CentOS
#!/bin/sh
#
# /etc/rc.d/init.d/supervisord
#
# Supervisor is a client/server system that
# allows its users to monitor and control a
# number of processes on UNIX-like operating
# systems.
#
# chkconfig: - 64 36
@maanas
maanas / ngnix-hp-build
Created April 14, 2013 05:29
High Performance nginx server with luajit, drizzle, upload
# Nginx High Performance Server Build Script for CentOS, SL
# Copyright Maanas Royy <m4manas@gmail.com>
### Install Section ###
## Uncomment to run only first time ##
# Install Dependencies
#yum groupinstall “Development Tools”
# Install Additional Packages
#yum install zlib-devel openssl openssl-devel cpio expat-devel gettext-devel pcre pcre-devel
@maanas
maanas / video.js
Last active December 14, 2015 14:59
AGMS Javascript Code to embed a file in webpage
<script type="text/javascript" src="http://wow.agms.co/jwplayer/mobile.js"></script>
<script type="text/javascript" src="http://wow.agms.co/jwplayer/jwplayer.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"> </script>
<script type="text/javascript">
if (mobileCheckIsMobile()) {
// Load for Tablet / Handheld mp4
jwplayer("video").setup({
file: "http://wow.agms.co:1935/free/mp4:the_karate_master_a.mp4/playlist.m3u8",
controlbar: "over",
height: 360,
@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