Skip to content

Instantly share code, notes, and snippets.

Avatar

Rodrigo Fernandes rtfpessoa

View GitHub Profile
@rtfpessoa
rtfpessoa / Dockerfile
Created Sep 24, 2020
GraalVM CE 20.2.0-java11 with musl-gcc
View Dockerfile
FROM oracle/graalvm-ce:20.2.0-java11
# Sourced from: https://docs.oracle.com/en/graalvm/enterprise/20/docs/reference-manual/native-image/StaticImages/
RUN \
# musl
curl -fsSL -o musl-1.2.1.tar.gz https://musl.libc.org/releases/musl-1.2.1.tar.gz && \
tar -xvf musl-1.2.1.tar.gz && \
cd musl-1.2.1 && \
./configure --disable-shared --prefix=/usr && \
@rtfpessoa
rtfpessoa / fix-grub-encrypted.sh
Last active Aug 18, 2020
Fix grub in encrypted Ubuntu (~18.04)
View fix-grub-encrypted.sh
#!/usr/bin/env bash
#
# Sources:
# - https://askubuntu.com/questions/844132/how-to-repair-boot-on-luks-encrypted-harddrive
# - https://gist.github.com/samuelcolvin/43c5ed2807e7db004b1058d0c9bfb068
# - https://unix.stackexchange.com/questions/178666/sbin-cryptsetup-not-found-on-boot
#
View CryptoAESGCM.scala
import java.security.SecureRandom
import cats.Monad
import cats.effect.IO
import tsec.cipher.symmetric.jca._
import tsec.cipher.symmetric.{AAD, _}
import tsec.common._
import scala.util.Random
@rtfpessoa
rtfpessoa / tvi-player-downloader.sh
Last active Apr 14, 2020
TVI Player Downloader
View tvi-player-downloader.sh
#!/usr/bin/env bash
for EPISODE_NUMBER in 1 2 3 4 5; do
EPISODE_URL="http://tviplayer.iol.pt/programa/pesadelo-na-cozinha/58bd77b50cf26a3bdcfca690/episodio/t1e${EPISODE_NUMBER}"
PLAYLISTS_BY_QUALITY_URLS=$(curl $EPISODE_URL 2>/dev/null | grep 'vod/_definst_' | sed -E 's/[ ]+videoUrl: '"'"'(.*)'"'"',/\1/')
youtube-dl -f best --audio-quality 0 -o pesadelo-na-cozinha-S01E0${EPISODE_NUMBER}.ts --prefer-ffmpeg $PLAYLISTS_BY_QUALITY_URLS &
done
wait
@rtfpessoa
rtfpessoa / docker-api-v2-example.sh
Last active Mar 10, 2017
Simple Docker Registry API v2 Wrapper
View docker-api-v2-example.sh
#!/usr/bin/env bash
#
# Simple Docker Registry API v2 Wrapper
#
REPOSITORY="doplicated/client"
get_from_dh() {
URL="$1"
@rtfpessoa
rtfpessoa / getopts_long.sh
Created Jan 21, 2017
getopts_long -- POSIX shell getopts with GNU-style long option support
View getopts_long.sh
#!/usr/bin/env bash
#
# getopts_long -- POSIX shell getopts with GNU-style long option support
#
# Copyright 2005-2009 Stephane Chazelas <stephane_chazelas@yahoo.fr>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that the above copyright notice appear in all copies and that both that
@rtfpessoa
rtfpessoa / brew-cask-upgrade.sh
Created Sep 24, 2016 — forked from c00kiemon5ter/brew-cask-upgrade.sh
a portable shell script to upgrade cask packages
View brew-cask-upgrade.sh
#!/bin/sh
help=0
latest=0
verbose=0
status=0
usage() {
cat <<-EOF
${0##*/} [options]
@rtfpessoa
rtfpessoa / openvpn-client-key-gen.sh
Last active Oct 25, 2019
OpenVPN Client Key Generator
View openvpn-client-key-gen.sh
#!/bin/bash
#
# OpenVPN Client Key Generation Script
#
# Author: rtfpessoa
# Date: 03-09-2016
#
# Based on the guide:
# * https://www.digitalocean.com/community/tutorials/how-to-set-up-an-openvpn-server-on-ubuntu-16-04
@rtfpessoa
rtfpessoa / lazy-load-nvm.sh
Created Aug 26, 2016
NVM lazy loading script
View lazy-load-nvm.sh
#!/bin/bash
#
# NVM lazy loading script
#
# NVM takes on average half of a second to load, which is more than whole prezto takes to load.
# This can be noticed when you open a new shell.
# To avoid this, we are creating placeholder function
# for nvm, node, and all the node packages previously installed in the system
# to only load nvm when it is needed.
View play.scala
/**
* Single-file play framework application! Make sure everything
* works, as this is the test case that un-earthed #371
*/
load.ivy("com.typesafe.play" %% "play" % "2.5.0")
load.ivy("com.typesafe.play" %% "play-netty-server" % "2.5.0")
load.ivy("org.scalaj" %% "scalaj-http" % "2.2.1")
@
You can’t perform that action at this time.