Skip to content

Instantly share code, notes, and snippets.

@typebrook
typebrook / README.md
Last active May 7, 2021
A bash script for gist management #bash #gist
View README.md
@enricop89
enricop89 / cloudformation-role.json
Created Sep 27, 2019
Serverless IAM Permission
View cloudformation-role.json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"lambda:CreateFunction",
"lambda:ListVersionsByFunction",
"dynamodb:DeleteItem",
@mbilokonsky
mbilokonsky / thinking_like_a_function.md
Last active Oct 26, 2020
Thinking Like a Function
View thinking_like_a_function.md

Thinking Like a Function

Part 1: What's a function?

As a software engineer, you probably think of a function as a unit of code that takes some arguments and returns some value, eg:

 function square(x) { 
   return x * x;
 }
@Sunlighter
Sunlighter / README.md
Last active May 13, 2021
Installing Python 3.7 in Amazon Linux 2
View README.md

Installing Python 3.7 in Amazon Linux 2

This is a way to build Python 3.7 from source and temporarily install it in Amazon Linux 2 without overwriting the system Python and without interfering with the Python in amazon-linux-extras.

At the time of this writing, Amazon Linux 2 offers Python 2.7.14 and (through the extras) Python 3.6.2, but Python 3.7.0 was just released.

  1. Start Amazon Linux 2 and sign in. (I recommend a c5.large instance.)
@llybin
llybin / user_logout.py
Created May 31, 2018
Django management command logout user
View user_logout.py
# -*- coding: utf-8 -*-
from django.core.management import BaseCommand
from django.contrib.auth.models import User
from django.contrib.sessions.models import Session
from django.db.models import Q
from rest_framework.authtoken.models import Token
class Command(BaseCommand):
@jpickwell
jpickwell / install-redis.sh
Last active May 6, 2021 — forked from khelll/install-redis.sh
Installing Redis 5.0.0 on Amazon Linux
View install-redis.sh
#!/bin/bash
###############################################
# To use:
# chmod +x install-redis.sh
# ./install-redis.sh
###############################################
version=5.0.0
@singledigit
singledigit / cognito.yaml
Last active Apr 25, 2021
Create a Cognito Authentication Backend via CloudFormation
View cognito.yaml
AWSTemplateFormatVersion: '2010-09-09'
Description: Cognito Stack
Parameters:
AuthName:
Type: String
Description: Unique Auth Name for Cognito Resources
Resources:
# Creates a role that allows Cognito to send SNS messages
SNSRole:
@outofcoffee
outofcoffee / gradle-kotlin-publish-s3-maven-repo.gradle
Last active Mar 4, 2019
Publish a Kotlin module to an S3 Maven repository, using Gradle.
View gradle-kotlin-publish-s3-maven-repo.gradle
/*
* Publish a Kotlin module to an S3 Maven repository, using Gradle.
* This assumes that the AWS/IAM credentials have 'bucket list' as well as 'object put' and 'object get' permissions.
*/
ext.version_kotlin = '1.0.5-2'
buildscript {
repositories {
mavenCentral()
@ugiacoman
ugiacoman / Client-Loading-Example.md
Last active Jan 6, 2021
SSR + CSR using next.js
View Client-Loading-Example.md

Whether your component relies on client-side features or you are using 3rd party components that are not designed for server-side rendering, sometimes you'll want to defer rendering until on the client. For our example, we'll be using react-chart-2 to load a Doughnut chart.

Doughnut

You'll need a next project and to install chart.js + react-chartjs-2.

$ npm install --save chart.js react-chartjs-2