Skip to content

Instantly share code, notes, and snippets.

View robertgreiner's full-sized avatar

Robert Greiner robertgreiner

View GitHub Profile
@robertgreiner
robertgreiner / reverse.go
Last active October 30, 2016 19:57
Take a shortened URL and expand it to its final address
package main
import (
"fmt"
"log"
"net/http"
)
func main() {
resp, err := http.Get("http://bit.ly/2eXwN8A") //robertgreiner.com

If you take a flat map
And move wooden blocks upon it strategically,
The thing looks well, the blocks behave as they should.
The science of war is moving live men like blocks.
And getting the blocks into place at a fixed moment.
But it takes time to mold your men into blocks
And flat maps turn into country where creeks and gullies
Hamper your wooden squares. They stick in the brush,
They are tired and rest, they straggle after ripe blackberries,
And you cannot lift them up in your hand and move them.

docker rm -v $(docker ps -aq -f status=exited)
@robertgreiner
robertgreiner / CloudBlockBlobWrite.cs
Created September 26, 2013 18:43
How to write text to a CloudBlockBlob in Windows Azure
var storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("AzureStorageAccount"));
var blobClient = storageAccount.CreateCloudBlobClient();
var container = blobClient.GetContainerReference(containerName);
container.CreateIfNotExists();
CloudBlockBlob blob = container.GetBlockBlobReference(fileName);
blob.DeleteIfExists();
var options = new BlobRequestOptions()
{
@robertgreiner
robertgreiner / app.config
Created December 11, 2012 19:00
Configure Azure SDK 1.8 to work with WASABi (Fixes: Could not load file or assembly 'Microsoft.WindowsAzure.StorageClient, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies)
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.WindowsAzure.StorageClient" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="1.1.0.0" newVersion="1.7.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.WindowsAzure.StorageClient" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<publisherPolicy apply="no" />
@robertgreiner
robertgreiner / media-queries.css
Created October 10, 2012 22:30
My site's media queries
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) { }
@media only screen and (min-width: 450px) and (max-width: 710px) { /* Tablet sized viewport */}
@media only screen and (max-width: 449px) { /* Phone sized viewport */ }
@robertgreiner
robertgreiner / Web.config
Created October 10, 2012 16:07
FIXED: The type 'System.Data.Objects.DataClasses.EntityObject' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Entity'
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
</system.web>
@robertgreiner
robertgreiner / Web.config
Created August 20, 2012 21:08
Increase allowed file upload size for IIS 7
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
</system.WebServer>
@robertgreiner
robertgreiner / Web.config
Created August 20, 2012 21:07
Configure maxRequestLength in system.web
<system.web>
<httpRuntime maxRequestLength="1073741824" requestValidationMode="2.0" />
</system.web>
<microsoft.identityModel>
<service>
<audienceUris>
<add value="https://localhost:54012/" />
</audienceUris>
</service>
</microsoft.identityModel>