Skip to content

Instantly share code, notes, and snippets.

@awachat
awachat / linkedin-v2-oauth2.py
Last active August 12, 2021 19:17
Linkedin client to get firstName, lastName, profilePicture, emailAddress from OAuth2.0 access token using Linkedin 2.0 APIs
class LinkedinClient(object):
"""
Usage:
client = LinkedinClient(access_token)
user_details = client.get_user_details()
"""
FIELD_SELECTORS = ['id', 'firstName', 'lastName',
'profilePicture(displayImage~:playableStreams)',
'emailAddress']
@lizrice
lizrice / vpc-fargate.yaml
Created January 23, 2018 18:01
Cloudformation template for setting up VPC and subnets for Fargate
# Usage:
# aws cloudformation --region <region> create-stack --stack-name <stack name> --template-body file://vpc-fargate.yaml
# This template will:
# Create a VPC with:
# 2 Public Subnets
# 2 Private Subnets
# An Internet Gateway (with routes to it for Public Subnets)
# A NAT Gateway for outbound access (with routes from Private Subnets set to use it)
#
@taisyo7333
taisyo7333 / ruby_on_rails5.md
Last active March 12, 2018 16:37
ruby on rails5 はまったこと

現象

# bundle exec rails c
Could not find rake-12.3.0 in any of the sources
Run `bundle install` to install missing gems.

解決

# bundle install --binstubs
@fstab
fstab / prometheus-workshop.md
Last active October 5, 2021 14:24
Prometheus Workshop Notes

These are notes for my Prometheus workshop. The follow-up workshop on Prometheus/Kubernetes can be found here.

Overview

  • Technology: Time Series Database
  • Approach: Black Box vs White Box
  • Scope: Time Series (Prometheus) vs. Logfiles (ELK), vs. Tracing (Zipkin)

node_exporter

@duluca
duluca / awc-ecs-access-to-aws-efs.md
Last active October 11, 2024 16:44
Step-by-step Instructions to Setup an AWS ECS Cluster

Configuring AWS ECS to have access to AWS EFS

If you would like to persist data from your ECS containers, i.e. hosting databases like MySQL or MongoDB with Docker, you need to ensure that you can mount the data directory of the database in the container to volume that's not going to dissappear when your container or worse yet, the EC2 instance that hosts your containers, is restarted or scaled up or down for any reason.

Don't know how to create your own AWS ECS Cluster? Go here!

New Cluster

Sadly the EC2 provisioning process doesn't allow you to configure EFS during the initial config. After your create your cluster, follow the guide below.

New Task Definition for Web App

If you're using an Alpine-based Node server like duluca/minimal-node-web-server follow this guide:

@pgolding
pgolding / cosine_similarity.py
Created May 27, 2017 20:26
Cosine Similarity Python Scikit Learn
# http://scikit-learn.org/stable/modules/generated/sklearn.metrics.pairwise.cosine_similarity.html
import numpy as np
from sklearn.metrics.pairwise import cosine_similarity
# The usual creation of arrays produces wrong format (as cosine_similarity works on matrices)
x = np.array([2,3,1,0])
y = np.array([2,3,0,0])
# Need to reshape these
x = x.reshape(1,-1)
digraph architecture {
rankdir=LR;
// Storage - #303F9F (dark blue)
node[fillcolor="#303F9F" style="filled" fontcolor="white"];
database[label="DB"]; cache[label="Redis"];
// Client-side Apps - #FFEB3B (yellow)
node[fillcolor="#FFEB3B" style="filled" fontcolor="black"];
front_end[label="Front-end App"]; extension[label="Browser Extension"];
@paladini
paladini / aws-ec2-redis-cli.md
Last active October 24, 2024 16:44 — forked from todgru/aws-ec2-redis-cli.md
AWS redis-cli without redis server on AWS EC2

Setup redis-cli without the whole Redis Server on AWS EC2

This fast tutorial will teach you how to install redis-clion AWS EC2 without having to install the whole Redis Server. Firstly, SSH into your EC2 instance and run the following command:

$ sudo yum install gcc

This may return an "already installed" message, but that's OK. After that, just run:

$ wget http://download.redis.io/redis-stable.tar.gz && tar xvzf redis-stable.tar.gz && cd redis-stable && make && sudo cp src/redis-cli /usr/local/bin/ && sudo chmod 755 /usr/local/bin/redis-cli

@SemVerTsar
SemVerTsar / upgrade-postgres-9.3-to-9.4.md
Last active January 10, 2019 16:39 — forked from dideler/upgrade-postgres-9.3-to-9.4.md
Upgrading PostgreSQL from 9.3 to 9.4

First, check the version of Ubuntu:

lsb_release -sc

You need to add the latest PostgreSQL repository for the latest version, otherwise It will install PostgreSQL 9.3. This is for trusty version.

sudo add-apt-repository "deb https://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main"

Update and Install PostgreSQL 9.4:

@d2s
d2s / install-go-to-with-bash-script.md
Last active July 8, 2024 18:13
Installing Go with command line

NOTE: This is heavily outdated Gist snippet from 2017.


Install Go language with a Bash script

Another alternative to installing Go is to use a simple Bash script. It will download and install Go language under of your own user account.

Note that a system-wide installation might be better for some things