Skip to content

Instantly share code, notes, and snippets.

View enryold's full-sized avatar

Enrico Vecchio enryold

  • AudienceRate
  • Milan, IT
View GitHub Profile
@faermanj
faermanj / README.md
Last active March 19, 2023 13:39
API Authentication with Amazon Cognito

In the previous episodes we implemented the fundamental components of a tyical web application: "static" content and "dynamic" APIs. For each component, we´ve been using the most out of AWS services, such as S3, CloudFront, Lambda and API gateway. But so far we have only been working with public resources. Let us now learn more about user authentication and authorization in two very important services: AWS Identity and Access Management and Amazon Cognito. Even more importantly, let us integrate that within our React application ;)

  • Serverless Architecture Review
  • Introduction to Amazon Cognito
  • Cognito User Pools
  • Cognito Federated Identities
  • Cognito Identity SDK
  • AWS SDKs
  • Integrating with Javascript and React
  • Implementing Authentication Flows
@henrrich
henrrich / ChangeAnnotationAtRuntime.java
Last active August 24, 2022 09:05
Modify annotation at runtime, java 8 support
public final class RuntimeAnnotations {
private static final Constructor<?> AnnotationInvocationHandler_constructor;
private static final Constructor<?> AnnotationData_constructor;
private static final Method Class_annotationData;
private static final Field Class_classRedefinedCount;
private static final Field AnnotationData_annotations;
private static final Field AnnotationData_declaredAnotations;
private static final Method Atomic_casAnnotationData;
private static final Class<?> Atomic_class;
@valyala
valyala / README.md
Last active April 19, 2024 13:00
Optimizing postgresql table for more than 100K inserts per second

Optimizing postgresql table for more than 100K inserts per second

  • Create UNLOGGED table. This reduces the amount of data written to persistent storage by up to 2x.
  • Set WITH (autovacuum_enabled=false) on the table. This saves CPU time and IO bandwidth on useless vacuuming of the table (since we never DELETE or UPDATE the table).
  • Insert rows with COPY FROM STDIN. This is the fastest possible approach to insert rows into table.
  • Minimize the number of indexes in the table, since they slow down inserts. Usually an index on time timestamp with time zone is enough.
  • Add synchronous_commit = off to postgresql.conf.
  • Use table inheritance for fast removal of old data:
@maxrabin
maxrabin / CountLinesAndLetters.js
Created March 13, 2016 12:09
Example Lambda Function to process lines of text files when uploaded to S3
'use strict';
var AWS = require('aws-sdk');
var S3 = new AWS.S3();
var readline = require('readline');
exports.handler = function (event, context) {
//Get S3 file bucket and name
//Make sure to loop through event.Records, don't assume there is only 1 in production!!!
var bucket = event.Records[0].s3.bucket.name;
var key = event.Records[0].s3.object.key;
@hollodotme
hollodotme / Install-php7.md
Last active August 11, 2022 06:23
Installing php7-fpm with phpredis and xdebug extension on Ubuntu 14.04

Install php7.0-fpm

# remove php5 modules
apt-get autoremove --purge php5-*
# add php-7.0 source list by [Ondřej Surý](https://github.com/oerdnj)
add-apt-repository ppa:ondrej/php
# Update index
apt-get update
# Install php7.0-fpm with needed extensions
@snaga
snaga / gist:7495184
Created November 16, 2013 02:35
postgresql.conf @ RDS for PostgreSQL
testdb=> SELECT name,setting,unit FROM pg_settings;
name | setting | unit
---------------------------------+---------------------------------------------+------
allow_system_table_mods | off |
application_name | psql |
archive_command | /etc/rds/dbbin/pgscripts/rds_wal_archive %p |
archive_mode | on |
archive_timeout | 300 | s
array_nulls | on |
authentication_timeout | 60 | s
@jakebellacera
jakebellacera / ICS.php
Last active April 19, 2024 09:06
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
<?php
/**
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*