Skip to content

Instantly share code, notes, and snippets.

View amir734jj's full-sized avatar
:shipit:
Working from home

Seyedamirhossein Hesamian amir734jj

:shipit:
Working from home
  • Microsoft, Redmond
  • United States
  • 04:31 (UTC -06:00)
  • LinkedIn in/hesamian
View GitHub Profile
@Xrayez
Xrayez / BreadthFirstIterator.java
Created February 8, 2022 13:35 — forked from deyindra/BreadthFirstIterator
BFS and DFS Iterator for Graph
import java.util.*;
public class BreadthFirstIterator<T> implements Iterator<T> {
private Set<T> visited = new HashSet<>();
private Queue<T> queue = new LinkedList<>();
private Graph<T> graph;
public BreadthFirstIterator(Graph<T> g, T startingVertex) {
if(g.isVertexExist(startingVertex)) {
this.graph = g;
@andfaulkner
andfaulkner / AngleBetween3PointsIn3DSpace.js
Last active November 3, 2023 15:26
Get the angle between 3 coordinates (x, y, z) in 3D space
/**
* Calculate angle between 3 points in 3D space.
* Note: assumes we want 1 vector to run from coord1 -> coord2, and the other
* from coord3 -> coord2.
*
* @param {x: number; y: number; z: number} coord1 1st (3D) coordinate
* @param {x: number; y: number; z: number} coord2 2nd (3D) coordinate
* @param {x: number; y: number; z: number} coord3 3rd (3D) coordinate
*
* @return {number} Angle between the 3 points
@sadrakgunadi
sadrakgunadi / RSAKeyPairGeneratorWithBouncyCastle.md
Last active March 25, 2023 20:12
Generate RSA Key Pair with BouncyCastle

Generate RSA Key Pair with BouncyCastle

Source : BouncyCastle

Code

RsaKeyPairGenerator g = new RsaKeyPairGenerator();
@anil477
anil477 / TransitiveClosure.java
Created July 25, 2017 04:52
Transitive Closure of a Graph using DFS
// Given a directed graph, find out if a vertex v is reachable from another vertex u for all vertex pairs (u, v) in the given graph.
import java.util.LinkedList;
class Graph
{
int V; // No. of vertices
boolean [][]tc; // To store transitive closure
LinkedList<Integer> adj[]; // array of adjacency lists
public Graph(int V)
@bricker
bricker / amznymous.md
Last active April 23, 2024 11:14
An Amazon Programmer's Perspective (http://pastebin.com/BjD84BQ3)

Originally posted at http://pastebin.com/BjD84BQ3

Trigger warning: mention of suicidal ideation

tl;dr: I burned out as a developer at Amazon at the end of my second year. I’ve since found a healthy and sustainable work-life balance and enjoy work again. I write this to A) raise awareness, especially for new-hires and their families, and B) help give hope and advice to people going through the same at Amazon or other companies.

Hello, world

There’s been no shortage of anecdotes, opinions, and rebuttals regarding Amazon’s corporate culture as of late. I write this not to capitalize on the latest news-feed fad, but to share what I had already written and promptly deleted. I didn’t think anyone would want to hear my story, but it’s apparent people are going through a similar experience and don’t have a voice.

I’m a Software Development Engineer II at Amazon; SDE II basically means a software developer with at least 2–3 years of industry experience. I started at Amazon as an SDE I.

@dcastro
dcastro / gist:9093000
Created February 19, 2014 14:17
Build an Expression that instantiates an Anonymous Type
public void CreateExpression()
{
Type argType = typeof (MyClass);
string propertyName = "Name";
ParameterExpression paramExpression = Expression.Parameter(argType, "item");
//Create "item.Name" and "item.GetType()" expressions
var propertyAccessExpression = Expression.Property(paramExpression, propertyName);
var getTypeExpression = Expression.Call(paramExpression, "GetType", Type.EmptyTypes);
@retronym
retronym / lub2.scala
Created March 23, 2010 18:05
Calculate the Least Upper Bound of two types.
object test {
case class L[A, B]() {
def ToLub[AA >: A <: L, BB >: B <: L, L] = new { type LUB = L }
}
val intBoolLub = L[Int, Boolean].ToLub
(1: AnyVal) : intBoolLub.LUB
1: intBoolLub.LUB