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
# SEO: azure powerbi public ip allow in network security group firewall | |
# this code will get the latest Azure public IP's from Azure public cloud for PowerBI, and allow them to connect on port 5432 postgresql | |
# feel free to copy-paste for your needs. | |
# MS doesn't have a static URL or API for the latest IP's, so this script will find the right URL | |
# MS doesn't support Azure CLI from a Powershell Azure Function. I ended up running this as an Azure DevOps pipeline with a cron schedule every day. | |
# star this if it was useful for you :) | |
function Throw-WhenError { | |
param ( | |
[string] |
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 Get-User($user) | |
{ | |
# this function should be passed the CN of the user to be returned | |
$dom = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain() | |
$root = [ADSI] "LDAP://$($dom.Name)" | |
$searcher = New-Object System.DirectoryServices.DirectorySearcher $root | |
$searcher.filter = "(&(objectCategory=person)(objectClass=user)(cn=$user))" | |
$user = $searcher.FindOne() | |
[System.Collections.Arraylist]$names = $user.Properties.PropertyNames | |
[System.Collections.Arraylist]$props = $user.Properties.Values |
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
import { Component, OnInit, OnDestroy } from "@angular/core"; | |
import { HubConnection, HubConnectionBuilder } from '@aspnet/signalr'; | |
@Component({ | |
selector: "app-my", | |
templateUrl: "./my.component.html", | |
styleUrls: ["./my.component.scss"], | |
}) | |
export class MyComponent implements OnInit, OnDestroy { | |
private hubConnection: HubConnection; |
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
resource "aws_rds_cluster" "default" { | |
cluster_identifier = "moulding-cluster-${terraform.workspace}" | |
availability_zones = ["eu-west-1a", "eu-west-1b", "eu-west-1c"] | |
database_name = "MouldingCloudDb_${terraform.workspace}" | |
master_username = "${var.rds-user}" | |
master_password = "${var.rds-password}" | |
skip_final_snapshot = true | |
vpc_security_group_ids = ["${aws_default_security_group.default.id}"] | |
db_subnet_group_name = "${aws_db_subnet_group.default.id}" | |
} |
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
# DANGER. DON'T RUN UNLESS YOU REALLY WANT TO DELETE ALL YOUR AWS CONFIG RULES. | |
$deserialized = aws configservice describe-config-rules | ConvertFrom-Json | |
$arr = $deserialized.ConfigRules | select -ExpandProperty ConfigRuleName | |
foreach($x in $arr) { | |
# if your API keys aren't setup you may want to add them in the script | |
aws configservice delete-config-rule --config-rule-name $x | write-host | |
} |
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
{"lastUpload":"2017-07-18T10:48:01.484Z","extensionVersion":"v2.8.2"} |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace StatisticCalculations | |
{ | |
public class Program | |
{ |
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
// Sending client | |
private void UpdateServer() | |
{ | |
string headJSON = JsonConvert.SerializeObject(head); // head is class for the snake's head object | |
byte[] msg = Encoding.ASCII.GetBytes(headJSON); | |
int bytesSent = socketSender.Send(msg); | |
} | |
// Receiving-end socket listener | |
byte[] bytes = new byte[1024]; |
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
// nu med c# stack | |
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; |
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
# Super simple URL/link scraper for any Reddit comment thread, enjoy! | |
# Requires PRAW and BeautifulSoup4, only tested on Python 2.7 | |
threadID = "3rns3d" # Change threadID to the one you wish to scrape (hint: the ID is in the url) | |
import praw | |
import codecs | |
import pprint | |
import HTMLParser | |
from bs4 import BeautifulSoup |