Skip to content

Instantly share code, notes, and snippets.

View JoeAlamo's full-sized avatar

Joe Alamo JoeAlamo

  • One Utility Bill
  • Newcastle, United Kingdom
View GitHub Profile
@damonmaria
damonmaria / cognitoAwsCredentials.js
Last active May 31, 2021 10:13
Keeping Cognito user pool and AWS tokens refreshed in browser, symptoms if you need this is the error: "Invalid login token. Token expired: 1446742058 >= 1446727732"
import AWS from 'aws-sdk/global'
import eventEmitter from 'event-emitter'
import differenceInMilliseconds from 'date-fns/difference_in_milliseconds'
import minDate from 'date-fns/min'
// Set this to match your setup
const env = {
awsRegion: XXXX,
identityPoolId: XXXX,
userPoolId: XXXX,
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>Subscriptions - freek@spatie.be</title>
</head>
<body>
<outline text="PHP" title="PHP">
<outline htmlUrl="http://frederickvanbrabant.com" title="frederickvanbrabant.com" xmlUrl="http://frederickvanbrabant.com/feed.xml" type="rss" text="frederickvanbrabant.com"/>
<outline htmlUrl="http://mattallan.org" title="mattallan.org" xmlUrl="http://mattallan.org/feed.xml" type="rss" text="mattallan.org"/>
<outline title="asked.io" xmlUrl="https://asked.io/rss" type="rss" text="asked.io"/>

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@jlevy
jlevy / SecConfig.py
Last active April 29, 2024 18:42
SecConfig.py from AWS Re-Invent 2013 (export AWS security configurations)
#! /usr/bin/python
# This script is taken (unmodified except for this comment) from: https://s3.amazonaws.com/reinvent2013-sec402/SecConfig.py
# Talk: http://www.slideshare.net/AmazonWebServices/intrusion-detection-in-the-cloud-sec402-aws-reinvent-2013
# Example code to output account security config
__author__ = 'Greg Roth'
import boto
import urllib
@paragonie-scott
paragonie-scott / crypto-wrong-answers.md
Last active April 21, 2024 23:48
An Open Letter to Developers Everywhere (About Cryptography)
@jlem
jlem / ApplicationsServiceProvider.php
Created August 21, 2015 14:35
Laravel 5 App Skeleton
<?php namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Request;
use View;
use App;
abstract class ApplicationsServiceProvider extends ServiceProvider
{
public function register()
@jlem
jlem / Clan.php
Created August 20, 2015 06:40
Model usage
<?php namespace GR\Clan;
use Illuminate\Database\Eloquent\Model;
use GR\Section\SectionInterface;
use GR\Member\MemberInterface;
use GR\Lib\ModelCache;
use GR\Member\Member;
class Clan extends Model implements ClanInterface
{
@jlem
jlem / ShouldBeValidated.php
Last active November 23, 2016 19:00
Sloppy Validation Wrapper
<?php
// Assign this to models and implement these methods
interface ShouldBeValidated
{
/**
* Returns an array of key => value rules (as per normal Laravel validation)
*
* @return array
@Zearin
Zearin / python_decorator_guide.md
Last active July 18, 2024 00:10
The best explanation of Python decorators I’ve ever seen. (An archived answer from StackOverflow.)

NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.


Q: How can I make a chain of function decorators in Python?


If you are not into long explanations, see [Paolo Bergantino’s answer][2].

@telent
telent / gist:9742059
Last active May 8, 2024 11:36
12 factor app configuration vs leaking environment variables
App configuration in environment variables: for and against
For (some of these as per the 12 factor principles)
1) they are are easy to change between deploys without changing any code
2) unlike config files, there is little chance of them being checked
into the code repo accidentally
3) unlike custom config files, or other config mechanisms such as Java