Skip to content

Instantly share code, notes, and snippets.

View slogsdon's full-sized avatar

Shane Logsdon slogsdon

View GitHub Profile
View azure-php-webapp-provision.sh
#!/bin/bash
SERVICE_PLAN_NAME="Default1"
SERVICE_PLAN_RESOURCE_GROUP_NAME="Default-Web-EastUS"
SERVICE_PLAN_ID=$(az appservice plan show --name $SERVICE_PLAN_NAME --resource-group $SERVICE_PLAN_RESOURCE_GROUP_NAME --query id --output tsv)
RESOURCE_GROUP_NAME=$(basename `pwd`)
RESOURCE_GROUP_LOCATION=$(az appservice plan show --name $SERVICE_PLAN_NAME --resource-group $SERVICE_PLAN_RESOURCE_GROUP_NAME --query location --output tsv)
APP_NAME="${RESOURCE_GROUP_NAME}-${RANDOM}"
# Create a resource group.
View rpi2-digital-tip-jar.py
# useful imports
from securesubmit.services import HpsServicesConfig
from securesubmit.services.gateway import (
HpsCreditService,
HpsTrackData,
HpsEncryptionData,
HpsException
)
from time import sleep
View Main.hs
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Control.Concurrent (forkIO)
import Control.Monad (forever)
import Data.ByteString.Builder (Builder, hPutBuilder, lazyByteString)
import qualified Data.ByteString.Lazy as BS
import Data.Monoid ((<>))
import GHC.IO.Handle (BufferMode (..), hClose,
hSetBinaryMode, hSetBuffering)
View Main.hs
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Control.Concurrent (forkIO)
import Control.Monad (forever)
-- import qualified Data.ByteString.Char8 as S
import Network.Socket hiding (recv)
import Network.Socket.ByteString (sendAll)
main :: IO ()
View test.exs
# @spec Control.Applicative.apply(Control.Applicative.t, Control.Functor.t) :: Control.Applicative.t
# @spec Control.Monad.bind(Control.Monad.t, (term -> Control.Monad.t)) :: Control.Monad.t
import Data.Maybe
alias Control.Applicative, as: A
import Control.Monad
(&(&1 + 2))
|> just
|> A.apply(just(5))
View Main.hs
{-#LANGUAGE OverloadedStrings #-}
module Main where
import Data.Monoid
import Data.Text (Text, pack)
import Web.Spock.Safe
main :: IO ()
main =
runSpock 3000 $ spockT id $
@slogsdon
slogsdon / ServiceContainer.php
Created July 8, 2015 18:05
Basic dependency injection container for PHP
View ServiceContainer.php
<?php
class ServiceContainer
{
private static $services;
private static $generators;
public function __construct()
{
self::$services = [];
@slogsdon
slogsdon / Dockerfile
Last active September 22, 2023 15:20
Simple Wordpress cluster backed by MySQL and a Redis object cache, all behind HAProxy
View Dockerfile
# Basic setup to copy Wordpress files,
# expected to be at '.', into the image
FROM orchardup/php5
ADD . /code
View Temp.hs
module Temp where
import System.Directory
path :: String
path = "/Users/shane.logsdon/Code/haskell/slogsdon.com/provider/posts/"
files :: IO [FilePath]
files = getDirectoryContents path
View offline_docs.exs
defmodule OfflineDocs do
def parse_dep({dep, constraint}) when constraint |> is_binary, do: parse_dep({dep, constraint, []})
def parse_dep({dep, options}) when options |> is_list, do: parse_dep({dep, "", []})
def parse_dep({dep, _contraint, options}) do
if options[:only] == nil or options[:only] == Mix.env do
[dep: dep]
else
nil
end
end