Skip to content

Instantly share code, notes, and snippets.

@singledigit
singledigit / cognito.yaml
Last active April 28, 2024 15:12
Create a Cognito Authentication Backend via CloudFormation
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:
@jpickwell
jpickwell / install-redis.sh
Last active May 19, 2023 06:40 — forked from khelll/install-redis.sh
Installing Redis 5.0.0 on Amazon Linux
#!/bin/bash
###############################################
# To use:
# chmod +x install-redis.sh
# ./install-redis.sh
###############################################
version=5.0.0
@llybin
llybin / user_logout.py
Created May 31, 2018 15:57
Django management command logout user
# -*- 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):
@Sunlighter
Sunlighter / README.md
Last active August 28, 2023 20:35
Installing Python 3.7 in Amazon Linux 2

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.)
@mbilokonsky
mbilokonsky / thinking_like_a_function.md
Last active October 25, 2021 14:47
Thinking Like a Function

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;
 }
@enricop89
enricop89 / cloudformation-role.json
Created September 27, 2019 13:59
Serverless IAM Permission
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"lambda:CreateFunction",
"lambda:ListVersionsByFunction",
"dynamodb:DeleteItem",
@typebrook
typebrook / README.md
Last active April 4, 2024 14:00
A bash script for gist management #bash #gist
# Start SSH Service.
wsl sudo service ssh start
# WSL2 network port forwarding script v1
# for enable script, 'Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser' in Powershell,
# for delete exist rules and ports use 'delete' as parameter, for show ports use 'list' as parameter.
# written by Daehyuk Ahn, Aug-1-2020
# Display all portproxy information
If ($Args[0] -eq "list") {
@p4bl0-
p4bl0- / 00_readme.md
Last active October 12, 2023 09:09
A complete compiler for a simple language (in less than 150 LoC)

This project is a tiny compiler for a very simple language consisting of boolean expression.

The language has two constants: 1 for true and 0 for false, and 4 logic gates: ! (not), & (and), | (or), and ^ (xor).

It can also use parentheses to manage priorities.

Here is its grammar in BNF format:

expr ::= "0" | "1"