Skip to content

Instantly share code, notes, and snippets.

View pauldotknopf's full-sized avatar

Paul Knopf pauldotknopf

View GitHub Profile
@pauldotknopf
pauldotknopf / gist:4049602
Created November 10, 2012 02:31
Unit testing with mongodb
class Program
{
static void Main(string[] args)
{
using(new MongoScope("9999"))
{
const string connectionString = "mongodb://localhost:9999/?safe=true";
var server = MongoServer.Create(connectionString);
var blog = server.GetDatabase("blog");
var posts = blog.GetCollection<Post>("posts");
@pauldotknopf
pauldotknopf / gist:8830358
Created February 5, 2014 18:44
FFMpegHelper.h
#pragma once
extern "C"
{
#ifndef __STDC_CONSTANT_MACROS
#define __STDC_CONSTANT_MACROS
#endif
#include <libavcodec\avcodec.h>
#include <libavformat\avformat.h>
}
@pauldotknopf
pauldotknopf / gist:8830397
Created February 5, 2014 18:46
FFMpegHelper.cpp
#include "stdafx.h"
#include "FFMpegHelper.h"
#include "get_extradata.h"
#include <iostream>
FFMpegHelper::FFMpegHelper(void)
{
}
FFMpegHelper::~FFMpegHelper(void)
@pauldotknopf
pauldotknopf / 0_reuse_code.js
Last active August 29, 2015 14:09
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@pauldotknopf
pauldotknopf / gist:63a6b93bf84773bd99ac
Created March 25, 2015 08:10
Can't create a managed bootstrap installer

This is with version 3.9r2 (latest version)

I am having trouble creating a managed bootstrap installer. I followed the instructions I could find, and even referenced how you guys did it in your official wix installer exe.

The quick and dirty exception is coming from "src\ext\BalExtension\mba\host\host.cpp" on line 510.

hr = pAppFactory->Create(pEngine, pCommand, ppApplication);
ExitOnFailure(hr, "Failed to create the bootstrapper application.");
### Keybase proof
I hereby claim:
* I am pauldotknopf on github.
* I am pauldotknopf (https://keybase.io/pauldotknopf) on keybase.
* I have a public key ASA_G--R5V-ybNvbkNnNLpJgzLMAfGaB4qfQkSPL8P18rgo
To claim this, I am signing this object:
@pauldotknopf
pauldotknopf / arch-install
Last active January 28, 2018 20:30
My script to install Arch on my machines.
#!/bin/bash
set -e
parted -s /dev/sda \
mklabel gpt \
mkpart primary 1MiB 2GiB \
mkpart primary 2GiB 40GiB \
mkfs.fat /dev/sda1
package main
import (
"fmt"
"path/filepath"
"runtime"
"github.com/docker/distribution/reference"
"github.com/docker/docker/api/types"
_ "github.com/docker/docker/daemon/graphdriver/register"
@pauldotknopf
pauldotknopf / makepkg.patch
Last active July 27, 2020 04:45
makepkg patch to run as root
diff --git a/makepkg-original b/makepkg
index 2fe769a..ec4963c 100755
--- a/makepkg-original
+++ b/makepkg
@@ -225,13 +225,6 @@ run_pacman() {
else
cmd=("$PACMAN_PATH" "$@")
fi
- if [[ $1 != -@(T|Q)*([[:alpha:]]) ]]; then
- if type -p sudo >/dev/null; then
@pauldotknopf
pauldotknopf / HomeController.cs
Last active October 21, 2022 12:23
Render .NET Core ASP.NET MVC ViewComponent to string from controller
public class HomeController : Controller
{
public async Task<string> RenderViewComponent(string viewComponent, object args)
{
var sp = HttpContext.RequestServices;
var helper = new DefaultViewComponentHelper(
sp.GetRequiredService<IViewComponentDescriptorCollectionProvider>(),
HtmlEncoder.Default,
sp.GetRequiredService<IViewComponentSelector>(),