Skip to content

Instantly share code, notes, and snippets.

🚀
(⌐■_■)

Ahmad Samiei amad

🚀
(⌐■_■)
  • Talpa Network
  • Netherlands
View GitHub Profile
View equals symmetry is not respected.scala
trait Car {
val doorsNb: Int
override def equals(a: Any) = {
a match {
case c: Car => doorsNb == c.doorsNb
case other => false
}
}
}
View Redis-BestPractices-General.md

Best Practices for Azure Redis

Below are a set of best practices that I recommend for most customers. This information is based on my experience helping hundreds of Azure Redis customers investigate various issues.

Configuration and Concepts

  1. Use Standard or Premium Tier for Production systems. The Basic Tier is a single node system with no data replication and no SLA. Also, use at least a C1 cache. C0 caches are really meant for simple dev/test scenarios since they have a shared CPU core, very little memory, are prone to "noisy neighbor", etc.
  2. Remember that Redis is an In-Memory data store. Read this article so that you are aware of scenarios where data loss can occur.
  3. Configure your client library to use a "connect timeout" of at least 10 to 15 seconds, giving the system time to connect even under higher CPU conditions. If your client or server tend to be under high load
@amad
amad / The_Well-Architected_Framework_Checklist.md
Last active May 20, 2019
AWS Well-Architected Framework Checklist
View The_Well-Architected_Framework_Checklist.md

The Well-Architected Framework Checklist

This is the set of questions presented on The Well-Architected Framework whitepaper designed to evaluate how well your architecture is aligned with AWS best practices.

Security Pillar

Data Protection

  • How are you encrypting and protecting your data at rest?
View compare_reverse.py
import numpy
import perfplot
perfplot.show(
setup=lambda n: numpy.random.randint(0, 1000, n),
kernels=[
lambda a: a[::-1],
lambda a: numpy.ascontiguousarray(a[::-1]),
lambda a: numpy.fliplr([a])[0]
View hackathon1.py
import numpy as np
from scipy.signal import find_peaks
from moviepy.editor import VideoFileClip, concatenate
import matplotlib.pyplot as plt
import sys
import argparse
ap = argparse.ArgumentParser()
ap.add_argument("-v", "--video", help="path to the video file")
args = vars(ap.parse_args())
@amad
amad / tutorial.md
Created Jul 23, 2018 — forked from swalkinshaw/tutorial.md
Designing a GraphQL API
View tutorial.md

Tutorial: Designing a GraphQL API

This tutorial was created by Shopify for internal purposes. We've created a public version of it since we think it's useful to anyone creating a GraphQL API.

It's based on lessons learned from creating and evolving production schemas at Shopify over almost 3 years. The tutorial has evolved and will continue to change in the future so nothing is set in stone.

@amad
amad / docker-cleanup-resources.md
Created May 7, 2018 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks
View docker-cleanup-resources.md

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm
@amad
amad / main.go
Created Jan 7, 2018 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
View main.go
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@amad
amad / elevatorsaga.js
Last active Nov 22, 2017
My basic solution for elevatorsaga.com
View elevatorsaga.js
{
init: function(elevators, floors) {
const lessMoves = false;
var upQueue = [];
var downQueue = [];
moveToFloorNum = (elevator, floorNum, force=false) => {
if (elevator.destinationQueue.includes(floorNum)) {
elevator.goToFloor(floorNum, force);
You can’t perform that action at this time.