Skip to content

Instantly share code, notes, and snippets.

@zymr-keshav
zymr-keshav / Ubuntu to macOS.md
Created September 15, 2017 04:27
useful tweaks and tip while switching from ubuntu to macOS x

MacOS Sierra 10.12.5 Macbook Pro ( Ratina )

Ubuntu to Mac os.

  1. You can not create new file from context menu but can create new folder only. alternative: use touch filename
  2. No utility to lock the monitor alternative: a. Navigate to  icon --> System Prefrences --> Security & Privacy --> General --> Check Require Password immediately after sleep or screen saver starts b. hit Shift-Control-Power hold them down for two seconds, revoke by Spacebar
  3. No way to see hidden files in a folder.
@zymr-keshav
zymr-keshav / app.sh
Created September 10, 2017 10:48
curl using bash script with post data which have current time and random number
#!/bin/bash
# call as `sh app.sh -u <app uuid> -i <app ip> -t <url>`
# exmaple sh app.sh -u 595e341fd7391071d21ce1b5 -i 20.20.1.73 -t /monitor/application/acme/
# if you do not want to use - argument than comment while loop and uncomment commented uuid and ip
while getopts u:i:t: option
do
case "${option}"
in
u) uuid=${OPTARG};;
i) ip=${OPTARG};;
@zymr-keshav
zymr-keshav / servlet.sh
Last active September 10, 2017 10:44
create entry in mongodb using this script for monitoring data
#!/bin/bash
# call as `sh servlet.sh <node uuid> <node ip> <url> [servlet type]`
# exmaple sh servlet.sh 595e341fd7391071d21ce1b5 20.20.1.73 /servlet/acme/ CompareServer-0
header="Content-Type: application/json"
enc=$(gshuf -i 0-1000 -n 1) #generate random number (in unix use shuf , remove prefix g)
dec=$(gshuf -i 10-600 -n 1)
now=$(gdate +%s%3N) #generate current time in miliseconds ( in unix use date, remove prefix g )
uuid=$1 #first argument
ip=$2 #second argument
url_less=${3%/} #remove trailing slash, if any
@zymr-keshav
zymr-keshav / _filter.controller.js
Last active August 31, 2017 19:15
useful angulr basic filters
(function() {
'use strict';
angular
.module('app')
.filter('STRING_LIMIT_FILTER', function() {
return function(input, num) {
let output = input.split(' ').slice(0, num).join(' ');
return output;
@zymr-keshav
zymr-keshav / Prefrences.sublime-settings
Created August 29, 2017 10:10
Sublime text 3 Settings for mac os
{
"always_show_minimap_viewport": true,
"auto_complete": true,
"auto_complete_commit_on_tab": false,
"auto_complete_with_fields": true,
"bold_folder_labels": true,
"caret_extra_bottom": 1,
"caret_extra_top": 1,
"caret_extra_width": 1,
"caret_style": "blink",
@zymr-keshav
zymr-keshav / timechart.js
Created August 14, 2017 06:43
create default 12 hours tiem data with difference of 1 hour
const getDatesRangeArray = function(startDate, endDate, unit, step) {
// console.log("getDatesRangeArray", arguments);
var interval = {
unit_: unit || 'hours',
step_: step || 1
},
dateArray = [],
currentDate = startDate;
// console.log("currentDate", currentDate);
while (currentDate <= endDate) {
@zymr-keshav
zymr-keshav / sw.js
Created August 1, 2017 12:12
Service Worker Example
'use strict';
let appCaches = [{
name: 'app',
urls: [
'/app/',
'/'
]
}, {
name: 'offline',