Skip to content

Instantly share code, notes, and snippets.

View louisthomas's full-sized avatar

ltlamontagne louisthomas

  • Montreal
View GitHub Profile
@chitchcock
chitchcock / 20111011_SteveYeggeGooglePlatformRant.md
Created October 12, 2011 15:53
Stevey's Google Platforms Rant

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

@chaslemley
chaslemley / dynamoDB_example.rb
Created January 23, 2012 15:17
Example of using Amazon's DynamoDB to store user activity
require "aws-sdk"
class Dynamo
attr_accessor :attributes
def initialize(hash)
raise ArgumentError, "argument passed to .new must be a Hash" unless hash.is_a? Hash
raise ArgumentError, "hash must contain key :#{self.class.hash_key}" unless hash.has_key? self.class.hash_key.to_sym
raise ArgumentError, "hash must contain key :#{self.class.range_key}" unless self.class.has_range_key? && hash.has_key?(self.class.range_key.to_sym)
@attributes = {}
@jboner
jboner / latency.txt
Last active June 25, 2024 12:58
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@zhannes
zhannes / gist:3207394
Created July 30, 2012 14:33
Git rebase workflow
# first, fetch the latest refs for all branches. And be sure we have latest master, etc
git checkout master
git fetch
# If any changes from remote, catch our local version up
git rebase origin/master
# could also be done as
@jagwire
jagwire / java-singleton
Created May 7, 2013 13:24
Java singleton pattern
public enum Singleton {
INSTANCE;
private Singleton() { }
}
@regis-leray
regis-leray / release-git-script
Last active March 25, 2023 20:50
Release script using git and maven release plugin. Based on the "successful git branch model" and https://gist.github.com/searls/1043970 Its also managed the hotfix feature
#!/bin/bash
# How to perform a release with git & maven following the git flow conventions
# ----------------------------------------------------------------------------
# Finding the next version: you can see the next version by looking at the
# version element in "pom.xml" and lopping off "-SNAPSHOT". To illustrate,
# if the pom's version read "0.0.2-SNAPSHOT", the following instructions would
# perform the release for version "0.0.2" and increment the development version
# of each project to "0.0.3-SNAPSHOT".
#
@jasonrudolph
jasonrudolph / 00-about-search-api-examples.md
Last active April 30, 2024 19:21
5 entertaining things you can find with the GitHub Search API
@karanth
karanth / distsys-fun.md
Created January 13, 2014 16:21
Notes on "Distributed Systems for Fun and Profit" - Mikito Takada

A free book on Distributed Systems available at http://book.mixu.net/distsys/index.html

Chapter 1: Covers the basics of Distributed systems including the need for such systems and the definitions of terms that describe such systems. Terms such as Scalability, Fault Tolerance, Replication, Latency, Performance and Partitioning are defined in this chapter. In my mind, the first reason for using Replication in any system was to provide redundancy against data loss. This chapter sheds light on another subtle reason, caching. We replicate for performance by putting disk data in memory, memory data in the processor cache etc. For lower latency, we replicate data in different geographies using CDNs.

@BorzdeG
BorzdeG / Spring.Java8.toGrantedAuthorities
Last active August 19, 2017 06:35
example Java 8 Streams
import org.springframework.security.core.GrantedAuthority;
import org.springframework.util.StringUtils;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import java.util.stream.Collectors;
/**
* Строки в роли для Spring Security. В каждой строке может быть несколько ролей через запятую
* Результат: набор ролей, консолидированный из переданных roles
*/
public static Set<GrantedAuthority> toGrantedAuthoritiesDemo(final String[] roles) {
@tomasmalmsten
tomasmalmsten / StringMatchesUUIDPattern
Created December 10, 2014 15:15
A hamcrest matcher verifying that a string matches the pattern of a UUID
package com.tomasmalmsten.matchers
import org.hamcrest.Description;
import org.hamcrest.Factory;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
public class StringMatchesUUIDPattern extends TypeSafeMatcher<String> {
private static final String UUID_REGEX = "[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}";