Skip to content

Instantly share code, notes, and snippets.

View annabunches's full-sized avatar

Anna annabunches

View GitHub Profile
@annabunches
annabunches / reverse_proxy.conf
Created April 6, 2020 15:26
Dead simple nginx reverse proxy
# Install nginx then stick this in a file in /etc/nginx/sites-enabled
upstream mylighttpdapp {
# If on the same system:
# server unix:/some/unix/socket
# OR
# server 127.0.0.1:8080 # assuming port 8080 or whatever
# If on a different system just
# server 1.2.3.4:8080
@annabunches
annabunches / type_abstraction.lhs
Last active September 18, 2017 17:20
Just musing on haskell
So the thing I was getting excited about. Consider something like:
> myApply :: (a->b) -> a -> b
> myApply func x = func x
>
> inc x = x + 1
So, myApply takes some function and its parameter type, and returns that function's return type. `myApply inc 9` will evaluate to `10`.
But what if the type `a` above evaluates to a function, itself?
@annabunches
annabunches / chocofeed.rb
Last active September 13, 2017 03:50
"Why can't I feed that chocobo?" A rough approximation of the FF XIV chocobo stable training algorithm
# 'player' is the player trying to train the chocobo
# 'chocobo' is the chocobo being trained
# 'food' is the selected reward
def feed_chocobo(player, chocobo, food)
# Most players are limited by the 'global' feed timer for the chocobo.
if (player != chocobo.owner && chocobo.global_feed_timer > DateTime.now)
return # Can't feed choco yet
end
# The owner has a separate timer; if someone else feeds the choco, it doesn't reset the owner's timer, allowing a second feeding.

Keybase proof

I hereby claim:

  • I am annabunches on github.
  • I am annabunches (https://keybase.io/annabunches) on keybase.
  • I have a public key whose fingerprint is 82B1 FCF3 4308 1BE8 E788 26CF 2B85 6F73 EFEF 6022

To claim this, I am signing this object: