Skip to content

Instantly share code, notes, and snippets.

@prashanthrajagopal
prashanthrajagopal / wordpress-update.sh
Last active September 29, 2015 20:40
wordpress-secure-update
#!/bin/bash
sudo adduser wp-user
cd /var/www/html
sudo chown -R wp-user:wp-user /var/www/html
sudo mkdir -p /home/wp-user/.ssh/
sudo chmod 0640 /home/wp-user/.ssh
sudo su -l wp-user -c "ssh-keygen -f /home/wp-user/.ssh/id_rsa -t rsa -b 4096 -N ''"
sudo chown wp-user:www-data /home/wp-user/.ssh/id_rsa*
sudo chmod 0700 /home/wp-user/.ssh/authorized_keys
@prashanthrajagopal
prashanthrajagopal / capistrano_feature_deploy.rb
Last active August 29, 2015 14:27 — forked from jrochkind/gist:4260448
A cap 'stage' for dynamic deploy of feature branch demos
####
#### Forked from https://gist.github.com/jrochkind/4260448
####
# require 'rvm/capistrano'
require 'fileutils'
# An experiment for a capistrano 'stage' that can actually be used to
# deploy multiple feature branches at once.
# Intended to be installed config/deploy/feature_demo , when using cap
# multi-stage support: add 'feature_demo' to 'stages' in `config/deploy.rb` too.
@prashanthrajagopal
prashanthrajagopal / logstash.conf
Last active August 29, 2015 14:27 — forked from mudge/logstash.conf
A grok pattern for Rails 3.2 logs for use with logstash. Assumes that you have a multiline filter to combine Rails logs into one line and only one worker is logging to a file (c.f. https://gist.github.com/mudge/5063930).
multiline {
tags => ["rails"]
pattern => "^Started"
negate => true
what => "previous"
}
@prashanthrajagopal
prashanthrajagopal / kibana4
Last active August 29, 2015 14:26 — forked from thisismitch/kibana-4.x-default
ELK Kibana4
#!/bin/sh
#
# /etc/init.d/kibana4 -- startup script for kibana4
# bsmith@the408.com 2015-02-20; used elasticsearch init script as template
# https://github.com/akabdog/scripts/edit/master/kibana4_init
#
### BEGIN INIT INFO
# Provides: kibana4
# Required-Start: $network $remote_fs $named
# Required-Stop: $network $remote_fs $named
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" use Vim mode instead of pure Vi, it must be the first instruction
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible
filetype off " required
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" vundle stuff
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set rtp+=~/.vim/bundle/Vundle.vim " set the runtime path to include Vundle and initialize
@prashanthrajagopal
prashanthrajagopal / varnish
Created October 22, 2014 06:57
/etc/default/varnish
# Should we start varnishd at boot? Set to "no" to disable.
START=yes
# Maximum number of open files (for ulimit -n)
NFILES=131072
# Maximum locked memory size (for ulimit -l)
# Used for locking the shared memory log in memory. If you increase log size,
# you need to increase this number as well
MEMLOCK=82000
@prashanthrajagopal
prashanthrajagopal / default.vcl
Created October 22, 2014 06:54
Varnish VCL Config
# Adapted from https://gist.github.com/4651531.git with a few mods according to my needs
backend default {
.host = "127.0.0.1";
.port = "8888";
.connect_timeout = 60s;
.first_byte_timeout = 60s;
.between_bytes_timeout = 60s;
.max_connections = 800;
}
@prashanthrajagopal
prashanthrajagopal / selenium_rc_client_sample.rb
Created June 27, 2014 06:51
A sample selenium RC client
require "selenium/client"
selenium = Selenium::Client::Driver.new("localhost", 4444, "*firefox", "http://www.google.com/", 60);
selenium.start
selenium.open "/"
selenium.type "q", "bowsersttack"
selenium.click "btnG"
selenium.wait_for_page_to_load "30000"
puts selenium.get_html_source
@prashanthrajagopal
prashanthrajagopal / Diff
Last active August 29, 2015 14:02
Disable logoff, restart an shutdown from the menu drop down in osx
[100 +] prashanthrajagopal ~/StandardMenus.nib
=> diff objects.xib /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/English.lproj/StandardMenus.nib/objects.xib
185a186,212
> <object class="IBCarbonMenuItem" id="236">
> <string name="title">Sleep</string>
> <ostype name="command">slep</ostype>
> </object>
> <object class="IBCarbonMenuItem" id="237">
> <string name="title">Restart…</string>
> <boolean name="dynamic">TRUE</boolean>
@prashanthrajagopal
prashanthrajagopal / auto_login.scpt
Created June 20, 2014 07:30
Applescript to enable Auto Login in OSX
set username to do shell script "whoami"
set uid to do shell script "id | cut -d' ' -f1 | cut -d'=' -f2 | cut -d'(' -f1"
do shell script "/usr/bin/defaults write /Library/Preferences/com.apple.loginwindow autoLoginUser " & username with administrator privileges
do shell script "/usr/bin/defaults write /Library/Preferences/com.apple.loginwindow autoLoginUserUID " & uid with administrator privileges
display dialog "User " & username & " is now the default Auto Login."