Skip to content

Instantly share code, notes, and snippets.

Avatar

Pedro Santiago phsantiago32

  • Integer Consulting
  • Lisboa, Portugal
View GitHub Profile
@phsantiago32
phsantiago32 / Program.cs
Created Nov 22, 2019 — forked from DanielSWolf/Program.cs
Console progress bar. Code is under the MIT License: http://opensource.org/licenses/MIT
View Program.cs
using System;
using System.Threading;
static class Program {
static void Main() {
Console.Write("Performing some task... ");
using (var progress = new ProgressBar()) {
for (int i = 0; i <= 100; i++) {
progress.Report((double) i / 100);
@phsantiago32
phsantiago32 / import-sites.bat
Created Nov 8, 2019
Import IIS sites from XML command
View import-sites.bat
%windir%\system32\inetsrv\appcmd add site /in < c:\sites.xml
View gist:be15671062d90edf5cc4f02d74bc4e7c
appcmd list site /config /xml > c:\sites.xml
@phsantiago32
phsantiago32 / MyDbContext.cs
Created Aug 2, 2019
C# snippet for connecting to an Azure DB instance via access token in a .NET Core app
View MyDbContext.cs
using Microsoft.Azure.Services.AppAuthentication;
using System.Data.SqlClient;
namespace MyApp.Infrastructure.EntityFramework
{
public class MyDbContext : DbContext
{
public MyDbContext()
{
var conn = (SqlConnection)this.Database.GetDbConnection();
@phsantiago32
phsantiago32 / Dockerfile
Created Oct 9, 2018
Dockerfile for running an instance of hubot on Heroku
View Dockerfile
FROM alpine
# Install dependencies
RUN apk update && apk upgrade \
&& apk add --update nodejs nodejs-npm \
&& npm install -g npm
# Create hubot user
RUN adduser -h /hubot -s /bin/bash -S hubot
USER hubot
View run-splunk-on-docker.sh
#!/bin/sh
docker run --name splunk --hostname splunk -p 8000:8000 -p 8088:8088 -p 10000:10000 -d -e "SPLUNK_START_ARGS=--accept-license --answer-yes --seed-passwd {YOUR_PASSWORD}" -e "OPTIMISTIC_ABOUT_FILE_LOCKING=1" splunk/splunk
@phsantiago32
phsantiago32 / docker-compose.yaml
Last active Oct 27, 2017
Compose file for creating a CI/CD stack using Rancher and Drone with and external MySql database and Nginx
View docker-compose.yaml
version: '2'
services:
rancher-server:
image: rancher/server:stable
restart: unless-stopped
container_name: rancher-server
volumes_from:
- mysql
environment:
- CATTLE_DB_CATTLE_MYSQL_NAME=cattle
@phsantiago32
phsantiago32 / Bootstrapper.cs
Created Jul 28, 2017
Nancy bootstrapper that sets request pipeline logging with and Serilog
View Bootstrapper.cs
using Nancy;
using Nancy.Bootstrapper;
using Nancy.TinyIoc;
using Serilog;
using System.Diagnostics;
namespace MyApp.Bootstrappers
{
public class Bootstrapper : DefaultNancyBootstrapper
{
@phsantiago32
phsantiago32 / appveyor.yml
Created Jul 18, 2017
Basic .yml template for publishing .NET Core NuGet packages using AppVeyor
View appveyor.yml
os: Visual Studio 2017
version: 1.0.{build}
branches:
only:
- master
configuration:
- Release