Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Ribeiro barata0

  • Rio de Janeiro
View GitHub Profile
@barata0
barata0 / mycustomlayout
Last active Aug 12, 2021
xkb symbols para teclado de laptop ABNT2 ficar parecido com US INTERNATIONAL
View mycustomlayout
// file:/usr/share/X11/xkb/symbols/mycustomlayout
default partial alphanumeric_keys
xkb_symbols "mycustomlayout" {
// Based on a very simple Brazilian modified ABNT2 keyboard,
// by Daniel Ribeiro (danieltribeiro@gmail.com).
// With added support for dead keys in I18N applications,
// by Conectiva (http://www.conectiva.com.br).
// the idea is to have almost the us-international with cedil
@barata0
barata0 / vue.global.js
Created Nov 11, 2019
vue 3 global js vue next preview
View vue.global.js
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);
@barata0
barata0 / FruitNeo4jSyncService.java
Created Aug 15, 2019
Quarkus fruit neo4j sync service
View FruitNeo4jSyncService.java
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 Aug 19, 2019
cors-proxy reverse-proxy add http headers nodejs node javascript
View index.js
'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
View parseSTLSubtitle.groovy
// 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 / video-playback-reverse.html
Created Dec 6, 2017
html5 video with positive and negative playbackrates (jog, shuttle and seeking)
View video-playback-reverse.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset='utf-8'>
<title>HTML5 backward playback Video</title>
</head>
<body>
<div>
<video id='video'
width="360"
@barata0
barata0 / ClipList.vue
Created Aug 29, 2017
default CRUD vuex store array with samples for creating the modules and how to map module on view
View ClipList.vue
// 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 / UrlQueryStringParser.groovy
Created Jul 16, 2017
Groovy Url Query String Parser. accepts multiple keys (every key has an array as value) and accept a equal sign = on the query value (
View UrlQueryStringParser.groovy
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 / proxy-server.js
Created Dec 14, 2016
A nodejs proxy server e.g. https to http
View proxy-server.js
// 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 / ignore_ssl.groovy
Created Dec 13, 2016
Ignore SSL certs in groovy
View ignore_ssl.groovy
def nullTrustManager = [
checkClientTrusted: { chain, authType -> },
checkServerTrusted: { chain, authType -> },
getAcceptedIssuers: { null }
]
def nullHostnameVerifier = [
verify: { hostname, session ->
//true
hostname.startsWith('yuml.me')