Skip to content

Instantly share code, notes, and snippets.

View atrauzzi's full-sized avatar

Alexander Trauzzi atrauzzi

View GitHub Profile
@atrauzzi
atrauzzi / google-cloud-run-get-project-hash.sh
Last active May 25, 2023 00:41
Google Cloud Run Get Project Hash
#!/bin/bash
PROJECT=${1:-"$(gcloud config get-value project)"}
REGION=${2:-"us-central1"}
IMAGE="hub.docker.com/_/nginx"
{
gcloud services enable "run.googleapis.com" --project="${PROJECT}"
gcloud auth configure-docker --quiet
@atrauzzi
atrauzzi / deploy.sh
Last active July 9, 2020 08:06
🖋 Azure App Service deployment using bash and CURL
#!/bin/bash
NAME="some-convention-driven-name-usually-a-resource-group"
APP="your-app-name-ideally-another-convention"
DEPLOYMENT_PASSWORD=`az appservice web deployment list-site-credentials \
--resource-group ${NAME} \
--name ${APP} \
--query publishingPassword \
--output tsv`
@atrauzzi
atrauzzi / Spawn.ts
Last active September 21, 2017 15:35
A utility to spawn commands using C# from edgejs in nodejs & TypeScript!
// tslint:disable-next-line:no-var-requires
const edge = require("edge-js");
export interface Options {
fileName: string;
arguments?: string;
}
@atrauzzi
atrauzzi / ApplicationDbContext.cs
Last active September 2, 2017 21:44
Using Postgres on Docker with EF7 and ASP.NET 5
namespace App {
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.Data.Entity;
public class ApplicationDbContext : IdentityDbContext {
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) {
@atrauzzi
atrauzzi / stuff.md
Last active February 20, 2017 23:21
🖋 - This should be a blog type.

This is a 2nd level heading, do you enjoy it?

Any markdown file found inside of the gist will be used as the body of a blog post.

There might be opportunities to do cool things with attached files, but let's just call that a stretch.

Another second level heading

What's going on here?!

@atrauzzi
atrauzzi / cors.xml
Last active April 1, 2016 13:23
Granting your app access to S3
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
using Nancy;
public class IndexModule : NancyModule {
// What would be neat is if I could teach Nancy new ways of handling the right side of routes.
public IndexModule() {
Get["/"] = typeof(MyProject.Controller.Home);
// This would perhaps run a standard method found on the class after instantiating it.
// http://stackoverflow.com/questions/20907068/how-to-create-a-strongly-typed-collection-that-only-contains-one-element-per-typ
class TypedSet<AbstractType> {
protected Dictionary<Type, AbstractType> data;
public TypedSet() {
data = new Dictionary<Type, AbstractType>();
}
public void Add(AbstractType subclassOfAbstract) {
@atrauzzi
atrauzzi / gist:7827217
Created December 6, 2013 16:04
Static route helpers.
<?php namespace My\Namespace;
use Illuminate\Support\Facades\Route;
class Routes {
public static function all() {
static::allDevice();
static::allPlatform();
public function setSentAttribute($value) {
if($value instanceof DateTime)
$value = $value->format('Y-m-d H:i:s');
$this->attributes['sent'] = $value;
}