Skip to content

Instantly share code, notes, and snippets.

View barata0's full-sized avatar

Daniel Ribeiro barata0

  • Rio de Janeiro
View GitHub Profile
@barata0
barata0 / .profile
Created July 18, 2016 14:45
Ubuntu bash with colors and path and ll alias
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
@barata0
barata0 / allow-s3-bucket.json
Created December 5, 2016 13:44
Allow Access to s3 specific Bucket
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:ListAllMyBuckets",
"Resource": "arn:aws:s3:::*"
},
{
"Effect": "Allow",
@barata0
barata0 / java_pack_to_jar.bat
Created December 13, 2016 20:41
Altera as extensões dos arquivos .pack para .jar no pacote de instalação JAVA.
for /r %x in (*.pack) do .\bin\unpack200 -r "%x" "%~dx%~px%~nx.jar"
@barata0
barata0 / proxy-server.js
Created December 14, 2016 17:15
A nodejs proxy server e.g. https to http
// To start
// node proxy-server.js REMOTE_ADDR PORT
// REMOTE_ADDR the remote address. eg. https://my-secure-site
// PORT port number to listen
var http = require('http');
var request = require('request');
var url = require('url')
@barata0
barata0 / UrlQueryStringParser.groovy
Created July 16, 2017 15:51
Groovy Url Query String Parser. accepts multiple keys (every key has an array as value) and accept a equal sign = on the query value (
def parseQuery(query) {query.split('&').collect{it.split('\\=', 2)}.groupBy{it[0]}.collectEntries{k, v ->[k, v.collect{it.size() == 2 ? it[1] : ''}]}}
// USAGE EXAMPLE BELOW (uncomment lines below to test)
// def query = 'orange=price=10&orange=color=red&edit&separator==========='
// def queryParameters = parseQuery(query)
// assert queryParameters.toString() == '[orange:[price=10, color=red], edit:[], separator:[==========]]'
// assert queryParameters.orange[0] == 'price=10'
// assert queryParameters.orange[1] == 'color=red'
@barata0
barata0 / ClipList.vue
Created August 29, 2017 02:53
default CRUD vuex store array with samples for creating the modules and how to map module on view
// components/ClipList.vue
<template>
<div>
<h1>{{ clientid }}</h1>
Add: <input v-model="newClip.title" placeholder="Enter a title, then hit [enter]" @keyup.enter="tryCreateClip">
<br />Search: <input v-model="q" placeholder="Enter a title for search, and hit [enter]" @keyup.enter="trySearchClip">
<br />Result: {{searchResult}}
<div class="client">
<ul>
<li v-for="clip in clips">
@barata0
barata0 / parseSTLSubtitle.groovy
Created March 22, 2019 14:05
Parse STL Subtitle
// https://mvnrepository.com/artifact/fr.noop/charset
@Grapes(
@Grab(group='fr.noop', module='charset', version='1.0.1')
)
import static fr.noop.charset.CharsetProvider.*;
def f = new File('C:/Users/danielr/Desktop/legendas/AMERICANHORRORSTORY_6ATS01_ORIG_V473377_INT_C_TVD_SUBFULSTL_29_BPO_178_MOS-XX_RT004242.stl')
@barata0
barata0 / FruitNeo4jSyncService.java
Created August 15, 2019 18:50
Quarkus fruit neo4j sync service
package org.acme.neo4j;
import java.util.ArrayList;
import java.util.List;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import org.neo4j.driver.Driver;
import org.neo4j.driver.Session;
@barata0
barata0 / index.js
Last active August 19, 2019 13:21
cors-proxy reverse-proxy add http headers nodejs node javascript
'use strict'
const express = require('express');
const request = require('request');
const URL = require('url').URL;
const app = express();
const allowedMethods = 'GET, PUT, POST, DELETE, HEAD, PATCH, OPTIONS' // os metodos permitidos
const allowedHeaders = 'Authorization,Content-Type,Accept,X-Amz-Date,X-Api-Key,X-Amz-Security-Token' // os headers permitidos
// const allowedHeaders = 'Accept, Accept-CH, Accept-Charset, Accept-Datetime, Accept-Encoding, Accept-Ext, Accept-Features, Accept-Language, Accept-Params, Accept-Ranges, Access-Control-Allow-Credentials, Access-Control-Allow-Headers, Access-Control-Allow-Methods, Access-Control-Allow-Origin, Access-Control-Expose-Headers, Access-Control-Max-Age, Access-Control-Request-Headers, Access-Control-Request-Method, Age, Allow, Alternates, Authentication-Info, Authorization, C-Ext, C-Man, C-Opt, C-PEP, C-PEP-Info, CONNECT, Cache-Control, Compliance, Connection, Content-Base, Content-Disposition, Content-Encoding, Content-ID, Content-Language, Content-Length, C
@barata0
barata0 / vue.global.js
Created November 11, 2019 01:53
vue 3 global js vue next preview
var Vue = (function (exports) {
'use strict';
// Make a map and return a function for checking if a key
// is in that map.
//
// IMPORTANT: all calls of this function must be prefixed with /*#__PURE__*/
// So that rollup can tree-shake them if necessary.
function makeMap(str, expectsLowerCase) {
const map = Object.create(null);