Skip to content

Instantly share code, notes, and snippets.

View fchevitarese's full-sized avatar

Frederico Rodrigues Chevitarese fchevitarese

View GitHub Profile
@iagocaldeira
iagocaldeira / Dockerfile
Created April 18, 2019 18:35
Dockerfile com JDK(+javac), Node, Gradle, Android SDK e Cordova para geração das builds do Android e iOS
# LABEL maintainer="Iago Caldeira <iagocaldeiraa@gmail.com>"
FROM openjdk:8u201-jdk-alpine3.9 as openjdk
# Link javac installation
RUN ln -s /usr/lib/jvm/java-1.8-openjdk/bin/javac /usr/bin/javac
# Node Installation
RUN apk add nodejs-current-npm bash && rm -rf /var/cache/apk/*
# ENV NPM_CONFIG_PREFIX=/home/node/.npm-global \
@edirpedro
edirpedro / estados-brasil.php
Last active July 1, 2024 23:02
Estados do Brasil (Lista, Array)
// Lista
AC, Acre
AL, Alagoas
AP, Amapá
AM, Amazonas
BA, Bahia
CE, Ceará
DF, Distrito Federal
ES, Espirito Santo
@martinapugliese
martinapugliese / boto_dynamodb_methods.py
Last active June 30, 2024 10:00
Some wrapper methods to deal with DynamoDB databases in Python, using boto3.
# Copyright (C) 2016 Martina Pugliese
from boto3 import resource
from boto3.dynamodb.conditions import Key
# The boto3 dynamoDB resource
dynamodb_resource = resource('dynamodb')
def get_table_metadata(table_name):
@eladnava
eladnava / mongodb-s3-backup.sh
Last active March 11, 2024 10:21
Automatically backup a MongoDB database to S3 using mongodump, tar, and awscli (Ubuntu 14.04 LTS)
#!/bin/sh
# Make sure to:
# 1) Name this file `backup.sh` and place it in /home/ubuntu
# 2) Run sudo apt-get install awscli to install the AWSCLI
# 3) Run aws configure (enter s3-authorized IAM user and specify region)
# 4) Fill in DB host + name
# 5) Create S3 bucket for the backups and fill it in below (set a lifecycle rule to expire files older than X days in the bucket)
# 6) Run chmod +x backup.sh
# 7) Test it out via ./backup.sh
@Miserlou
Miserlou / new_key.sh
Last active May 14, 2024 02:23
Generate a new Django SECRET_KEY
python -c 'import random; import string; print "".join([random.SystemRandom().choice(string.digits + string.letters + "!#$%&\()*+,-./:;<=>?@[]^_{|}~" ) for i in range(100)])'
@samirbr
samirbr / Client.js
Last active December 28, 2015 19:58
app.factory('Client', function() {
function Client(obj) {
obj.created = new Date(obj.created);
angular.extend(this, obj);
}
return Client;
});
@renzon
renzon / json_statements.py
Created November 20, 2015 12:31
código para extrair contagem de staments de json
from collections import defaultdict
import json
json_str = '''[{ "metodo": "metodo1()", "statements": 134},
{ "metodo": "metodo2()", "statements": 124},
{ "metodo": "metodo3()", "statements": 110},
{ "metodo": "metodo3()", "statements": 228},
{ "metodo": "metodo4()", "statements": 50}]'''
lst = json.loads(json_str)
@eduardo-matos
eduardo-matos / pre-commit.rb
Last active October 5, 2020 13:58
Don't commit ipdb, debugger, console, and print statements.
#!/usr/bin/env ruby
FORBIDDEN = [
/\bdebugger\b/,
/\bprint\b/,
/\bconsole\.*\b/,
/\bipdb\b/,
/\b\.only\b/,
]
data.forEach(function (harvest) {
var values = harvest.values,
h = new Harvest();
h.id = harvest.id;
h.uuid = harvest.uuid;
h.device = harvest.device;
h.date = harvest.created;
h.values = [];
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote