Skip to content

Instantly share code, notes, and snippets.

-- Send iMesage with AppleScript
-- @description This script open Messages application and sends iMessage to
-- specific apple id.
--
-- @note Before run go to Messages and create the conversation (aka. send one
-- message)
--
-- @run osascript sendAppleMessage.applescript "user@email.com" "This is an iMessage send from applescript"
on run {sndAppleID, sndMessage}
tell application "Messages"
@ajitam
ajitam / keybase.md
Created October 18, 2017 12:42
PROOF

Keybase proof

I hereby claim:

  • I am ajitam on github.
  • I am ajitam (https://keybase.io/ajitam) on keybase.
  • I have a public key whose fingerprint is 2163 45EF 6AC1 6AF6 3643 F24E 624F 3155 458B 4422

To claim this, I am signing this object:

@ajitam
ajitam / wherewhen.sh
Created October 7, 2013 11:15
WhereWhen
#!/bin/bash
#clear
# Ping to get ART table (in case there were no activity for some time)
/sbin/ping -t 1 255.255.255.255
#echo -----------------------
# Scan network and find UG (U - Up, G - Gateway)
netstat=$(/usr/sbin/netstat -nr | grep UG)
#echo Netstat output: $netstat
@ajitam
ajitam / Only numbers
Created September 18, 2013 12:11
Add class "js-number-only" to input to limit input to numbers only
$(".js-number-only").bind('change keyup input', function() {
var value = $(this).val();
value = value.replace(/[^0-9]+/g, '');
$(this).val(value);
});
@ajitam
ajitam / codes
Last active December 21, 2015 21:49
Need codes which doesn't start with number? Here you go :)
<?php
$time = time();
$codes = array();
while (count($codes) < 5) {
$code = $time*$time;
$code -= rand(0,999999);
$code = sha1($code);
if(!is_numeric(substr($code, 0, 1))){
array_push($codes, $code);
@ajitam
ajitam / locator.js
Last active December 18, 2015 08:39
Get user location. Is there a better way?
// http://jsfiddle.net/2vbY8/1/
var locator = {
current_location: null,
getLocation: function() {
if (navigator.geolocation) {
// Browser DOES support HTML location
navigator.geolocation.getCurrentPosition(locator.locationOK,locator.locationFAIL);
} else {
var max_height = 0;
$(".resize-height li").removeAttr('style');
$(".resize-height li").each(function() {
if($(this).outerHeight() > max_height) {max_height = $(this).outerHeight();}
});
$(".resize-height li").css('min-height', max_height+5+'px');
@ajitam
ajitam / Torrentleach filter
Last active December 17, 2015 15:19
Torrentleech - movies downloded times... (Minimalist - Chrome extension)
var times,
opacity;
$("#torrenttable tbody tr").each(function() {
times = $(this).find('td').eq(5).text();
//console.log(parseInt(times.replace("times", ""),10));
opacity = (parseInt(times.replace("times", ""),10))*0.000225;
$(this).css('background-color', 'rgba(255,0,0,'+opacity+')');
});
@ajitam
ajitam / widget_weather.php
Created April 21, 2012 19:13
Get weather from ARSO
<?php
date_default_timezone_set('Europe/Belgrade');
function align($string, $width) {
$spaces = 0;
$spaces = $width - strlen($string);
for($i = 0; $i < $spaces; $i++) {
$result .= " ";
}
@ajitam
ajitam / html5.html
Created July 28, 2011 09:00
html5 structure
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>...</title>
</head>
<body>
<!-- Header -->
<header>...</header>