Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
export PATH=/bin:/usr/bin:/sbin:/usr/sbin
usage=$(
cat <<EOF
$0 [OPTIONS] start/stop
-s set speed default 256Kbit/s
-p set port default 3000
-d set delay default 350ms
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@ragingwind
ragingwind / Backend Architectures Keywords and References.md
Last active April 17, 2024 10:51
Backend Architectures Keywords and References
require 'rubygems'
require 'mechanize'
FIRST_NAME = 'FIRST_NAME'
LAST_NAME = 'LAST_NAME'
PHONE = 'PHONE'
EMAIL = 'EMAIL@provider.com'
PARTY_SIZE = 2
SCHEDULE_RANGE = { :start_time => '19:00', :end_time => '20:30' }
@davemkirk
davemkirk / wpt_server_setup.sh
Last active February 7, 2017 00:14
WebPageTest Server Setup - Ubuntu 12.04 LTS
#!/bin/bash
apt-get update -y
apt-get install apache2 -y
apt-get install php5 libapache2-mod-php5 -y
/etc/init.d/apache2 restart
apt-get install php5-gd -y
apt-get install php5-curl -y
// Restify Server CheatSheet.
// More about the API: http://mcavage.me/node-restify/#server-api
// Install restify with npm install restify
// 1.1. Creating a Server.
// http://mcavage.me/node-restify/#Creating-a-Server
var restify = require('restify');
@ygotthilf
ygotthilf / jwtRS256.sh
Last active June 11, 2024 02:25
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
1. Highlight a recommended option,

2. Allow users to switch currency (€/$/£)

3. Allow users to switch pricing monthly/yearly

4. Keep the entire pricing plan area clickable

5. Use slider to calculate how much a user would save

6. Provide free first month for good engagement

7. Prominently highlight testimonials prominently

8. Repeating call to action on top and bottom

9. Sell benefits instead of features

10. Indicate that users can cancel any time


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.

@mucahitnezir
mucahitnezir / .htaccess
Last active August 21, 2023 01:11
General .htaccess file for gzip/deflate compression and redirecting both of www and ssl(https). Needed modules in httpd.conf: deflate_module(modules/mod_deflate.so), (expires_module modules/mod_expires.so), (headers_module modules/mod_headers.so), (rewrite_module modules/mod_rewrite.so)
## KEEP-ALIVE ##
<IfModule mod_headers.c>
Header set Connection keep-alive
</IfModule>
## KEEP-ALIVE ##
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 month"