Skip to content

Instantly share code, notes, and snippets.

View jamiefdhurst's full-sized avatar

Jamie Hurst jamiefdhurst

View GitHub Profile
import * as cdk from 'aws-cdk-lib';
import { Certificate, CertificateValidation } from 'aws-cdk-lib/aws-certificatemanager';
import { Peer, Port, SecurityGroup, Vpc } from 'aws-cdk-lib/aws-ec2';
import { FileSystem, PerformanceMode, ThroughputMode } from 'aws-cdk-lib/aws-efs';
import { ApplicationLoadBalancer } from 'aws-cdk-lib/aws-elasticloadbalancingv2';
import { LambdaTarget } from 'aws-cdk-lib/aws-elasticloadbalancingv2-targets';
import { Effect, PolicyStatement, Role, ServicePrincipal } from 'aws-cdk-lib/aws-iam';
import { Code, Function, FunctionUrlAuthType, FileSystem as LambdaFileSystem, Runtime } from 'aws-cdk-lib/aws-lambda';
import { ARecord, HostedZone, RecordTarget } from 'aws-cdk-lib/aws-route53';
import { LoadBalancerTarget } from 'aws-cdk-lib/aws-route53-targets';
@jamiefdhurst
jamiefdhurst / dynamodb.go
Last active July 7, 2024 19:42
Updated dynamodb client to use query and sort key effectively.
package main
import (
"context"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue"
"github.com/aws/aws-sdk-go-v2/service/dynamodb"
@jamiefdhurst
jamiefdhurst / gist:3951786
Created October 25, 2012 10:06
PHP Gripe of the Day...
// This should not require two lines...
$class = $this->_get_row_object($row);
$row = new $class;
// Surely this should work? But no...
$class = new {$this->_get_row_object($row)};
@jamiefdhurst
jamiefdhurst / page_parent.php
Created August 13, 2012 13:10
Get parent title in PyroCMS
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class Plugin_Page_Parent extends Plugin
{
public function title()
{
// Use the URI to get the previous page name, and set the title accordingly
$uri_parts = explode('/', $this->uri->uri_string());
@jamiefdhurst
jamiefdhurst / gist:3275287
Created August 6, 2012 15:11
PyroCMS Docs #1
An important note here is that you cannot extend helpers or libraries found in the system/ directory (neither system/cms or system/codeigniter) as the CodeIgniter Loader class does not know to look there. This is a "limitation" of CodeIgniter itself, so if you need to extend core files you will need to either extend in system/cms or extend there. If you do this make sure you are tracking your changes with Git as otherwise you will end up loosing your modifcations next time you upgrade PyroCMS.
@jamiefdhurst
jamiefdhurst / isbns.rb
Created July 26, 2012 12:57
This is me learning "Ruby"...
#!/usr/bin/env ruby
def is_valid_isbn13?(isbn13)
sum = 0
13.times { |i| sum += i % 2 == 0 ? isbn13[i].to_i : isbn13[i].to_i * 3 }
0 == sum % 10
end
puts "Loading file and reading ISBNs..."
isbns = []
@jamiefdhurst
jamiefdhurst / gist:1688545
Created January 27, 2012 12:27
Simple random backgrounds
<?php
$randomBackgrounds = array(
'FF0000',
'CC0000',
'0000FF',
'url(test.png)',
// more colours or images
);
?>
<style type="text/css">
@jamiefdhurst
jamiefdhurst / error-func.php
Created January 23, 2012 14:30
Awesome error function
function errorpage($message, $cuscon = false, $goBack = true, $exit = true) {
if (!$cuscon) {
echo "
<table width=\"100%\">
<tr>
<td>
<table width=\"100%\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td align=\"center\">
@jamiefdhurst
jamiefdhurst / gist:1506303
Created December 21, 2011 14:53
ucwords() replacement (from when i was daft)
function caps($str) {
$split = explode(' ', $str);
for($i = 0; $i < count($split); $i++) {
$split[$i] = ucfirst(strtolower($split[$i]));
}
$str = implode(' ', $split);
return $str;
}
@jamiefdhurst
jamiefdhurst / mercurial-compile
Created July 8, 2011 09:39
Compilation of Mercurial on Debian
jamie@projectx-server:~$ mkdir mercurial-test
jamie@projectx-server:~$ cd mercurial-test/
jamie@projectx-server:~/mercurial-test$ wget http://mercurial.selenic.com/release/mercurial-1.9.tar.gz
--2011-07-08 10:34:39-- http://mercurial.selenic.com/release/mercurial-1.9.tar.gz
Resolving mercurial.selenic.com... 173.11.57.243
Connecting to mercurial.selenic.com|173.11.57.243|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2964382 (2.8M) [application/x-gzip]
Saving to: `mercurial-1.9.tar.gz'