Skip to content

Instantly share code, notes, and snippets.

@ingenieroariel
ingenieroariel / configuration.i3status
Last active February 26, 2024 11:13
nixos-laptop
theme = "solarized-dark"
icons = "awesome"
[[block]]
block = "disk_space"
path = "/"
alias = "/"
info_type = "available"
unit = "GB"
interval = 20
@g-alonso
g-alonso / AdoDbDoctrineAdapter.php
Last active January 24, 2024 00:29
PHP AdoDb Doctrine Adapter
<?php
/**
* Class AdoDbDoctrineAdapter
*
*
* Intentaremos empalmar adodb con doctrine
*
* Metodos de ADODB:
*

Scaling your API with rate limiters

The following are examples of the four types rate limiters discussed in the accompanying blog post. In the examples below I've used pseudocode-like Ruby, so if you're unfamiliar with Ruby you should be able to easily translate this approach to other languages. Complete examples in Ruby are also provided later in this gist.

In most cases you'll want all these examples to be classes, but I've used simple functions here to keep the code samples brief.

Request rate limiter

This uses a basic token bucket algorithm and relies on the fact that Redis scripts execute atomically. No other operations can run between fetching the count and writing the new count.

@kbastani
kbastani / microservices.adoc
Last active September 21, 2022 14:39
Using Graph Analysis to Design Microservice Architectures in the Cloud

Using Graph Analysis to Design Microservice Architectures in the Cloud

This interactive Neo4j graph tutorial covers how to use graph analysis to find software modules that are highly centralized, making good candidates to be decomposed into microservices.


# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
layout title description path
barewithrelated
Book Authoring Using GitHub and Git
Formats, tips and techniques for using GitHub and Git as the version control and collaborative platform for writing short and long form books.
usecases/_posts/2001-01-01-book-authoring-using-git-and-github.md

GitHub and Git are not just for writing programming code. They can also be an effective tool for writing articles and books. Matthew McCullough has written a quick guide to writing books in lightweight formats. This article will be folded into this Teaching repository over the coming months.

What is this?

@jvns
jvns / interview-questions.md
Last active April 25, 2024 15:52
A list of questions you could ask while interviewing

A lot of these are outright stolen from Edward O'Campo-Gooding's list of questions. I really like his list.

I'm having some trouble paring this down to a manageable list of questions -- I realistically want to know all of these things before starting to work at a company, but it's a lot to ask all at once. My current game plan is to pick 6 before an interview and ask those.

I'd love comments and suggestions about any of these.

I've found questions like "do you have smart people? Can I learn a lot at your company?" to be basically totally useless -- everybody will say "yeah, definitely!" and it's hard to learn anything from them. So I'm trying to make all of these questions pretty concrete -- if a team doesn't have an issue tracker, they don't have an issue tracker.

I'm also mostly not asking about principles, but the way things are -- not "do you think code review is important?", but "Does all code get reviewed?".

@larsrh
larsrh / build.sbt
Created November 17, 2013 21:49
Code examples from scala.io 2013 (see comments). Note that until shapeless 2.0.0 is out, this is still in a state of flux.
scalaVersion := "2.10.2"
resolvers += Resolver.sonatypeRepo("snapshots")
libraryDependencies += "org.typelevel" %% "shapeless-scalaz" % "0.2-SNAPSHOT"
libraryDependencies += "org.typelevel" %% "shapeless-scalacheck" % "0.2-SNAPSHOT"
initialCommands in console := """
import scalaz._
object TypeClassExample {
trait UnicodeOrdered[T] {
def ≤(i:T,j:T): Boolean
}
object UnicodeOrdered {
implicit object UnicodeOrderedInt extends UnicodeOrdered[Int] {
def ≤(i:Int,j:Int): Boolean = i <= j
}
<?php
/**
* PDO SINGLETON CLASS, ADODB ENABLED
*
* @author Tony Landis
* @link http://www.tonylandis.com
* @license Use how you like it, just please don't remove or alter this PHPDoc
*/
class sdb {
/**