Skip to content

Instantly share code, notes, and snippets.

@kyledrake
kyledrake / ferengi-plan.txt
Last active April 6, 2024 00:30
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 / {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace Rotate
{
class Program
{
#include<iostream>
#include<map>
using namespace std;
map<char, int> t9;
void solve() {
char prev = -1, cur;
@mtayseer
mtayseer / euler_38.py
Created March 16, 2014 16:27
Solve project Euler problem #38 http://projecteuler.net/problem=38
# Analysis:
#
# Let's try to find the optimal range. We know that
# 1. 918273645 is a 1-9 pandigital & is a concatenated product, which means that this number is either the largest or
# below it, so we search from this number up
# 2. Then we find that the number we're trying to search for should start with 9, e.g. 9, 91, 945, etc
# 3. len(concat_product(x=90, n=3)) = 8, len(concat_product(x=90, n=4)) = 11. This range won't work.
# 4. len(concat_product(x=9000, n=2)) = 9. This is where we should start.
# 5. Taking #1 in consideration, we will start from 9182 till 9999
# 6. To get the pandigital number from a this range, we can multiply by n * 100000 + n * 2 => n * 100002
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace pandigital
{
class Program
{
from bottle import route, run, template, request
index_template = '''<table width=100% height=100% border=1>
<tr>
<td width=50%>
<textarea style="width: 100%; height: 100%"></textarea>
</td>
<td>
<div id="result">
</div>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Threading.Tasks;
namespace sqr
{
class result
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace sqr
{
class Program
{
public class t {
public static void main(String[] args) {
int current_val = 0, counter = 0;
for (int i = 1; i < 10000000; i++) {
current_val = i;
while (current_val != 1) {
current_val = calculateSquares(current_val);
if (current_val == 89) {
@mahmoufadel
mahmoufadel / GetSquareDigitChains
Created March 6, 2014 22:33
GetSquareDigitChains
int resualt=GetSquareDigitChains(2,10000000);
static int GetSquareDigitChains(int strt, int end)
{
int i = 0;
for (; strt < end; strt++)
{
int nextstrt = 0;
int strtTemp = strt;