Skip to content

Instantly share code, notes, and snippets.

#Part 1 - Set up credentials
$VMLocalAdminUser = "LocalAdminUser"
$VMLocalAdminSecurePassword = ConvertTo-SecureString "NotARealPassword!@#$%433" -AsPlainText -Force
$Credential = New-Object System.Management.Automation.PSCredential ($VMLocalAdminUser, $VMLocalAdminSecurePassword);
#Part 2 - create RG and VM
New-AzResourceGroup -Name todeleteRG -Location EastUS
@waiholiu
waiholiu / newrepo.bat
Last active August 6, 2024 00:18
bat file to automatically create a repo you want and boot up vs code
:: How to set this up
:: Put this file in a directory then add the directory to the PATH environment variable.
:: then run this using Alt-R and type newrepo
:: remember to set the new directory to the name you want
@echo off
:: Prompt the user for the directory name
set /p dirname="Enter the name of the new directory (leave blank for default): "
@waiholiu
waiholiu / deleteRG.ps1
Last active January 29, 2022 05:53
Powershell script to delete all resource groups beginning with "todelete"
try
{
"Logging in to Azure..."
Connect-AzAccount -Identity
}
catch {
Write-Error -Message $_.Exception
throw $_.Exception
}
git config --global user.email $(Build.RequestedForEmail)
git config --global user.name $(Build.RequestedFor)
git switch $(Build.SourceBranchName)
git add -A
git commit -m "changes exported from dev"
git push https://$env:SYSTEM_ACCESSTOKEN@dev.azure.com/wai0211/TestProj/_git/Zoo
// part 1 - get this query from advanced find
var xml = `<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="new_widget">
<attribute name="new_widgetid" />
<attribute name="createdon" />
<attribute name="new_isblue" />
<order attribute="createdon" descending="false" />
</entity>
// part 1 - get this query from advanced find
var xml = `<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="new_widget">
<attribute name="new_widgetid" />
<attribute name="createdon" />
<attribute name="new_isblue" />
<order attribute="createdon" descending="false" />
</entity>
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { MatButtonModule } from '@angular/material/button';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatListModule } from '@angular/material/list';
import { MatToolbarModule } from '@angular/material/toolbar';
import { MatCardModule } from '@angular/material/card';
import { MatInputModule } from '@angular/material/input';
import { MatDividerModule } from '@angular/material/divider';
import {MatBadgeModule} from '@angular/material/badge';
@waiholiu
waiholiu / gist:2651c6b324687e0e8c8b6085272d00ef
Created February 8, 2020 04:23
example of how to access graphql using apollo
import { Component } from '@angular/core';
import { AngularFireAuth } from '@angular/fire/auth';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import gql from 'graphql-tag';
import { Apollo } from 'apollo-angular';
const gqlTestHelloWorld = gql`
query{
helloworld(newArg: 21)
}
@waiholiu
waiholiu / graphql.module.ts
Created February 8, 2020 03:40
graphql.module.ts (local)
import { LocalStorageService } from 'angular-2-local-storage';
import { NgModule } from '@angular/core';
import { ApolloModule, APOLLO_OPTIONS, Apollo } from 'apollo-angular';
import { HttpLinkModule, HttpLink } from 'apollo-angular-link-http';
import { InMemoryCache } from 'apollo-cache-inmemory';
import { ApolloLink } from 'apollo-link';
import { environment } from 'src/environments/environment';
// const uri = 'https://o5x5jzoo7z.sse.codesandbox.io/graphql'; //our test Graphql Server which returns rates
const uri = environment.serverUrl + '/graphql';
@waiholiu
waiholiu / GraphQLController.cs
Created January 3, 2020 01:31
GraphQLController.cs
using System;
using System.Threading.Tasks;
using GraphQL;
using GraphQL.Types;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;