Skip to content

Instantly share code, notes, and snippets.

🎣
gone fishing

Evadne Wu evadne

🎣
gone fishing
Block or report user

Report or block evadne

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ex_aws_s3_sign.ex
defp prepare_signed_url({region, bucket, object}, friendly_name) do
config = ExAws.Config.new(:s3, %{region: region})
encoded_name = URI.encode(friendly_name, fn
x when ?0 <= x <= ?9 -> true
x when ?A <= x <= ?Z -> true
x when ?a <= x <= ?z -> true
_ -> false
end)
options = [
@evadne
evadne / a-reverse-bench.exs
Last active Jul 16, 2019
Reversing Binaries in Elixir
View a-reverse-bench.exs
defmodule Benchmarker do
def run(title, module, function, size \\ 1024, iterations \\ 100) do
times = for (_ <- 1 .. iterations) do
data = :crypto.strong_rand_bytes(size)
{duration, _value} = :timer.tc fn ->
apply(module, function, [data])
end
duration
end
@evadne
evadne / wxmac.rb
Created Jul 14, 2017
wxmac for Homebrew on macOS 10.13 Beta (17A306f)
View wxmac.rb
class Wxmac < Formula
desc "Cross-platform C++ GUI toolkit (wxWidgets for macOS)"
homepage "https://www.wxwidgets.org"
url "https://github.com/wxWidgets/wxWidgets/releases/download/v3.0.3.1/wxWidgets-3.0.3.1.tar.bz2"
sha256 "3164ad6bc5f61c48d2185b39065ddbe44283eb834a5f62beb13f1d0923e366e4"
head "https://github.com/wxWidgets/wxWidgets.git"
bottle do
cellar :any
sha256 "9766307eb821a254c81002e7318aa89dc2f4cd7a5a09515fce54eb96ae70f898" => :sierra
@evadne
evadne / gist:8424f4dee3243e96e35ec5b6ecc8568f
Created Jun 29, 2017
Erlang/OTP 20, wxmac 3.1.0, macOS 10.13 17A291m
View gist:8424f4dee3243e96e35ec5b6ecc8568f
Overlord:~ evadne$ brew install erlang
==> Installing dependencies for erlang: autoconf, automake, libtool, pkg-config, makedepend, openssl, jpeg, libpng, libtiff, wxmac
==> Installing erlang dependency: autoconf
==> Using the sandbox
==> Downloading https://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/autoconf/2.69 --with-lispdir=/usr/local/Cellar/autoconf/2.69/share/emacs/site-lisp/autoconf
==> make install
==> Caveats
Emacs Lisp files have been installed to:
@evadne
evadne / main.exs
Last active Jun 25, 2017
Cosine Similarity with Elixir
View main.exs
defmodule Script do
def cosine_similarity(lhs, rhs) do
{ab, aa, bb} = accumulate(lhs, rhs)
ab / (:math.sqrt(aa) * :math.sqrt(bb))
end
defp accumulate(lhs, rhs) do
accumulate(lhs, rhs, 0, 0, 0)
end
View GeekBench 4 - Radeon Pro 460 - OpenCL
macOS 10.12.1 (Build 16B2659)
https://browser.geekbench.com/v4/compute/295179
https://browser.geekbench.com/v4/compute/295180
https://browser.geekbench.com/v4/compute/295182
https://browser.geekbench.com/v4/compute/295185
https://browser.geekbench.com/v4/compute/295187
macOS 10.12.2 (Build 16C63a)
https://browser.geekbench.com/v4/compute/295151
https://browser.geekbench.com/v4/compute/295161
View keybase.md

Keybase proof

I hereby claim:

  • I am evadne on github.
  • I am evadne (https://keybase.io/evadne) on keybase.
  • I have a public key whose fingerprint is 6E8D 9156 5EC2 19B8 D653 43D6 D6D0 9A02 FB9C AA71

To claim this, I am signing this object:

@evadne
evadne / 0_CONTRIBUTORS.md
Last active Oct 15, 2019
RVM + MRI + Capistrano + Puma + Sidekiq
View 0_CONTRIBUTORS.md
  • Josh Goebel (@yyyc514): suggested lazy evaluation on set
@evadne
evadne / ephemeral_token.rb
Created Jul 23, 2015
Ephemeral Secure Token with JWT
View ephemeral_token.rb
class EphemeralToken
attr_reader :origin, :targets, :expires_at, :payload
class TokenInvalid < StandardError; end
class TokenExpired < TokenInvalid; end
Algorithm = 'HS512'
Secret = ENV['SECRET_EPHEMERAL_TOKEN_KEY']
ObjectToNotation = -> (target) { [target.class.model_name.name, target.id] }
NotationToObject = -> ((model_name, model_id)) { model_name.constantize.find_by_id(model_id) }
@evadne
evadne / journal
Last active Aug 29, 2015
$ fleetctl journal -f deis-builder@1.service
View journal
core@deis-1 ~ $ fleetctl journal -f deis-builder@1.service
-- Logs begin at Wed 2014-10-08 14:11:41 UTC. --
Oct 10 15:03:08 deis-3 sh[30201]: [50cca74e] -job image_get(2f651070bd84650340ba1210ef10a8957c74c9dc32d39ff3bf4625cbc355ca1b) = ERR (1)
Oct 10 15:03:08 deis-3 sh[30201]: [50cca74e] +job image_get(fb8e2f5f8a6c25dcafe9d8a79ca35471a3a4251690581756fdad117046b199a4)
Oct 10 15:03:08 deis-3 sh[30201]: No such id: fb8e2f5f8a6c25dcafe9d8a79ca35471a3a4251690581756fdad117046b199a4
Oct 10 15:03:08 deis-3 sh[30201]: [50cca74e] -job image_get(fb8e2f5f8a6c25dcafe9d8a79ca35471a3a4251690581756fdad117046b199a4) = ERR (1)
Oct 10 15:03:08 deis-3 sh[30201]: [50cca74e] +job image_get(4fc3518d6f3593906bb563241420abc018cfbfd705fe6528d3b22580bc625a49)
Oct 10 15:03:08 deis-3 sh[30201]: No such id: 4fc3518d6f3593906bb563241420abc018cfbfd705fe6528d3b22580bc625a49
Oct 10 15:03:08 deis-3 sh[30201]: [50cca74e] -job image_get(4fc3518d6f3593906bb563241420abc018cfbfd705fe6528d3b22580bc625a49) = ERR (1)
Oct 10 15:03:08 deis-3 sh[30201]:
You can’t perform that action at this time.