Skip to content

Instantly share code, notes, and snippets.

@prashanthrajagopal
prashanthrajagopal / get_url.au3
Last active August 29, 2015 14:02
Get the browser from URL for firefox and IE with auto it
if $CmdLine[0] >= 1 Then
$userInput = $CmdLine[1]
Else
$userInput = InputBox("GetURL", "Enter the bame of the browser", "firefox", "", "")
EndIf
if $userInput == "firefox" Then
$window = "[CLASS:MozillaWindowClass]"
if not winexists($window)=1 then;
MsgBox(0, "GetURL", "Mozilla Firefox is not running")
@prashanthrajagopal
prashanthrajagopal / restart.bat
Last active August 29, 2015 14:02
Batch Script to restart a process if not already running. It runs every 5 seconds
@echo off
:loop
REM Check if the process is already running
tasklist /fi "imagename eq %1" | find /i "%1" > nil
if errorlevel 1 (
REM If not start the process
goto :main
) else (
REM Else keep checking every 5 seconds whether it is alive
@prashanthrajagopal
prashanthrajagopal / ruby_proxy.rb
Last active August 29, 2015 14:02
A simple proxy server in Ruby
require 'net/http'
require 'net/https'
require 'uri'
require 'pry'
class Proxy
def server(port)
puts "Starting Proxy server on port #{port}"
@socket = TCPServer.new('localhost', port)
loop do
@prashanthrajagopal
prashanthrajagopal / persistent_ssh.sh
Created May 5, 2014 18:24
Persistent Interactive SSH connection to multiple servers
#!/bin/bash
set -e
###############################################
### Add this to your ~/.ssh/config #
### ControlPath ~/.ssh/master-%r@%h:%p #
### ControlMaster no #
### Run this as ./persistent_ssh.sh box1 box2 #
###############################################
MY_PROMPT="$ "
@prashanthrajagopal
prashanthrajagopal / mirror_sync_cron.sh
Last active December 8, 2019 01:38
Sync Ubuntu Mirror v1
### Admin email address
admin_email=admin@domain.com
### Setup the server to mirror
mirror=rsync://archive.ubuntu.com/ubuntu
### Log file path
log=/var/log/ubuntu
### Setup the local directory