Skip to content

Instantly share code, notes, and snippets.

View mubbashir's full-sized avatar

Ahmed Mubbashir Khan mubbashir

View GitHub Profile
@mubbashir
mubbashir / build.gradle
Last active April 9, 2019 11:38
Gradle task to check files/commands in PATH environment variable
// rest of your build
// Verfied with gradle 4.10
task("checkEnv"){
doFirst {
def listOfFileToCheckInPath = ['find', 'grep']
listOfFileToCheckInPath.each { file ->
if(!isFoundInPath(file))
throw new GradleException("${file} was not found in any of the folder in PATH: ${System.getenv('PATH').split(File.pathSeparator)}")
}
}
@mubbashir
mubbashir / await_files.sh
Created February 16, 2018 00:27
bash waiting for files to appear on multiple hosts
#!/bin/sh
await_file_received()
{
printf "===> checking the number of raw files on all workstations...\n"
fileHOST=`find /files/dict -type f | wc -l`
file_REMOTE_HOST_1=`ssh uesr@${REMOTE_HOST_1} "find /files/dict -type f | wc -l"`
file_REMOTE_HOST_2=`uesr@${REMOTE_HOST_2} "find /files/dict -type f | wc -l"`
## Calculating diff using bc for details read `man bc`
diff_HOST_REMOTE_1=`echo ${fileHOST} - ${file_REMOTE_HOST_1} | bc`
diff_HOST_REMOTE_2=`echo ${fileHOST} - ${file_REMOTE_HOST_2} | bc`

Keybase proof

I hereby claim:

  • I am mubbashir on github.
  • I am mubbashir (https://keybase.io/mubbashir) on keybase.
  • I have a public key whose fingerprint is 7578 B5CA A7FE 9795 B855 ADEA 786D 515C 95D1 7515

To claim this, I am signing this object:

@mubbashir
mubbashir / OpenWithSublimeText3.bat
Created March 24, 2017 16:43 — forked from roundand/OpenWithSublimeText3.bat
Open folders and files with Sublime Text 3 from windows explorer context menu (tested in Windows 7)
@echo off
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@mubbashir
mubbashir / mandrill-sync.py
Created November 22, 2015 13:54 — forked from azizmb/mandrill-sync.py
Simple script to sync templates across two mandrill accounts.
import optparse
from mandrill import Mandrill
from mandrill import UnknownTemplateError
def sync_templates(source_key, destination_key, update_existing=True, dry_run=False):
def perform_action(action):
'''Simple wrapper to skip actaully doing anything if dry run is enabled.
@mubbashir
mubbashir / Jenkins+Script+Console.md
Last active October 9, 2023 07:10 — forked from dnozay/_Jenkins+Script+Console.md
jenkins groovy scripts collection.
@mubbashir
mubbashir / chrome_driver_path
Created March 26, 2014 03:56
setting up chrome-driver path in ruby
require 'selenium-webdriver'
Selenium::WebDriver::Chrome.driver_path="/path/to/chrome_driver_binary/chromedriver"
driver = Selenium::WebDriver.for :chrome
driver.get("http://google.com")
@mubbashir
mubbashir / rss_infor.rb
Created October 13, 2011 08:06
rss_infor.rb
require 'rss/2.0'
require 'open-uri'
def get_feed_result (url)
feed_url = url
open(feed_url) do |http|
response = http.read
result = RSS::Parser.parse(response, false)
end
end
@mubbashir
mubbashir / click_on_apple.rb
Created July 9, 2011 21:04
using Sikuli in ruby to click on apple icon (in mac os x)
require 'java'
java_import 'org.sikuli.script.Screen'
screen = Screen.new
image_path='/Users/mubbashir/Desktop'
screen.click("#{image_path}/apple.png", 0)