Skip to content

Instantly share code, notes, and snippets.

🖨
Repeatedly commiting cloudbuild.yaml files

Chris S. yetanotherchris

🖨
Repeatedly commiting cloudbuild.yaml files
Block or report user

Report or block yetanotherchris

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@yetanotherchris
yetanotherchris / enable-iis-windows-10.ps1
Created May 21, 2016
Powershell script to enable all IIS, MSMQ and WCF features on Windows 8 and 10.
View enable-iis-windows-10.ps1
Import-Module Dism
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerRole
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServer
Enable-WindowsOptionalFeature -Online -FeatureName IIS-CommonHttpFeatures
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HttpErrors
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HttpRedirect
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ApplicationDevelopment
Enable-WindowsOptionalFeature -Online -FeatureName IIS-NetFxExtensibility
Enable-WindowsOptionalFeature -Online -FeatureName IIS-NetFxExtensibility45
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HealthAndDiagnostics
@yetanotherchris
yetanotherchris / gist:4986402
Created Feb 19, 2013
Wake up from sleep C# example
View gist:4986402
using System;
using System.Runtime.InteropServices;
using Microsoft.Win32.SafeHandles;
using System.Threading;
using System.ComponentModel;
namespace ConsoleApplication1
{
class Program
{
[DllImport("kernel32.dll")]
@yetanotherchris
yetanotherchris / aes-example.cs
Created Jan 18, 2017
C# AES asymmetric encryption and decryption example
View aes-example.cs
string ivAsBase64;
string encryptedTextAsBase64;
string keyAsBase64;
using (AesCryptoServiceProvider aes = new AesCryptoServiceProvider())
{
// Store the IV (they can be stored if you don't re-use a key)
aes.GenerateIV();
byte[] iv = aes.IV;
ivAsBase64 = Convert.ToBase64String(iv);
@yetanotherchris
yetanotherchris / docker-automation.py
Created Sep 5, 2016
Automating Docker images and containers with Python ()
View docker-automation.py
'''
This script brings up the entire stack of Docker containers, removing the current ones.
Docker compose was tried for this task and it wasn't customisable enough.
Docker cloud was tried (with stack files) and was buggy (failed to launch, no logs returned).
Docker machine was tried, but it can't connect to existing servers only ones it created.
Rancher was too heavy weight for the task, as the containers are lightweight in DigitalOcean.
Kubernetes would've been too heavy weight for DigitalOcean.
It was written in Powershell and worked. But then converting it to Bash was too much effort.
Powershell for Linux is too much effort to install without a debian package (and none standard)
@yetanotherchris
yetanotherchris / install-kops.sh
Last active Oct 29, 2019
Install Kops and prequisites on Ubuntu
View install-kops.sh
# Install AWS CLI, Kubectl, Kops
sudo apt update
sudo apt install -y awscli
sudo snap install kubectl --classic
curl -LO https://github.com/kubernetes/kops/releases/download/1.7.0/kops-linux-amd64
chmod +x kops-linux-amd64
mv ./kops-linux-amd64 /usr/local/bin/kops
# Setup the AWS profile
aws config
@yetanotherchris
yetanotherchris / install-mono-amazon-linux.sh
Last active Oct 29, 2019
Install Mono on Amazon Linux (CentOS too)
View install-mono-amazon-linux.sh
sudo yum update -y
echo "======= INSTALLING RPM FOR MONO ======="
sudo mkdir -p /tmp/mono_dependencies
cd /tmp/mono_dependencies
sudo wget https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/Packages/l/libpng15-1.5.27-1.fc25.x86_64.rpm
sudo yum install -y libpng15-1.5.27-1.fc25.x86_64.rpm
echo "======= INSTALLING MONO ============"
sudo yum install -y yum-utils
@yetanotherchris
yetanotherchris / in-memory-http-server.cs
Last active Oct 25, 2019
In memory http server for C# unit and integration tests
View in-memory-http-server.cs
public static Task BasicHttpServer(string url, string outputHtml)
{
return Task.Run(() =>
{
HttpListener listener = new HttpListener();
listener.Prefixes.Add(url);
listener.Start();
// GetContext method blocks while waiting for a request.
HttpListenerContext context = listener.GetContext();
@yetanotherchris
yetanotherchris / google-cloud-pubsub-example.cs
Last active Oct 23, 2019
Google Cloud Pub/Sub C# example
View google-cloud-pubsub-example.cs
//
// Google Cloud Pub/Sub C# example
// NOTE: This is a .NET Core 1.1 console app.
// Use "dotnet run" to run it, run setup.ps1 first.
//
using System;
using System.Collections.Generic;
using Google.Cloud.PubSub.V1;
using Google.Protobuf;
@yetanotherchris
yetanotherchris / install-rabbitmq.sh
Last active Oct 19, 2019
RabbitMQ on Docker with admin UI
View install-rabbitmq.sh
# AWS specific install of Docker
sudo yum update -y
sudo yum install -y docker
sudo service docker start
sudo usermod -a -G docker ec2-user
# exit the SSH session, login again
# Docker
docker run -d --hostname my-rabbit --name some-rabbit -p 4369:4369 -p 5671:5671 -p 5672:5672 -p 15672:15672 rabbitmq
View C# MD5 and SHA encryption wrapper class
public class HashEncryption
{
/// <summary>
/// Encrypts a string using the MD5 hash encryption algorithm.
/// Message Digest is 128-bit and is commonly used to verify data, by checking
/// the 'MD5 checksum' of the data. Information on MD5 can be found at:
///
/// http://www.faqs.org/rfcs/rfc1321.html
/// </summary>
/// <param name="Data">A string containing the data to encrypt.</param>
You can’t perform that action at this time.