Skip to content

Instantly share code, notes, and snippets.

View pmgupte's full-sized avatar
🏠
Working from home 👨‍💻

Prabhas Gupte pmgupte

🏠
Working from home 👨‍💻
View GitHub Profile
  • object store
  • kafka
  • netty
  • cassandra
  • elastic search
  • stream processing (flink)
  • redis
  • spring
@pmgupte
pmgupte / splunk_commands.md
Last active August 31, 2016 06:58
Collection of Splunk commands which I find handy to use.
@pmgupte
pmgupte / servicenow-read-instance-name.js
Created June 1, 2016 13:44
Read servicenow instance name.
var instanceName = gs.getProperty('instance_name');
gs.info(instanceName);
@pmgupte
pmgupte / servicenow-read-attachment.js
Created January 15, 2016 05:20
Servicenow script - How to read attachment to a table record.
var grSysAtt = new GlideRecord('sys_attachment');
grSysAtt.addQuery('table_name', 'my_table'); // name of table whose record have attachment
grSysAtt.addQuery('table_sys_id', '557d2d9f4fb416406b6500f18110c71c'); // sys_id of record having attachment
grSysAtt.query();
while (grSysAtt.next()) {
var sa = new GlideSysAttachment();
var attachmentContents = sa.getContent(grSysAtt);
gs.info(attachmentContents);
}
@pmgupte
pmgupte / chunkIPRange.php
Last active October 6, 2016 07:04
PHP function to chunk the given IP address range into multiple ranges of given size.
<?php
/**
* Copyright (C) 2016 Prabhas Gupte
*
* This is free script: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This script is distributed in the hope that it will be useful,
@pmgupte
pmgupte / xml_to_array.php
Last active August 29, 2015 14:20
PHP one-liner to convert XML into Array
<?php
$arr = json_decode(json_encode(simplexml_load_string($xml, null, LIBXML_NOCDATA)), true);
?>
@pmgupte
pmgupte / sublime_text_2_trim_whitespaces.md
Last active August 29, 2015 14:07
Sublime Text 2: Trim trailing white spaces on save

Go to SublimeText 2 > Preferences > User Settings. This should open your User Settings as a JSON file. Add the following to your file:

"trim_trailing_white_space_on_save": true

@pmgupte
pmgupte / sites.geojson
Last active August 29, 2015 14:06
some sites and their server locations
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pmgupte
pmgupte / whitespaces_replace
Created September 12, 2014 08:36
Replace multiple (2+) whitespaces with single space
string = string.replace(/\s+/g, ' ');
@pmgupte
pmgupte / psql.md
Last active August 29, 2015 13:56
PSQL commands

#PSQL Commands

To dump data

schema + data

pg_dump -U dbUser --column-inserts --table=tableName

only schema

pg_dump -U dbUser --schema-only --table=tableName

only data

pg_dump -U dbUser --data-only --column-inserts --table=tableName