Skip to content

Instantly share code, notes, and snippets.

View f3nry's full-sized avatar

Paul Henry f3nry

  • Coinbase
  • Oakland, CA
View GitHub Profile
adder(3) do
adder(2) do
3
end
end
# => 8
@f3nry
f3nry / mostusedcommands
Created December 31, 2011 19:55
most used commands
history | awk '{print $2}' | awk 'BEGIN {FS="|"} {print $1}' | sort | uniq -c | sort -r
148 git
51 cd
39 ls
32 scala
32 rails
27 rspec
25 vagrant
15 vim
@f3nry
f3nry / hello.cpp
Created August 30, 2012 03:43
C++ Web Application
#include "cppcms/application.h"
#include "cppcms/applications_pool.h"
#include "cppcms/service.h"
#include "cppcms/http_response.h"
#include <cppcms/url_dispatcher.h>
#include <cppcms/url_mapper.h>
#include <iostream>
#include "content.h"
@f3nry
f3nry / really.js
Created September 7, 2012 06:14
Valid Javascript...?
[][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]][([][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]]+[])[+[[!+[]+!+[]+!+[]]]]+([][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]]]+([][[]]+[])[+[[+!+[]]]]+(![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[+!+[]]]]+([][[]]+[])[+[[+[]]]]+([][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+([][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[
@f3nry
f3nry / gist:3729184
Created September 15, 2012 18:27
Hearts
# encoding: utf-8
❤ = ["Person1", "Person2", "Person3"]
for person in ❤
puts person
end
@f3nry
f3nry / session.scala
Created September 19, 2012 06:22
Square Roots in Scala
object session {
def sqrt(x: Double) = {
def abs(x: Double) = if (x < 0) -x else x
def sqrtIter(guess: Double): Double =
if(isGoodEnough(guess)) guess
else sqrtIter(improve(guess))
def isGoodEnough(guess: Double): Boolean =
@f3nry
f3nry / gist:4753221
Last active December 12, 2015 09:39
Initializing an array and setting an incredibly high index causes Ruby to immediately use all of the available memory due to initializing all previous values in the array to the high index. I'm using ruby 1.9.3p286 on a Macbook with 8 gb of ram.
some_array = []
some_array[Time.now.to_i] = 1
### Keybase proof
I hereby claim:
* I am f3nry on github.
* I am fenry (https://keybase.io/fenry) on keybase.
* I have a public key ASBPaQKqvBh3005h5-Y0h5Itb0kOhYOc-jtjEI1zHDu8vwo
To claim this, I am signing this object:
@f3nry
f3nry / hello.proto
Created February 1, 2019 01:10
Simple gRPC Protobuf
// Location: api/hello.proto
syntax = "proto3";
option go_package = "api";
service Prod {
rpc Alive(AliveRequest) returns (AliveResponse) {}
}
message AliveRequest {
@f3nry
f3nry / main.go
Created February 1, 2019 01:15
API Gateway gRPC: First attempt
func handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {
return events.APIGatewayProxyResponse{
Body: "Hello, world.",
Headers: map[string]string{
"Content-Type": "application/grpc+proto",
},
StatusCode: 200,
}, nil
}