Skip to content

Instantly share code, notes, and snippets.

View yyunikov's full-sized avatar

Yuriy Yunikov yyunikov

View GitHub Profile
gjyoung1974 /
Created May 15, 2018 00:36
Initialize Minikube - Local Kubernetes cluster on macOS
export KUBECONFIG=$HOME/.kube/config
#Download an OSX binary minikube
# minikube-darwin-amd64
# Put it somewhere that you can run it from: /usr/local/bin/minikube && chmod +x /usr/local/bin/minikube
# Download Docker Machine Hyperkit Driver

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.

luciddreamz /
Last active August 9, 2023 13:48 — forked from paoloantinori/
Keycloak Admin API Rest Example: Get User
# requires
# config
tony-gutierrez / AWS_Single_LetsEncrypt.yaml
Last active August 14, 2023 09:56
AWS Elastic Beanstalk .ebextensions config for single instance free SSL using letsencrypt certbot and nginx.
View AWS_Single_LetsEncrypt.yaml
# Dont forget to set the env variable "certdomain", and either fill in your email below or use an env variable for that too.
# Also note that this config is using the LetsEncrypt staging server, remove the flag when ready!
Type: AWS::EC2::SecurityGroupIngress
GroupId: {"Fn::GetAtt" : ["AWSEBSecurityGroup", "GroupId"]}
IpProtocol: tcp
ToPort: 443
WilliamDenniss / openid-configuration
Last active April 7, 2019 17:36
OpenID Connect Discovery Document of
View openid-configuration
"issuer": "",
"authorization_endpoint": "",
"token_endpoint": "",
"userinfo_endpoint": "",
"revocation_endpoint": "",
"jwks_uri": "",
"response_types_supported": [
rharter /
Created April 3, 2015 17:41
A Drawable that transitions between two child Drawables based on this Drawable's current level value. The idea here is that the center value (5000) will show the 'selected' Drawable, and any other value will show a transitional value between the 'selected' Drawable and the 'unselected' Drawable.
package com.pixite.fragment.widget;
import android.content.res.Resources;
import android.view.Gravity;
seanKenkeremath / Android Lollipop Widget Tinting Guide
Last active November 17, 2023 12:40
How base colors in Lollipop apply to different UI elements
View Android Lollipop Widget Tinting Guide
Unless specified otherwise, all of the below tinting applies to both Lollipop and pre-Lollipop using AppCompat v21. To use the support version of these attributes, remove the android namespace. For instance, "android:colorControlNormal" becomes "colorControlNormal". These attributes will be propagated to their corresponding attributes within the android namespace for devices running Lollipop. Any exceptions to this will be noted by including the "android:" prefix.
All Clickable Views:
* ripple effect (Lollipop only) -- "colorControlHighlight"
Status Bar:
* background (Lollipop only) - "colorPrimaryDark"
gabrielemariotti /
Last active November 27, 2022 09:27
Floating Action Button (requires Android-L preview)
public class MainActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
int size = getResources().getDimensionPixelSize(R.dimen.fab_size);
Outline outline = new Outline();
ademar111190 /
Last active March 16, 2023 10:44
An easy way to format SearchView's
import android.content.res.Resources;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.SearchView;
import android.widget.TextView;
jexchan /
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C ""