Skip to content

Instantly share code, notes, and snippets.

View itaysk's full-sized avatar

Itay Shakury itaysk

View GitHub Profile
@itaysk
itaysk / Test_LB.js
Created August 3, 2015 13:50
Test load balancer
var request = require('request');
var a=0 ,b = 0, c=0;
var count=100;
for (var i = 0; i < count; i++) {
request('http://23.97.149.255/', function (error, response, body) {
if (!error && response.statusCode == 200) {
if (body == "10.2.0.4\n") {
a++;
}
else if (body == "10.2.0.6\n") {
@itaysk
itaysk / Show_IP.js
Created August 3, 2015 13:38
Web App that shows the IP address of the server
var http = require('http');
var os = require('os');
var msg = "";
var ifaces = os.networkInterfaces();
Object.keys(ifaces).forEach(function (ifname) {
ifaces[ifname].forEach(function (iface) {
if ('IPv4' !== iface.family || iface.internal !== false) {
// skip over internal (i.e. 127.0.0.1) and non-ipv4 addresses
return;
@itaysk
itaysk / LB_ARM.ps1
Last active August 29, 2015 14:26
Azure - Configure Load Balancer for existing VMs (ARM)
#public ip for the load balancer
$lbpip = New-AzurePublicIpAddress -Name "ironlbpip" -ResourceGroupName "iron" -Location "West Europe" –AllocationMethod Dynamic
#configure the public ip as the fronend ip for the load balancer (access endpoint from the internet)
$lbfe = New-AzureLoadBalancerFrontendIpConfig -Name "LB-Frontend" -PublicIpAddress $lbpip
#create an address pool for load balanced servers (later we add addresses to that pool)
$lbbepool= New-AzureLoadBalancerBackendAddressPoolConfig -Name "LB-backend"
#create a load balancing policy: balance all http traffic
$lbrule = New-AzureLoadBalancerRuleConfig -Name "HTTP" -FrontendIpConfiguration $lbfe -BackendAddressPool $lbbepool -Protocol Tcp -FrontendPort 80 -BackendPort 80
#Here we actually create the load balancer resource with all the settings previously defined
$lb = New-AzureLoadBalancer -ResourceGroupName "iron" -Name "ironlb" -Location "West Europe" -FrontendIpConfiguration $lbfe -LoadBalancingRule $lbrule -BackendAddressPool $lbbepool
@itaysk
itaysk / Download-GitHubRepos.ps1
Last active May 30, 2023 01:14
Download all repositories for a GitHub organization
Function Download-GitHubRepos ([string][parameter(mandatory=$true)] $orgid, [string]$saveLocation)
{
if (-not ([string]::IsNullOrEmpty($saveLocation)))
{
if (-not (Test-Path $saveLocation -PathType Container))
{
Throw "saveLocation is invalid"
}
if (-not ($saveLocation.EndsWith('\')) -or ($saveLocation.EndsWith('/')))
{