Skip to content

Instantly share code, notes, and snippets.

@kyledrake
kyledrake / ferengi-plan.txt
Last active July 10, 2024 18:51
How to throttle the FCC to dial up modem speeds on your website using Nginx
# The blog post that started it all: https://neocities.org/blog/the-fcc-is-now-rate-limited
#
# Current known FCC address ranges:
# https://news.ycombinator.com/item?id=7716915
#
# Confirm/locate FCC IP ranges with this: http://whois.arin.net/rest/net/NET-165-135-0-0-1/pft
#
# In your nginx.conf:
location / {
#requires -version 2.0
[CmdletBinding()]
param (
[parameter(Mandatory=$true)]
[ValidatePattern('\.rptproj$')]
[ValidateScript({ Test-Path -PathType Leaf -Path $_ })]
[string]
$Path,
[parameter(
@aaronlerch
aaronlerch / fluentmigrator_migration.xml
Created January 17, 2012 15:41
Simple Resharper live template for FluentMigrator migrations
<TemplatesExport family="Live Templates">
<Template uid="23818653-ac72-4057-9afc-35649cdfe0fc" shortcut="migration" description="FluentMigrator Migration" text="[Migration($VERSION$)]&#xD;&#xA;public class $MIGRATION_NAME$ : Migration&#xD;&#xA;{&#xD;&#xA; public override void Up()&#xD;&#xA; {&#xD;&#xA; $UP$&#xD;&#xA; }&#xD;&#xA;&#xD;&#xA; public override void Down()&#xD;&#xA; {&#xD;&#xA; $DOWN$&#xD;&#xA; }&#xD;&#xA;}" reformat="True" shortenQualifiedReferences="True">
<Context>
<CSharpContext context="Everywhere" minimumLanguageVersion="2.0" />
</Context>
<Categories />
<Variables>
<Variable name="VERSION" expression="getCurrentTime(&quot;yyyyMMddHHmmss&quot;)" initialRange="0" />
<Variable name="MIGRATION_NAME" expression="" initialRange="0" />
<Variable name="UP" expression="constant(&quot;throw new NotImplementedException();&quot;)" initialRange="0" />
@napcs
napcs / README.md
Created May 6, 2011 04:10
Deploying Rails to Linode

Deploying Rails to Linode

Installing Ruby Enterprise Edition, Apache, MySQL, and Passenger for deploying Rails 3.0 applications.

Get a Linode, and set it up with Ubuntu 10.04 LTS so that you have till April 2013 to get updates. Once the Linode is formatted, boot it and continue on.

Set up an 'A' record in your DNS, pointing to the IP of your Linode. I'm using demo.napcs.com here.

Initial setup

def friendly_name(user)
temp_name = if user.first_name.blank? && user.last_name.blank?
user.email
elsif user.first_name.blank?
user.last_name
elsif user.last_name.blank?
user.first_name
else
"#{user.first_name} #{user.last_name}"
@coreyhaines
coreyhaines / Generate UID
Created March 16, 2011 16:04
Use base32 encoding
to_encode = (rand(4096)+2048)*Time.new.to_i*<put a big number here, potentially secret, probably can figure it out easily enough>
Base32::Crockford.encode(to_encode, :split => 5)
@stevenharman
stevenharman / fitter-happier.sh
Created March 12, 2011 03:20
awesomely weird; Radiohead uses OS X?
say -v Fred "Fitter, happier, more productive,
comfortable,
not drinking too much,
regular exercise at the gym
(3 days a week),
getting on better with your associate employee contemporaries,
at ease,
eating well
(no more microwave dinners and saturated fats),
a patient better driver,
@chyld
chyld / Installation of Ruby 1.9.2, Rails 3, MongoDB 1.6.5 on Ubuntu 10.10 64 bit Amazon EC2 image
Created February 3, 2011 23:08
Install Ruby, Rails, MongoDB on Amazon EC2 Ubuntu image with Sample Applicaton
#amazon ec2 image
#ubuntu 10.10, 64bit : ami-cef405a7
#to add additional ebs storage to your instance
#goto volumes and create a volume in the same zone as the instance
#after it is created, attach the volume to the instance
Attachment Information:i-dbb12eb7:/dev/sdp (attached)
#ssh to ec2
ssh -i <key-file>.pem ubuntu@<ip-address-to-ec2>
@ryanb
ryanb / application.html.erb
Created January 19, 2011 19:31
Example of very simple password authentication.
<!-- layout file -->
<% if current_user %>
Welcome <%= current_user.username %>. Not you? <%= link_to "Log out", logout_path %>
<% else %>
<%= link_to "Sign up", signup_path %> or <%= link_to "log in", login_path %>.
<% end %>
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}