Skip to content

Instantly share code, notes, and snippets.

Avatar

Rahul itzrahulsoni

View GitHub Profile
View exports.js
console.log(module.filename); // /<folder path>/exports.js
console.log("Module Exports Filename = ", module.exports.filename); // undefined
console.log("Exports Filename = ", exports.filename); // undefined
console.log("Overwriting Exports");
exports = {
filename:"boo"
}
console.log("Module Exports Filename = ", module.exports.filename); // undefined
@itzrahulsoni
itzrahulsoni / azure-resource-group.sh
Last active Oct 9, 2017
Manage VMs of a specific Resource Group in Azure
View azure-resource-group.sh
#!/bin/bash
AZURE_RESOURCE_GROUP='YOUR_RESOURCE_GROUP_NAME'
if [ $1 == "start" ];
then
VM_NAMES=$(az vm list -g $AZURE_RESOURCE_GROUP --show-details --query "[?powerState=='VM deallocated'].{ name: name }" -o tsv)
for NAME in $VM_NAMES
do
echo "Starting $NAME"
@itzrahulsoni
itzrahulsoni / gist:3f3a06714d725720c2495543b3864264
Last active Nov 20, 2016
Code Injection for Ghost so that the external links open in new tab.
View gist:3f3a06714d725720c2495543b3864264
<script>
// By default, Ghost blogging platform opens external links in the existing tab.
// You may the change the behavior if it is not desired.
// The following code opens all external links in a new tab.
$(document).ready(function() {
// Create a regex with current location
var regex = '/' + window.location.host + '/';
regex = regex.replace(/\./g,'\\\.');
var exp = new RegExp(regex);
// Find all links