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 .gitignore
out.txt
out-sorted.txt
words.txt
@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 / gettext-sanitise.exs
Created Oct 13, 2019
Sanitise Gettext (Elixir) output for version control
View gettext-sanitise.exs
# For all .POT files
# Parse PO to internal format
# Remove comments
# Remove duplicate references
# Sort terms by key
# Dump out data
# Bodge data with regex
# Remove leading #: for long reference
# Write file
@evadne
evadne / gist:4544569
Last active Oct 2, 2019
Todd Laney’s enhancements to Sticky Headers + UICollectionViewFlowLayout
View gist:4544569
//
// StickyHeaderLayout.h
// Wombat
//
// Created by Todd Laney on 1/9/13.
// Copyright (c) 2013 ToddLa. All rights reserved.
//
// Modified from http://blog.radi.ws/post/32905838158/sticky-headers-for-uicollectionview-using THANKS!
//
@evadne
evadne / service_discovery.ex
Created Sep 12, 2019
ExAws add-on for AWS Service Discovery
View service_discovery.ex
defmodule ExAws.ServiceDiscovery do
@moduledoc """
Minimal module to issue AWS Cloud Map requests with ExAws, which
is used by clustering mechanisms.
"""
alias ExAws.Operation.JSON
@version "2017-03-14"
@namespace "Route53AutoNaming_v20170314"
@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 / script.sh
Created Apr 28, 2019
Properly invoke Sublime Text from WSL
View script.sh
function subl () {
SublimePath="/mnt/c/Program Files/Sublime Text 3/subl.exe"
TargetPath=$(readlink -f $1)
HomePath="/home/evadne"
ProjectsPath=$(readlink -f $HomePath/projects)
SublimeProjectsPath=$(readlink -f $HomePath/sublime)
echo "Editing $TargetPath"
case $TargetPath/ in
$ProjectsPath/*)
@evadne
evadne / 01-multistage-build.sh
Last active Feb 6, 2019
Build & Cache multi-stage Docker images (with Build Specification for AWS CodeBuild)
View 01-multistage-build.sh
# the general idea
ImageTag="git"
FilePath="/Dockerfile"
RepoURI="123456789012.dkr.ecr.eu-west-1.amazonaws.com/repo"
Stages=$(cat $FilePath | grep -oP '^FROM .+ (AS|as) \K(.+)$')
CacheArgs=$(for Stage in $Stages; do echo "--cache-from $RepoURI:cache-$Stage"; done | paste -sd ' ')
BuildArgs="--file $FilePath $CacheArgs"
for Stage in $Stages; do docker pull $RepoURI:cache-$Stage || true; done
for Stage in $Stages; do docker build $BuildArgs --tag $RepoURI:cache-$Stage --target $Stage . || break; done
docker build $BuildArgs --tag $RepoURI:$ImageTag .
@evadne
evadne / gist:440558b18228ca657ef22b465793a0c3
Last active Nov 27, 2018
Using SchemaCrawler on PostgreSQL databases
View gist:440558b18228ca657ef22b465793a0c3
@evadne
evadne / srcds_rcon.ex
Created Nov 12, 2018
Source RCON client in Elixir (using gen_tcp)
View srcds_rcon.ex
defmodule HuddleGateway.External.SourceRemoteControl do
@moduledoc """
A simple gen_tcp based implementation of a Source RCON client
- [Source RCON Protocol](https://developer.valvesoftware.com/wiki/Source_RCON_Protocol)
By calling `connect/2`, you can obtain an open TCP socket,
which can then be used with `auth/3` or `exec/3`.
"""
You can’t perform that action at this time.