Skip to content

Instantly share code, notes, and snippets.

View Dviejopomata's full-sized avatar
🏠
Working from home

Dviejo Dviejopomata

🏠
Working from home
  • Alicante, Spain
View GitHub Profile
package main
import (
"flag"
"fmt"
"github.com/hashicorp/go-hclog"
"github.com/hashicorp/go-msgpack/codec"
"github.com/hashicorp/raft"
"io"
"log"
console.log("LMAO");
import { HTMLElement, Node, parse, TextNode } from "node-html-parser";
const btnHtml = `<button type="button" class="relative inline-flex items-center px-4 py-2 rounded-l-md border border-gray-300 bg-white text-sm leading-5 font-medium text-gray-700 hover:text-gray-500 focus:z-10 focus:outline-none focus:border-blue-300 focus:shadow-outline-blue active:bg-gray-100 active:text-gray-700 transition ease-in-out duration-150">
<svg class="-ml-1 mr-2 h-5 w-5 text-gray-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
<path d="M5 4a2 2 0 012-2h6a2 2 0 012 2v14l-5-2.5L5 18V4z" />
</svg>
<b>LMAO</b>
Bookmark
</button>`;
const root = parse(btnHtml, {});
// Place your key bindings in this file to override the defaultsauto[]
[
{
"key": "ctrl+shift+[Backslash]",
"command": "-workbench.action.terminal.new"
},
{
"key": "ctrl+shift+[Backslash]",
"command": "workbench.action.terminal.newInActiveWorkspace"
},
@Dviejopomata
Dviejopomata / schema.py
Created October 18, 2020 11:16
Dynamic Schema Graphene
def resolve_hello(self, info, name):
return "Hello " + name + " " + str(uuid.uuid4())
Query = type('Query', (graphene.ObjectType,), {
'hello': graphene.String(name=graphene.String(default_value="stranger")),
'resolve_hello': resolve_hello,
})
schema = build_schema(query=Query)
graphql_handler = GraphQLApp(schema=schema)
{
"data": {
"data": [
{
"payload": {
"data": {
"actions": [
{
"header": {
"creator": {
{
"data": {
"data": [
{
"payload": {
"data": {
"actions": [
{
"header": {
"creator": {
package uoc.exercise;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.reflect.Array;
import java.util.List;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;
@Dviejopomata
Dviejopomata / index.js
Created April 11, 2020 12:44
Encriptar y desencriptar crypto API
function getMessageEncoding(message) {
let enc = new TextEncoder();
return enc.encode(message);
}
function bufferToStr(buff) {
return String.fromCharCode.apply(null, new Uint8Array(buff));
}
async function main() {
const counter = window.crypto.getRandomValues(new Uint8Array(16));
@Dviejopomata
Dviejopomata / main.kt
Created March 26, 2020 00:15
Transformar de MSAccess a CSV y de SVG a PNG en varios tamaños
package es.kungfusoftware.tools
import com.healthmarketscience.jackcess.DatabaseBuilder
import com.healthmarketscience.jackcess.util.ExportUtil
import org.apache.batik.transcoder.TranscoderInput
import org.apache.batik.transcoder.TranscoderOutput
import org.apache.batik.transcoder.image.PNGTranscoder
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
@Dviejopomata
Dviejopomata / main.dart
Created February 26, 2020 11:39
Extraer tarjeta en flutter
final String creditPattern = r"(\d{4}) (\d{4}) (\d{4}) (\d{4})";
final RegExp cardRegexp = RegExp(creditPattern);
final expPattern = r"(\d{2})\/(\d{2})";
final expRegexp = RegExp(expPattern);
final VisionText visionText =
await textRecognizer.processImage(visionImage);
for (TextBlock block in visionText.blocks) {
for (TextLine line in block.lines) {
if (cardRegexp.hasMatch(line.text)) {