Skip to content

Instantly share code, notes, and snippets.

@prashanthrajagopal
prashanthrajagopal / selenium_curl.sh
Last active March 13, 2024 16:19
Run Selenium test via curl
s_id=`curl -X POST http://127.0.0.1:4444/wd/hub/session -d '{"desiredCapabilities":{"browserName":"firefox","platform":"MAC"}}'|awk -F'"' '{print $6}'`
curl -X POST http://127.0.0.1:4444/wd/hub/session/$s_id/url -d '{"url":"http://www.google.com"}'
curl -X POST http://127.0.0.1:4444/wd/hub/session/$s_id/element -d '{"using":"id","value":"gbqfq"}'
curl -X POST http://127.0.0.1:4444/wd/hub/session/$s_id/element/0/value -d {"value":["selenium"]}
curl -X POST http://127.0.0.1:4444/wd/hub/session/$s_id/element -d '{"using":"id","value":"gbqfb"}'
curl -X POST http://127.0.0.1:4444/wd/hub/session/$s_id/element/1/click
curl -X DELETE http://127.0.0.1:4444/wd/hub/session/$s_id/window
@prashanthrajagopal
prashanthrajagopal / get_url.scpt
Last active January 13, 2024 11:58
AppleScript to get url from Safari, Firefox and Chrome
display dialog "Name of the browser?" default answer "Safari"
set inp to text returned of result
tell application "System Events"
if inp is "Google Chrome" then
tell application "Google Chrome" to return URL of active tab of front window
else if inp is "Safari" then
tell application "Safari" to return URL of front document
else if inp is "Firefox" then
tell application "Firefox" to activate
@prashanthrajagopal
prashanthrajagopal / screenshot.cpp
Last active December 31, 2023 17:26
Take a screenshot and save as jpeg in c++
#include <stdio.h>
#include <windows.h>
#include <gdiplus.h>
#include <time.h>
int GetEncoderClsid(const WCHAR* format, CLSID* pClsid) {
using namespace Gdiplus;
UINT num = 0;
UINT size = 0;
@prashanthrajagopal
prashanthrajagopal / desktop_restrictions.reg
Last active November 23, 2023 17:50
Desktop restrictions for windows - very minimal access to users
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies]
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\ActiveDesktop]
"NoChangingWallPaper"=dword:00000001
"NoAddingComponents"=dword:00000001
"NoClosingComponents"=dword:00000001
"NoDeletingComponents"=dword:00000001
"NoEditingComponents"=dword:00000001
@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
[core]
whitespace = nowarn
pager = less -FRSX
edito = vim
editor = vim
whitespace=fix,-indent-with-non-tab,trailing-space#,cr-at-eol
autocrlf = input
[user]
name = Prashanth
email = Email
@prashanthrajagopal
prashanthrajagopal / aws_lambda_cloudformation_slack.js
Last active May 16, 2017 09:55
Lambda script to notify cloudformation events to slack through SNS
// Adaptation from https://medium.com/cohealo-engineering/how-set-up-a-slack-channel-to-be-an-aws-sns-subscriber-63b4d57ad3ea
var https = require('https');
var util = require('util');
exports.handler = function(event, context) {
console.log(JSON.stringify(event, null, 2));
console.log('From SNS:', event.Records[0].Sns.Message);
var postData = {
"channel": "#aws_playground",
@prashanthrajagopal
prashanthrajagopal / aws_lambda_cloudformation_slack.js
Created May 16, 2017 09:54
Lambda script to notify cloudformation events to slack
// Adaptation from https://medium.com/cohealo-engineering/how-set-up-a-slack-channel-to-be-an-aws-sns-subscriber-63b4d57ad3ea
var https = require('https');
var util = require('util');
exports.handler = function(event, context) {
console.log(JSON.stringify(event, null, 2));
console.log('From SNS:', event.Records[0].Sns.Message);
var postData = {
"channel": "#aws_playground",
#!/bin/bash
# Argument = -h -v -i groupId:artifactId:version -c classifier -p packaging -r repository -l location -u username -P password
#shopt -o -s xtrace
# Define Nexus Configuration
NEXUS_BASE=http://sonatype.nexus.example.com:8081/nexus
REST_PATH=/service/local
ART_REDIR=/artifact/maven/redirect
@prashanthrajagopal
prashanthrajagopal / Instructions.md
Created May 9, 2016 06:30 — forked from daneden/Instructions.md
Remap Caps Lock to Emoji on Mac

How to remap the caps lock key to the emoji selector on Mac

  1. Go to System Preferences -> Keyboard -> Modifier Keys...
  2. Change “Caps Lock” to “No action”
  3. Install Seil
  4. Change the Caps Lock key in Seil to keyCode 80 (F19)
  5. Install Karabiner
  6. Open Karabiner and go to Misc & Uninstall -> Open private.xml
  7. Copy the contents of this gist's example to the XML file and save
  8. In Karabiner, go to Change Keys -> Reload XML