Skip to content

Instantly share code, notes, and snippets.

View larruda's full-sized avatar

Lucas Arruda larruda

View GitHub Profile
Parameter Description
--max-retry-attempts O número máximo de tentativas que um job falho não pode exceder.
--max-retry-duration O tempo máximo para tentar novamente um job falho, contado à partir da primeira execução.
--min-backoff O tempo mínimo a se esperar antes de tentar novamente após uma falha. O padrão é '5s'.
--max-backoff O tempo máximo a se esperar antes de tentar novamente após uma falha. O padrão é '1h'.
--max-doublings O número máximo de tentativas que o intervalo entre jobs falhos será dobrado antes do aumento se tornar constante. O padrão é 16.
@larruda
larruda / bq_partition_table.sh
Created December 8, 2016 15:35
Bash script to import data into a partitioned table on BigQuery from another table using a DATE field as a filter.
#!/bin/bash
#set -x
oldifs="$IFS"
IFS=$'\n'
echo -n "Type in the project id and press [ENTER]: "
read project_id
echo -n "Type in the dataset name and press [ENTER]: "
read dataset
echo -n "Type in the source table name and press [ENTER]: "
@larruda
larruda / unquoted_json_fix.js
Last active November 22, 2022 09:49
REGEX to add quotes to JSON unquoted keys (turns an invalid JSON into a valid one).
json_string.replace(/(\s*?{\s*?|\s*?,\s*?)(['"])?([a-zA-Z0-9]+)(['"])?:/g, '$1"$3":');
eval('var json = new Object(' + json_string + ')');
@larruda
larruda / forksync.sh
Last active August 29, 2015 14:03
Syncs a forked repository against its upstream.
#!/bin/sh
git_repo=$1
[ -z "$git_repo" ] && git_repo="."
cd $git_repo > /dev/null 2>&1
if [ $? -ne 0 ]; then
printf "Invalid directory path.\n"
exit 1
fi
function interval(func, wait, times){
var interv = function(w, t){
return function(){
if(typeof t === "undefined" || t-- > 0){
setTimeout(interv, w);
try{
func.call(null);
}
catch(e){
t = 0;
#!/bin/sh
git filter-branch --env-filter '
an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"
if [ "$GIT_COMMITTER_EMAIL" = "your@email.to.match" ]
@larruda
larruda / .htaccess
Created December 31, 2013 15:42
10 .htaccess code snippets you must have in hand.
# Accompanies this blog post:
# http://www.seomoz.org/blog/htaccess-file-snippets-for-seos
# NOTE: This file isn't designed to be used all together, some of the rules will conflict,
# it is meant more as a copy and paste board.
# IMPORTANT: Make sure you test .htaccess changes thoroughly, as it can be easy to make mistakes
# and then you end up in a bad place!
RewriteEngine On
@larruda
larruda / subversion_installer_1.8.sh
Created December 16, 2013 10:53
Install Subversion 1.8.5 on Ubuntu 13.x (from WANDisco)
#!/bin/bash
#
# WANdisco Subversion install script.
# Copyright (C) 2013 WANdisco plc
#
# Please contact opensource@wandisco.com if you have any problems with this
# script.
set -e
@larruda
larruda / jenkins
Created October 9, 2013 12:39
Jenkins standalone (Winstone) init script.
#!/bin/sh
DESC="Jenkins CI Server"
NAME=jenkins
RUN_AS=jenkins
HTTP_PORT=8281
LOGFILE=/var/log/jenkins.log
COMMAND="nohup /usr/bin/java -Dsvnkit.http.sslProtocols=\"SSLv3\" -jar /home/jenkins/jenkins.war --httpPort=$HTTP_PORT > $LOGFILE 2>&1 &"
d_start() {
#!/bin/bash
#
# Original for 5.3 by Ruben Barkow (rubo77) http://www.entikey.z11.de/
# release 1 PHP5.4 to 5.3 by Emil Terziev ( foxy ) Bulgaria
# Originally Posted by Bachstelze http://ubuntuforums.org/showthread.php?p=9080474#post9080474
# OK, here's how to do the Apt magic to get PHP packages from the precise repositories:
echo "Am I root? "
if [ "$(whoami &2>/dev/null)" != "root" ] && [ "$(id -un &2>/dev/null)" != "root" ] ; then