Skip to content

Instantly share code, notes, and snippets.

View jcpsantiago's full-sized avatar
🏊

João Santiago jcpsantiago

🏊
View GitHub Profile

gif-from-tweet

There are so many great GIFs out there and I want to have copies of them. Twitter makes that harder than it should be by converting them to MP4 and not providing access to the source material. To make it easier, I made a bash pipeline that takes a tweet URL and a filename, extracts the MP4 from that tweet and uses ffmpeg to convert back to GIF.

Dependencies

  • ffmpeg
    • macOS: brew install ffmpeg
    • Ubuntu/Debian: apt install ffmpeg
## gather your data frames into a list
l <- list(cars = mtcars,
sleepy = sleep)
## export into individual CSV files
export_list <- function(list, folder = NULL) {
purrr::iwalk(
list,
~ readr::write_csv(.x, path = paste0(folder, .y, ".csv"))
)
@jcpsantiago
jcpsantiago / Dockerfile
Created January 16, 2019 17:09
Dockerfile with packrat
FROM rocker/r-ver:3.5.1
RUN apt-get update && apt-get install -y --no-install-recommends \
## needed for git2r
libssl-dev \
## needed for curl
libcurl4-openssl-dev
ENV APP_DIR /app
#* Echo back the input
#* @param msg The message to echo
#* @get /echo
function(msg=""){
list(msg = paste0("The message is: '", msg, "'"))
}
#* Echo back the input
#* @param msg The message to echo
#* @get /echo
function(msg=""){
list(msg = paste0("The message is: '", msg, "'"))
}
syntax = "proto3";
package example;
message TestPayload {
int32 id = 1;
string name = 2;
}
message TestResponse {
the_plan <-
drake::drake_plan(
# cached data from previous analyses
orders = get_orders(),
matches = get_matches(cols_in_orders = names(orders)),
nearby = get_nearby(),
emailage = get_emailage(orders$order_id),
plz_and_area = get_plz_and_area(),
legal_form_mapping = get_legal_form_mapping(),
@jcpsantiago
jcpsantiago / plotit.fish
Last active September 6, 2020 14:21
Print DVC plots and metrics in the terminal
# Usage: plotit <target (required)> <x> <y> <width> <height>
function plotit -d="Prints DVC plots on the terminal" -a target x y width height
if test -z "$target"
echo Please provide a target csv file.
return 1
end
# set `-x` or `-y` if they are provided
set x_or $x ""
set y_or $y ""
@jcpsantiago
jcpsantiago / bulgogi.clj
Last active November 18, 2021 18:04
Proof of concept for bulgogi/feature processing system
(ns bulgogi.main
"
A bulgogi prototype. Not seasoned yet. ⚠️
An exploration on how a simple feature engineering system could look like in Clojure.
Features are defined as pure functions and take an input-data map as input:
{:input-data {:email \"hackermann@unprotected.com\"
:current-amount 3455
:previous-amount 2344}}
@jcpsantiago
jcpsantiago / n_orders_per_customer_id.yaml
Created November 10, 2021 18:01
n_orders_per_customer_id.yaml
feature_name: n_orders
entity_names: [customer_id]
type: STREAM
source: orders
query: |
CREATE OR REPLACE FUNCTION n_orders_per_customer_id( target_uuid varchar )
RETURNS TABLE (customer_id varchar, n_orders number)
as
$$
-- get the customer_id for the specific order so we only calculate the feature for