Skip to content

Instantly share code, notes, and snippets.

@bhameyie
bhameyie / ebs.config
Created January 29, 2014 16:51
Sample ebs config to deploy scalatra app to Elastic Beanstalk
aws:
access_key: 'myKey'
secret_key: 'mySecretKey+TjnS'
region: 'us-east-1'
bucket: 'myBucket'
bucket_path: 'myPath'
app:
versions_to_keep: 10
app_name: 'myAppName'
@bhameyie
bhameyie / gist:8411519
Created January 14, 2014 01:31
Fix for Git error: RPC failed; result=22, HTTP code = 411
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = false
[remote "origin"]
url = https://[email protected]/iamnotyou/le-large-projet.git
@bhameyie
bhameyie / Build.scala
Last active January 12, 2018 14:45
Casbah tutorial (sort of)
// Add salat and casbah to your build.scala or build.sbt files.
object ElBuild extends Build {
val Organization = "your own"
val Version = "0.0.1-SNAPSHOT"
val ScalaVersion = "2.10.3"
val ScalatraVersion = "2.2.1"
resolvers += "Maven Central Server" at "http://repo1.maven.org/maven2"
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Reflection;
using System.Text;
using Common;
using Funq;
using ServiceStack.ServiceHost;
using ServiceStack.ServiceInterface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using ServiceStack.ServiceHost;
namespace Common
{
public interface IComposobaleBootstrapper
@bhameyie
bhameyie / ModuleExtensions.cs
Last active April 16, 2020 05:05
An extension to render view as string with NancyFx
using System.IO;
using Nancy;
using Nancy.ViewEngines;
namespace Web.Modules
{
public static class ModuleExtensions
{
public static string RenderRazorViewToString(this NancyModule module, string viewName, object model)
{
@bhameyie
bhameyie / AppHost.cs
Last active December 21, 2015 05:38
Composable Services using Service Stack
using System;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.IO;
using System.Linq;
using System.Configuration;
using System.Collections.Generic;
using System.Web.Mvc;
using Common;
using ServiceStack.Mvc;
@bhameyie
bhameyie / Restorinator.cs
Last active December 19, 2015 19:48
Restore database from backup with Sql Server
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using Microsoft.SqlServer.Management.Common;
using Microsoft.SqlServer.Management.Smo;
public class Restorinator{
@bhameyie
bhameyie / AwsExtensions.cs
Last active December 18, 2015 21:19
File Upload with Url retrieval using AWS S3
public static class AwsExtensions
{
public static string Upload(this AmazonS3 client,UploadImageRequest request)
{
var uploadRequest = new PutObjectRequest { InputStream = request.Image };
uploadRequest.WithBucketName(request.Bucket).WithKey(request.FileIdentifier);
var response = client.PutObject(uploadRequest);
@bhameyie
bhameyie / Multithread.cs
Last active December 18, 2015 16:59
Simple example on how to spawn and wait for a new thread
var resetEvent = new ManualResetEvent(false);
ThreadPool.QueueUserWorkItem(
arg =>
{
var task = new MyTaskRunner();
task.Run(data);
resetEvent.Set();
});