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
const vm = require("vm")
const Module = require("module")
const array = [1, 2, 3, 4, 5, 6]
const exp = "n => n === 5"
const script = new vm.Script(`
module.exports = (array, exp) => {
return array.filter(eval(\`\${exp}\`))
}
`)
const sandbox = Object.assign(
@Dviejopomata
Dviejopomata / app.component.html
Last active July 2, 2018 22:35
Directive like *ngIf
<h1 *appAuthorization="{resource:'app',operation:'read'}">You now have access to read the resource app</h1>
@Dviejopomata
Dviejopomata / future-example.kt
Created June 25, 2018 15:25
Kotlin future example
import kotlinx.coroutines.experimental.guava.future
import kotlin.system.measureTimeMillis
fun main(arr: Array<String>): Unit {
var metadata = "vavlue"
val t = measureTimeMillis {
val f = future {
val v = 1
Thread.sleep(1500)
@Dviejopomata
Dviejopomata / prueba.csv
Created June 19, 2018 21:16
Copy from postgres with curl and JSON field
nombre { "hello":"world1" }
DAVID {}
JOSE {}
@Dviejopomata
Dviejopomata / package.json
Created June 19, 2018 16:05
Prueba arduino web api
{
"name": "node-server",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"@types/express": "^4.16.0",
"@types/node": "^10.3.4",
"body-parser": "^1.18.3",
"express": "^4.16.3",
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Spreadsheet;
namespace ExcelToCsv
import net = require("net")
import sni = require("sni")
const TCP_PORT = 443
const PORT = "8444"
const CERT_PORT = "8445"
const remotehost = "localhost"
const remoteport = parseInt(PORT, 10)
const remoteCertHost = "localhost"
const remoteCertPort = parseInt(CERT_PORT, 10)
const log = (...str) => {
var http = require('http'),
httpProxy = require('http-proxy');
var url = require('url') ;
//
// Create a proxy server with custom application logic
//
var proxy = httpProxy.createProxyServer({});
//
@Dviejopomata
Dviejopomata / keybindings.json
Created May 11, 2018 13:33
Keyboard vscode
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "ctrl+shift+t",
"command": "workbench.action.terminal.focus"
},
{
"key": "ctrl+shift+l",
"command": "workbench.action.editor.changeLanguageMode"
},
@Dviejopomata
Dviejopomata / ej1
Created March 25, 2018 20:38
Ejercicio1 redes
# En el switch 2 y 3 ejecutamos los comandos como client
vtp mode client
vtp domain UOC
vtp password cisco123
end
# Configuramos la password en el switch 1
line con 0
password cisco123
login