(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
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.
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.
$ openssl s_client -servername token.actions.githubusercontent.com -showcerts -connect token.actions.githubusercontent.com:443 < /dev/null 2>/dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sed "0,/-END CERTIFICATE-/d" > certificate.crt | |
$ openssl x509 -in certificate.crt -fingerprint -noout | cut -f2 -d'=' | tr -d ':' | tr '[:upper:]' '[:lower:]' | |
6938fd4d98bab03faadb97b34396831e3780aea1 |
import java.security.KeyPairGenerator; | |
import java.security.KeyPair; | |
import java.security.PrivateKey; | |
import java.security.PublicKey; | |
import java.security.KeyFactory; | |
import java.security.spec.EncodedKeySpec; | |
import java.security.spec.PKCS8EncodedKeySpec; | |
import java.security.spec.X509EncodedKeySpec; | |
import java.security.spec.InvalidKeySpecException; | |
import java.security.NoSuchAlgorithmException; |
#!/usr/bin/ruby | |
# Create display override file to force Mac OS X to use RGB mode for Display | |
# see http://embdev.net/topic/284710 | |
require 'base64' | |
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay` | |
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten | |
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten |
Puts on glasses: | |
(•_•) | |
( •_•)>⌐■-■ | |
(⌐■_■) | |
Takes off glasses ("mother of god..."): | |
(⌐■_■) | |
( •_•)>⌐■-■ |
Here's a method to chat in a twitch #channel with IRSSI
Get your oauth token here: https://twitchapps.com/tmi/
Server block
server = {
address = "irc.chat.twitch.tv";
--- | |
AWSTemplateFormatVersion: '2010-09-09' | |
Description: some-sftp-server | |
Parameters: | |
HostedZoneIdParam: | |
Type: String | |
Description: Hosted Zone ID | |
SFTPHostnameParam: | |
Type: String |