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 / 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
// 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;
@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) =>
.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"]
@programatt
programatt / rps.hs
Created January 8, 2014 05:10
rock paper scissors in haskell using StateT
import System.Random
import Control.Monad.State
data Hand = Rock | Scissors | Paper deriving(Show,Eq)
data Result = Win | Lose | Tie deriving(Show)
type Score = (Int,Int)
fight :: Hand -> Hand -> Result
fight h1 h2 | h1 == h2 = Tie
| h1 == Rock && h2 == Scissors = Win
;
; boot.s -- Kernel start location. Also defines multiboot header.
; Based on Bran's kernel development tutorial file start.asm
;
MBOOT_PAGE_ALIGN equ 1<<0 ; Load kernel and modules on a page boundary
MBOOT_MEM_INFO equ 1<<1 ; Provide your kernel with memory info
MBOOT_HEADER_MAGIC equ 0x1BADB002 ; Multiboot Magic value
; NOTE: We do not use MBOOT_AOUT_KLUDGE. It means that GRUB does not
; pass us a symbol table.