Skip to content

Instantly share code, notes, and snippets.

@kyledrake
kyledrake / gist:5995326
Created July 14, 2013 18:49
Current sysctl tweaks for NeoCities
net.ipv4.tcp_max_syn_backlog = 3240000
net.core.somaxconn = 3240000
net.ipv4.tcp_max_tw_buckets = 1440000
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
net.ipv4.tcp_congestion_control = cubic
net.core.netdev_max_backlog = 30000
decode_raw_tx = do ->
{ Transaction, TransactionIn, TransactionOut } = Bitcoin
{ bytesToBase64 } = Crypto.util
# Parse an bytearray of length `size` as an integer
# Works for numbers up to 32-bit only
parse_int = (size) -> (bytes) ->
n = 0
n += (bytes.shift() & 0xff) << (8 * i) for i in [0...size]
@kyledrake
kyledrake / bitcoind.js
Last active December 20, 2015 16:38
Probably the smallest feature-complete bitcoind RPC interface in existence.
var request = require('request');
function Bitcoind(url) {
this.url = url;
};
Bitcoind.prototype.rpc = function(method, params, callback) {
this.request({jsonrpc: '2.0', method: method, params: params}, callback);
};
@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 / {
@kyledrake
kyledrake / keybase.md
Created June 6, 2014 19:15
Verification of my PGP key on Keybase.io

Keybase proof

I hereby claim:

  • I am kyledrake on github.
  • I am kyledrake (https://keybase.io/kyledrake) on keybase.
  • I have a public key whose fingerprint is 9C30 FA7B EA38 CBCD AB4D B12C 8BE7 2107 2E18 64BE

To claim this, I am signing this object:

@kyledrake
kyledrake / test.js
Created July 31, 2014 05:06
Testing darkwallet/stealth.js
var stealth = require('stealth.js')
var b = require('bitcoinjs-lib')
// Receiver generates a scan and spend keypair
var receiverScanPrivateKey = new b.ECKey(undefined, true)
var receiverScanPublicKey = receiverScanPrivateKey.getPub()
var receiverSpendPrivateKey = new b.ECKey(undefined, true)
var receiverSpendPublicKey = receiverSpendPrivateKey.getPub()
# The Nginx configuration based on https://coderwall.com/p/rlguog
http {
ssl_certificate server.crt;
ssl_certificate_key server.key;
ssl_session_timeout 15m;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
@kyledrake
kyledrake / gist:3af997f6f58d4d58f728
Created August 21, 2014 19:10
50-synaptics.conf
# Example xorg.conf.d snippet that assigns the touchpad driver
# to all touchpads. See xorg.conf.d(5) for more information on
# InputClass.
# DO NOT EDIT THIS FILE, your distribution will likely overwrite
# it when updating. Copy (and rename) this file into
# /etc/X11/xorg.conf.d first.
# Additional options may be added in the form of
# Option "OptionName" "value"
#
Section "InputClass"
@kyledrake
kyledrake / gist:d7457a46a03d7408da31
Last active October 22, 2023 12:25
Creating a self-signed SSL certificate, and then verifying it on another Linux machine
# Procedure is for Ubuntu 14.04 LTS.
# Using these guides:
# http://datacenteroverlords.com/2012/03/01/creating-your-own-ssl-certificate-authority/
# https://turboflash.wordpress.com/2009/06/23/curl-adding-installing-trusting-new-self-signed-certificate/
# https://jamielinux.com/articles/2013/08/act-as-your-own-certificate-authority/
# Generate the root (GIVE IT A PASSWORD IF YOU'RE NOT AUTOMATING SIGNING!):
openssl genrsa -aes256 -out ca.key 2048
openssl req -new -x509 -days 7300 -key ca.key -sha256 -extensions v3_ca -out ca.crt
@kyledrake
kyledrake / boring.rb
Created April 5, 2015 23:52
Neocities boring web site detector
require 'rmagick'
require 'pry'
$filtered_sites = []
def web_site_too_blank?(path)
img = Magick::Image.read(path).first
pix = img.scale(1, 1)
average_color = pix.pixel_color(0,0)