This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function rco { | |
| git reflog | egrep -io "moving from ([^[:space:]]+)" | awk '{ print $3 }' | head -n10 | sort | uniq | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo mkdir /buildArtifacts | |
| response=$(curl --silent --header "Metadata: true" "http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https%3A%2F%2Fvault.azure.net") | |
| sudo echo $response >> /buildArtifacts/output | |
| access_token=$(echo $response | jq -r '.access_token') | |
| sudo curl --silent --header "Authorization: Bearer $access_token" "https://ghpiimagekeyvault.vault.azure.net/secrets/password/50d9c07516ff4a9c8c779015abbced94?api-version=2016-10-01" >> /buildArtifacts/output |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/python | |
| # importing the requests library | |
| import requests | |
| # Step 1: Fetch an access token from an MSI-enabled Azure resource | |
| # Note that the resource here is https://vault.azure.net for the public cloud, and api-version is 2018-02-01 | |
| MSI_ENDPOINT = "http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https%3A%2F%2Fvault.azure.net" | |
| r = requests.get(MSI_ENDPOINT, headers = {"Metadata" : "true"}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <table> | |
| <thead> | |
| <tr> | |
| <th>Payment</th> | |
| <th>Issue Date</th> | |
| <th>Amount</th> | |
| <th>Period</th> | |
| </tr> | |
| </thead> | |
| <tbody> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| obj = '' | |
| obj.define_singleton_method :to_s, ->(s) { "hello #{s}" } | |
| obj.to_s('world') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var selectFlight = { | |
| fetchingFlights : null, | |
| init: function(){ | |
| $("#tabs").bind({ | |
| click: this.changeTab | |
| }); | |
| $('a').click(function(event) { | |
| event.preventDefault(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class B;end | |
| class A < B;end | |
| module C;end | |
| module D;end | |
| A.include C |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Class = function(){ | |
| var klass = function(){ | |
| this.init.apply(this, arguments); | |
| }; | |
| klass.prototype.init = function(){}; | |
| return klass; | |
| }; | |
| // Case 1 | |
| var Person = new Class; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Person < Struct.new(:name); end | |
| @tenants = ('ah'..'ch').map { |l| Person.new(l) } | |
| @tenant_names = @tenants.map(&:name) | |
| class TenantNamesNormalizer | |
| def initialize(tenant_names, filter_by_letter:nil, sorted_in_reverse: false) | |
| @tenant_names = tenant_names | |
| @filter_by_letter = filter_by_letter | |
| @sorted_in_reverse = sorted_in_reverse |
NewerOlder