Skip to content

Instantly share code, notes, and snippets.

@gervasiocaj
gervasiocaj / index.js
Last active June 20, 2022 02:05
Youtube snippet utils to build timestamp lists
(function () {
const ytPlayer = document.getElementById("movie_player");
const viewCount = document.querySelector(".ytd-video-view-count-renderer");
const oldBtns = document.querySelectorAll("[data-timestamputils='true']");
oldBtns.forEach(function (el) { el.remove(); });
function buildButton(name, onClickFn) {
const btn = document.createElement("button");
btn.setAttribute("data-timestamputils", true);
@gervasiocaj
gervasiocaj / main.ipynb
Last active March 31, 2023 15:27
Versão preliminar do cálculo da evapotranspiração de referência aplicada ao zoneamento de risco climático do milho no estado da Bahia. Imagens no final denotam a média por decêndio ao longo de dez anos para um setor específico, bem como a visualização 3D da soma da evapotranspiração para um decêndio específico no estado (notar que a borda zerada…
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gervasiocaj
gervasiocaj / bonding.kt
Last active February 17, 2020 20:12
Implementation of the Bonding comic featured in xkcd blog https://xkcd.com/1188
class Ball: Throwable()
class P(var target: P?) {
fun aim(ball: Ball) {
try {
throw ball
} catch (b: Ball) {
target?.aim(b)
}
}
}
package compal;
import robocode.*;
import java.awt.Color;
import robocode.ScannedRobotEvent;
import robocode.util.Utils;
// API help : https://robocode.sourceforge.io/docs/robocode/robocode/Robot.html
/**
* NewLaziness - a robot by (Compal Team)
*/
@gervasiocaj
gervasiocaj / background.js
Last active March 30, 2018 16:38
Measuring performance of chrome.storage.local for extensions
/* eslint-env browser */
/* global chrome */
chrome.runtime.onInstalled.addListener(async function () {
console.log('start measuring')
const datasetSize = 1000
const jsonUrl = `http://www.filltext.com/?rows=${datasetSize}&id={string|8}&username={username}&password={string|5}&text={lorem|30}`
let myData = await getJSON(jsonUrl)
@gervasiocaj
gervasiocaj / you-dont-know-js-ebooks.sh
Created February 21, 2018 12:28 — forked from bmaupin/epub.css
You Don't Know JS Ebooks
sudo apt install fonts-dejavu-core git pandoc
git clone https://github.com/getify/You-Dont-Know-JS.git
wget -O You-Dont-Know-JS/epub.css https://gist.githubusercontent.com/bmaupin/6e3649af73120fac2b6907169632be2c/raw/epub.css
cd You-Dont-Know-JS
# Clean up redundant headings that end up getting split into separate chapters by themselves
find . -iname "*.md" -exec sed -i '/# You Don'\''t Know JS.*/d' {} \;
# Fix <br> tags which pandoc won't convert to <br />
find . -iname "*.md" -exec sed -i 's#<br>#<br />#' {} \;
@gervasiocaj
gervasiocaj / guia.md
Last active December 1, 2017 19:21
Guia de instalação do banco de dados MongoDB em servidores Windows

Guia de instalação do banco de dados MongoDB em servidores Windows

Importante ❗ 💥

Se o sistema operacional do servidor for Windows Server 2008 R2 ou Windows 7, instale o hotfix oficial da Microsoft disponível neste link.

Instalação

  1. Baixe o instalador oficial
@gervasiocaj
gervasiocaj / magic.sh
Last active July 28, 2017 00:35
Seedboxco script to link rtorrent and plex
#!/bin/sh -xu
# important
# Automated Media Center
# https://www.filebot.net/forums/viewtopic.php?t=215
# Plex Naming Schemes
# https://www.filebot.net/forums/viewtopic.php?f=5&t=4116
@gervasiocaj
gervasiocaj / docker-compose.yml
Last active May 17, 2017 20:30
Arquivo de setup de VMs de ferramentas de qualidade
version: '2'
services:
# comandinho: sudo chown -R 1000 /opt/tools/jenkins/
jenkins:
image: jenkins:latest
environment:
JAVA_OPTS: "-Djava.awt.headless=true"
ports:
- "50000:50000"
- "8081:8080"
@gervasiocaj
gervasiocaj / magic.sh
Last active May 15, 2017 13:28
Install AMD drivers on the Linux Mint 18.1 (Serena)
wget https://www2.ati.com/drivers/linux/ubuntu/amdgpu-pro-17.10-401251.tar.xz # faz download
tar -Jxvf amdgpu-pro-17.10-401251.tar.xz # descompacta
cd amdgpu-pro-17.10-401251
sed -i -e 's/$ID/$ID_LIKE/g' ./amdgpu-pro-install # substitui $ID (linuxmint) por $ID_LIKE (ubuntu)
./amdgpu-pro-install -y
sudo usermod -a -G video $LOGNAME
cd ..
# rm -rf amdgpu-pro-17.10-401251
# sudo shutdown -r 0