Skip to content

Instantly share code, notes, and snippets.

View programatt's full-sized avatar
😃
Code is neat.

Matt Phillips programatt

😃
Code is neat.
View GitHub Profile
@programatt
programatt / take_image.py
Created January 28, 2022 05:28
GPhoto2 Python Bulb Exposure Example
#!/usr/bin/env python
import gphoto2 as gp
import os
import sys
from time import time, sleep
EXPOSURE_LENGTH = 10
ISO = '100'
@programatt
programatt / setup.sh
Last active October 21, 2021 00:52
Installing gfshare from source on tiny core linux (Shamir Secret Sharing)
tce-load -wi compiletc git automake autoconf libtool-dev
git clone git://git.gitano.org.uk/libgfshare.git
cd libgfshare
autoreconf —install —verbose
./configure
make
sudo make install
export LD_LIBRARY_PATH=/usr/local/lib
< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo; >> root_ca_pwd.txt
@programatt
programatt / keybase.md
Created November 26, 2020 00:52
keybase.md

Keybase proof

I hereby claim:

  • I am programatt on github.
  • I am mattpsdinc (https://keybase.io/mattpsdinc) on keybase.
  • I have a public key whose fingerprint is AFB1 04B2 34E7 D33D 0947 76CF 3482 5EC0 D451 1884

To claim this, I am signing this object:

@programatt
programatt / inlineauth.cs
Last active March 29, 2017 13:09
inline middleware that does the auth process
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using System;
using System.Net;
public static class BuilderExtensions
{
public static IApplicationBuilder UseSillyAuthentication(this IApplicationBuilder app,Func<HttpContext,bool> authorizeFunc)
{
app.Use(async (context, next) =>
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
.Run(RequestDelegate handler);
.Use(Func<RequestDelegate,RequestDelegate> inlineMiddleware);
.Map(PathString pathMatch,Action<IApplicationBuilder> configurationAction);
.MapWhen(Func<HttpContext,bool> predicate,Action<IApplicationBuilder> configurationAction);
FROM microsoft/dotnet:1.0.0-preview2-sdk
COPY . /dotnetapp
WORKDIR /dotnetapp
RUN dotnet restore -v Verbose
RUN dotnet build
EXPOSE 5000/tcp
CMD ["dotnet","run","--server.urls=http://0.0.0.0:5000"]
/*!
* Bootstrap v3.2
*
* Copyright 2014 Twitter, Inc
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Designed and built with all the love in the world by @mdo and @fat.
* BootSwatchr built and provided by @DrewStrickland
*//*! normalize.css v3.0.1 | MIT License | git.io/normalize */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}h1{font-size:2em;margin:0.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border
@programatt
programatt / setup-linux.sh
Last active August 29, 2015 14:00
Setup clojure on a debian variant of linux
#!/bin/bash
sudo apt-get update
sudo apt-get install openjdk-7-jdk
mkdir temp
cd temp
wget https://raw.github.com/technomancy/leiningen/stable/bin/lein
sudo mv lein /usr/bin/lein
sudo chmod a+x /usr/bin/lein
cd ~
rm -rf temp
@programatt
programatt / function_composition.hs
Created January 22, 2014 02:49
Haskell Function Composition with multiple arguments example
f :: [Bool] -> Bool
f = and
g :: (Eq a) => ([a],[a]) -> [Bool]
g = uncurry $ zipWith (==)
h :: (Eq a) => ([a],[a]) -> Bool
h = f . g
f' :: [Bool] -> Bool