Skip to content

Instantly share code, notes, and snippets.

View ndrluis's full-sized avatar

Andre Luis Anastacio ndrluis

View GitHub Profile
import json
import graphviz
import trino
import os
import sys
import logging
import concurrent.futures
from concurrent.futures import ThreadPoolExecutor
from cachier import cachier
import datetime
@atomkirk
atomkirk / cloud-files.md
Last active January 18, 2023 17:23
Storing files on S3 with Elixir

I have this abstraction in my application code called a "CloudFile". This is where I store in the database information about files on S3 and it gives me a resource for other resources to own. For example, a user would have an avatar_cloud_file_id. On the front-end, I would load this relationship and display the avatar with user.avatar_cloud_file.download_url

defmodule RL.CloudFile do
  use Ecto.Schema
  import Ecto.Changeset

  @timestamps_opts type: :utc_datetime_usec
@shadowmaru
shadowmaru / slides.md
Last active November 26, 2020 07:17
Palestras da RubyConf BR 2017
@reborg
reborg / rich-already-answered-that.md
Last active May 5, 2024 04:45
A curated collection of answers that Rich gave throughout the history of Clojure

Rich Already Answered That!

A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.

How to use:

  • The link in the table of content jumps at the copy of the answer on this page.
  • The link on the answer itself points back at the original post.

Table of Content

@avocade
avocade / erl-observe.sh
Created February 22, 2017 12:34
Connect to remote erlang node with remote iex session (eg over k8s port-forwarding), and start observer on it
#!/bin/bash
# This script provides easy way to debug remote Erlang nodes that is running in a kubernetes cluster.
# Usage: ./erl-observe.sh -l app=my_all -n default -c erlang_cookie
#
# Don't forget to include `:runtime_tools` in your mix.exs application dependencies.
set -e
# Trap exit so we can try to kill proxies that has stuck in background
function cleanup {
echo " - Stopping kubectl proxy."
@keithpitty
keithpitty / tmux-ngrok.md
Last active December 15, 2023 16:24
Pairing with tmux and ngrok

Steps for Remote Pairing using tmux and ngrok

The following steps facilitate remote pairing using:

  • tmux which allows terminal sessions to be attached to different terminals, and
  • ngrok which provides secure tunnels to your localhost

1. Install tmux

OS X: brew install tmux

This is a proposal for a lightning talk at the Reactive 2016 conference. If you like this, star the Gist.


Thinking metrics on React applications

In regular websites, it is common to send multiple events to track user clicks. Single Page Applications change the way you look at metrics. This is a talk about a simple pattern we created at Globo.com to manage a metrics layer for http://globoplay.globo.com. The talk will cover how to track user flow using Google Analytics and other services. We solved the challenge of tying metrics and components, keeping information across pages and having global data. Also some React, React Router and React Side Effects concepts like context, higher order components, history state will be covered.

@waterlink
waterlink / hierarchical.cljs
Last active February 1, 2017 01:59
Reagent with Redux?
;; My idea of hierarchical Redux
;; ------------
;; reducers
;; reducers for todos (todo list)
(defmulti todos-reducer (fn [state ty data] ty))
(defmethod todos-reducer :todo-add [state ty {:keys [title done]}]
(let [state (update-in state [:counter] inc)
@KeyMaster-
KeyMaster- / polarWarp.glsl
Last active November 20, 2019 15:00
Luxe polar warp shader
//The source texture that will be transformed
uniform sampler2D tex0;
//The texture coordinate passed in from the vertex shader (the default luxe vertex shader is suffice)
varying vec2 tcoord;
//x: width of the texture divided by the radius that represents the top of the image (normally screen width / radius)
//y: height of the texture divided by the radius representing the top of the image (normally screen height / radius)
uniform vec2 sizeOverRadius;
#include <Cocoa/Cocoa.h>
#include <mono/metadata/appdomain.h>
#include <mono/metadata/assembly.h>
#include <mono/metadata/image.h>
#include <mono/metadata/class.h>
#include <mono/metadata/object.h>
// http://www.jerrodputman.com/2010/01/10/the-unityobjective-c-divide/
MonoMethod *update_method;