Skip to content

Instantly share code, notes, and snippets.

View 42thcoder's full-sized avatar
🎯
Focusing

Yunzheng 42thcoder

🎯
Focusing
View GitHub Profile
@42thcoder
42thcoder / bench_rails_memory_usage.rb
Created June 20, 2016 17:09 — forked from brianhempel/bench_rails_memory_usage.rb
A script to test the memory usage of your Rails application over time. It will run 30 requests against the specified action and report the final RSS. Choose the URL to hit on line 45 and then run with `ruby bench_rails_memory_usage.rb`.
require "net/http"
def start_server
# Remove the X to enable the parameters for tuning.
# These are the default values as of Ruby 2.2.0.
@child = spawn(<<-EOC.split.join(" "))
XRUBY_GC_HEAP_FREE_SLOTS=4096
XRUBY_GC_HEAP_INIT_SLOTS=10000
XRUBY_GC_HEAP_GROWTH_FACTOR=1.8
XRUBY_GC_HEAP_GROWTH_MAX_SLOTS=0
@42thcoder
42thcoder / vpn.sh
Last active August 29, 2015 14:18 — forked from hongjiang/vpn.sh
#!/bin/bash
PROG_NAME=$0
ACTION=$1
usage() {
echo "Usage: $PROG_NAME {list|ping|optimal|conn|close|status}"
exit 1
}

This is an example command for Backtick. A Backtick command consists of some executable JavaScript and a bit of metadata in JSON.

Here are the required steps to create a command:

  1. Create a new Gist with a command.js and command.json file, or simply fork this one.

  2. Write your JavaScript in command.js. This will be injected into and executed on the page the user is currently on when they run it.

  3. Add some metadata to the command.json file:

  • name: The name of the command.