Skip to content

Instantly share code, notes, and snippets.

Paul Knopf pauldotknopf

Block or report user

Report or block pauldotknopf

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pauldotknopf
pauldotknopf / functions.sh
Created Apr 12, 2019
Helps commands for converting between decimal/binary/hex formats.
View functions.sh
function dec-to-hex() {
echo "ibase=10;obase=16;$1" | bc
}
function dec-to-bin() {
echo "ibase=10;obase=2;$1" | bc
}
function hex-to-dec() {
echo "ibase=16;obase=A;$1" | bc
View huginn-database-schema-dump.txt
-- MySQL dump 10.13 Distrib 5.5.62, for debian-linux-gnu (x86_64)
--
-- Host: localhost Database: huginn_production
-- ------------------------------------------------------
-- Server version 5.5.62-0ubuntu0.14.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
@pauldotknopf
pauldotknopf / Example.cs
Last active Dec 21, 2018
Shared connections/transactions with AsyncLocal.
View Example.cs
public async Task<Case> StartCase(int caseId, int userId)
{
using (var connection = new ConScope(_dataService))
using (var transaction = new TransScope())
{
// A transaction is used inside of the settings service as well.
// It uses the same "ConScope" and "TransScope" types internally,
// allowing us to share a single IDbConnection and IDbTransaction.
var caseContext = await _settingsService.GetSetting<CaseContext>();
if (caseContext.CurrentCaseId == caseId)
@pauldotknopf
pauldotknopf / HomeController.cs
Last active May 13, 2018
Render .NET Core ASP.NET MVC ViewComponent to string from controller
View HomeController.cs
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>(),
@pauldotknopf
pauldotknopf / makepkg.patch
Last active Jun 9, 2018
makepkg patch to run as root
View makepkg.patch
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
View docker-image-store.go
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 / arch-install
Last active Jan 28, 2018
My script to install Arch on my machines.
View arch-install
#!/bin/bash
set -e
parted -s /dev/sda \
mklabel gpt \
mkpart primary 1MiB 2GiB \
mkpart primary 2GiB 40GiB \
mkfs.fat /dev/sda1
View gist:aa2ea7be346cd072097dcaed94b30253
### 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 / gist:63a6b93bf84773bd99ac
Created Mar 25, 2015
Can't create a managed bootstrap installer
View gist:63a6b93bf84773bd99ac

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.");
@pauldotknopf
pauldotknopf / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
You can’t perform that action at this time.