#Scoped Invitation System for User Groups with Rails#
Starting out with the following models and associations:
####User
- has_many :memberships
- has_many :organizations through :memberships
####Organization (User Group)
- has_many :memberships
#Scoped Invitation System for User Groups with Rails#
Starting out with the following models and associations:
####User
####Organization (User Group)
AWS region code | AWS region name | Number of AZs | AZ names |
---|---|---|---|
us-east-1 | Virginia | 4 | us-east-1a, us-east-1b, us-east-1c, us-east-1e |
us-west-1 | N. California | 2 | us-west-1a, us-west-1b |
us-west-2 | Oregon | 3 | us-west-2a, us-west-2b, us-west-2c |
eu-west-1 | Ireland | 3 | eu-west-1a, eu-west-1b, eu-west-1c |
eu-central-1 | Frankfurt | 2 | eu-central-1a, eu-central-1b |
ap-southeast-1 | Singapore | 2 | ap-southeast-1a, ap-southeast-1b |
ap-southeast-2 | Sydney | 2 | ap-southeast-2a, ap-southeast-2b, ap-southeast-2c |
ap-northeast-1 | Tokyo | 2 | ap-northeast-1a, ap-nort |
api: bundle exec puma -C config/puma.rb |
// kills long running ops in MongoDB (taking seconds as an arg to define "long") | |
// attempts to be a bit safer than killing all by excluding replication related operations | |
// and only targeting queries as opposed to commands etc. | |
killLongRunningOps = function(maxSecsRunning) { | |
currOp = db.currentOp(); | |
for (oper in currOp.inprog) { | |
op = currOp.inprog[oper-0]; | |
if (op.secs_running > maxSecsRunning && op.op == "query" && !op.ns.startsWith("local")) { | |
print("Killing opId: " + op.opid |
#!/bin/bash | |
FILENAME="/tmp/random-lines.$$.tmp" | |
NUMLINES=10000000 | |
seq -f 'line %.0f' $NUMLINES > $FILENAME; | |
echo "10 random lines with nl:" | |
$(which time) -v nl -ba $filename | sort -r | sed 's/.*[0-9]\t//' | head > /dev/null | |
echo "10 random lines with shuf:" | |
$(which time) -v shuf $FILENAME -n10 | head > /dev/null |
#!/bin/bash | |
# Run with: | |
# | |
# bash get_twitter_oauth2_token.sh $KEY $SECRET > oauth2_token | |
# | |
# Then enjoy Twitter's API app functions such as search/tweets or lists/members: | |
# | |
# curl -H "$(cat oauth2_token)" "https://api.twitter.com/1.1/search/tweets.json?q=assembleenat+OR+deputes&count=200" | |
# curl -H "$(cat oauth2_token)" "https://api.twitter.com/1.1/lists/members.json?slug=les-d%C3%A9put%C3%A9s&owner_screen_name=AssembleeNat&skip_status=1" |
-- show running queries (pre 9.2) | |
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(query_start, clock_timestamp()), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
When hosting our web applications, we often have one public IP
address (i.e., an IP address visible to the outside world)
using which we want to host multiple web apps. For example, one
may wants to host three different web apps respectively for
example1.com
, example2.com
, and example1.com/images
on
the same machine using a single IP address.
How can we do that? Well, the good news is Internet browsers