Skip to content

Instantly share code, notes, and snippets.

@bmatcuk
bmatcuk / create-usb.sh
Created May 30, 2019 04:38
Creating a Bootable Windows USB from ISO on a Mac
# First, we need to find our device. BEFORE inserting your USB drive, run the
# following:
diskutil list
# This will output a bunch of info about all of the disk drives connected to
# your Mac. Each entry will have a header in the form "/dev/diskX", where X is
# some number starting at 0. Now, insert your USB drive and run the command
# again. You should see a new entry. Make note of the name (ie, /dev/diskX).
diskutil list
@longtailventures
longtailventures / gist:0df3d6a2df3c1efbfb7e7a2add7ebb20
Created July 18, 2018 20:20
pngcrush all .png files in folder
https://www.commandlinefu.com/commands/view/10996/pngcrush-all-.png-files-in-the-directory
find . -iname '*png' -exec pngcrush -ow -brute {} {}.crush \;
@loganvolkers
loganvolkers / Byte Formatting for Google Sheets.md
Last active April 16, 2024 10:42
Byte formatting for Google Sheets
@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"

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.

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

@ygotthilf
ygotthilf / jwtRS256.sh
Last active May 23, 2024 07:42
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
// 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');
@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
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' }