Skip to content

Instantly share code, notes, and snippets.

View billywhizz's full-sized avatar
🤓
always be learning

Andrew Johnston billywhizz

🤓
always be learning
View GitHub Profile
#!/bin/bash
git clone https://github.com/just-js/lo.git
cd lo/
make lo
export LO_HOME=$(pwd)
./lo build binding bestlines
cd ..
lo/lo build runtime test-dlopen
./test-dlopen
@billywhizz
billywhizz / simple_epoll_inotify_test.c
Created December 29, 2024 20:01 — forked from dalehamel/simple_epoll_inotify_test.c
Test inotify on memfd with epoll api
#include <stdio.h>
#include <sys/inotify.h>
#include <sys/time.h>
#include <sys/epoll.h>
#include <errno.h>
#include <linux/memfd.h>
#include <sys/mman.h>
#include <sys/syscall.h>
@billywhizz
billywhizz / build.sh
Last active November 18, 2024 00:11
dumb-benchmark
GOAMD64=v2 go build foo.go
@billywhizz
billywhizz / exit_the_cloud.md
Created October 24, 2024 20:57 — forked from rameerez/exit_the_cloud.md
☁️ How I got off the cloud and migrated everything from AWS to a VPS in Hetzner

☁️ How I got off the cloud and migrated everything from AWS to a VPS in Hetzner

This is an opinionated handbook on how I migrated all my Rails apps off the cloud and into VPS.

This is how I manage real production loads for my Rails apps. It assumes:

  • Rails 7+
  • Ruby 3+
  • PostgreSQL
  • Ubuntu Server 24.04
  • Capistrano, Puma, Nginx
WITH RECURSIVE transitive_dependencies AS (
SELECT package_id AS dependency_id, package_id AS root_id
FROM dependencies
WHERE kind = 'runtime'
UNION ALL
SELECT d.package_id, td.root_id
FROM dependencies d
JOIN transitive_dependencies td ON td.dependency_id = d.package_id AND td.dependency_id <> td.root_id -- Avoid self-joins
WHERE d.kind = 'runtime'
),
@billywhizz
billywhizz / sql-1.asp
Created October 20, 2024 08:40 — forked from DinoChiesa/sql-1.asp
An example of a Classic ASP module implemented in JavaScript. This one reads from a SQL database, does content negotiation, returning a query result as Text, XML, JSON, or HTML.
<%@ language="Javascript" %>
<script language="javascript" runat="server" src='json2.js'></script>
<script language="javascript" runat="server" src='stringExtensions.js'></script>
<script language="javascript" runat="server" src='contentNego.js'></script>
<script language="javascript" runat="server">
(function() {
// In an ASP scenario, this fn gets "exported"
$ cd /dev/shm/
$ git clone [email protected]:denoland/pm-benchmark.git
$ cd pm-benchmark/
$ mkdir testbed
$ cp -R fixture/* testbed/
$ cd testbed/
$ sync
$ sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"
[sudo] password for andrew: 
@billywhizz
billywhizz / bun-parallel-server.ts
Created October 13, 2024 05:42 — forked from fightbulc/bun-parallel-server.ts
Bun and Deno Bench (Ubuntu 24.04, AMD Ryzen™ 9 7900X × 24, 64GB RAM)
// will be called via bun-parallel-setup.ts
let i = 0;
Bun.serve({
port: process.env.PORT || 8000,
development: false,
// Share the same port across multiple processes
// This is the important part!
@billywhizz
billywhizz / ai_reasoning_challenge_v2.md
Created October 12, 2024 23:22 — forked from VictorTaelin/ai_reasoning_challenge_v2.md
INVERT A BINARY TREE - $10k AI REASONING CHALLENGE (v2)

THE PROBLEM

🌲 Invert a binary tree! 🌲

Except with 3 catches:

  1. It must invert the keys ("bit-reversal permutation")
  2. It must be a dependency-free, pure recursive function
  3. It must have type Bit -> Tree -> Tree (i.e., a direct recursion with max 1 bit state)
@billywhizz
billywhizz / zendesk.md
Created October 12, 2024 01:47 — forked from hackermondev/zendesk.md
1 bug, $50,000+ in bounties, how Zendesk intentionally left a backdoor in hundreds of Fortune 500 companies

hi, i'm daniel. i'm a 15-year-old with some programming experience and i do a little bug hunting in my free time. here's the insane story of how I found a single bug that affected over half of all Fortune 500 companies:

say hello to zendesk

If you've spent some time online, you’ve probably come across Zendesk.

Zendesk is a customer service tool used by some of the world’s top companies. It’s easy to set up: you link it to your company’s support email (like [email protected]), and Zendesk starts managing incoming emails and creating tickets. You can handle these tickets yourself or have a support team do it for you. Zendesk is a billion-dollar company, trusted by big names like Cloudflare.

Personally, I’ve always found it surprising that these massive companies, worth billions, rely on third-party tools like Zendesk instead of building their own in-house ticketing systems.

your weakest link