Skip to content

Instantly share code, notes, and snippets.

Avatar
🤔
Thinking

Alisson Nunes Alynva

🤔
Thinking
View GitHub Profile
@Alynva
Alynva / Waiter.js
Last active September 15, 2022 16:35
G-Node utility to wait until a packet is intercepted with promise and timeout.
View Waiter.js
import { EventEmitter } from 'node:events'
import { Extension, HDirection, HMessage } from "gnode-api"
const sleep = ms => new Promise(res => setTimeout(res, ms))
/**
* Usage:
* ```
* const waiter = new Waiter(ext)
@Alynva
Alynva / basic_operators_rewrite.js
Last active February 25, 2022 18:54
Operators && and || rewritten without using the operator itself
View basic_operators_rewrite.js
const and = (...args) => args.every(x => x)
const and = (a, b) => !!(!!(a || b) ^ !!a ^ !!b)
const and = (...args) => args.reduce((a, b) => !!(!!(a || b) ^ !!a ^ !!b), true)
const and = (...args) => args.length ? args.shift() ? and(...args) : false : true
const or = (...args) => args.some(x => x)
@Alynva
Alynva / data.js
Last active December 30, 2021 03:48
Academia Wired Wired data
View data.js
var imgNotSet = "//3.bp.blogspot.com/-Rs07YEwFur0/WAefWDtX_wI/AAAAAAABpZA/srKBCUrVz4Eh6RMUtTaeLs47d1MZuu_ywCLcB/s1600/aten%25C3%25A7%25C3%25A3o%2521.gif";
function MyInfo() {
this.updated = "19/10/2016";
this.banner = imgNotSet;
this.theCatgs = [];
this.sortInfo = function(sortBy = null) {
if (sortBy) {
} else {
@Alynva
Alynva / build.js
Created August 27, 2021 21:00 — forked from si458/build.js
build script for pkg with icon and metainfo
View build.js
if (process.argv[2] == undefined) process.exit(0);
if (process.argv[2] == "") process.exit(0);
const { pkg_fetch_version, node_version, pkg_cache_path, icon, version, description, company, name, copyright, file } = require(`./${process.argv[2]}.json`);
const ResEdit = require('resedit');
const { DownloaderHelper } = require('node-downloader-helper');
const path = require("path");
const fs = require('fs');
process.env['PKG_CACHE_PATH'] = path.join(__dirname, pkg_cache_path);
const pkg_fetch = path.join(process.env['PKG_CACHE_PATH'], `v${pkg_fetch_version}`);
const fetched = path.join(pkg_fetch, `fetched-v${node_version}-win-x64`);
@Alynva
Alynva / gist:00dd85a3a13e4fcb9bea3b1f0e7ac142
Created August 23, 2021 18:55 — forked from eighteyes/gist:04c43b6e7c18d8591f2060d75f5aa68f
NodeJS : Spawn STDIN / STDOUT messaging to node process inside a Docker container
View gist:00dd85a3a13e4fcb9bea3b1f0e7ac142
// This is the outside in approach, where the parent process is not within Docker, but the child lives in a docker image.
var externalNodeProcess = require('child_process').spawn('docker', [
'run',
'-a', 'stdin', '-a', 'stdout', '-a','stderr',
'-i',
'image/name:tag',
'node','index.js'
], {
stdio: ['pipe', 'pipe', 'pipe']
@Alynva
Alynva / index.html
Created February 14, 2021 17:54
jackedgson/crunker demo
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Crunker example</title>
<script src="https://unpkg.com/crunker@0.4.0/dist/crunker.js" ></script>
<style>
form {
display: flex;
@Alynva
Alynva / index.js
Created August 29, 2020 13:26 — forked from talk2MeGooseman/index.js
Firebase Cloud Function 3rd Party Oauth Flow For The Web
View index.js
const functions = require('firebase-functions');
var admin = require("firebase-admin");
const cookieParser = require('cookie-parser');
const crypto = require('crypto');
var serviceAccount = require("./service-account.json");
const APP_NAME = "twitch-playground";
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
@Alynva
Alynva / Masonry.jsx
Last active August 10, 2019 22:57
An short script to craete a Masonry layout
View Masonry.jsx
import React, { useEffect } from "react";
import ReactDOM from 'react-dom';
import { useRefCallback } from "../utils";
export default function MasonryPage({children, numCols = 2}) {
const [masonryRef, setMasonryRef] = useRefCallback()
useEffect(() => {
const colHeights = Array(numCols).fill(0)
const container = ReactDOM.findDOMNode(masonryRef.current)
View farm_data_all.json
This file has been truncated, but you can view the full file.
[{"substancia":"CITRATO DE CLOMIFENO","laboratorio":"MEDLEY FARMACÊUTICA LTDA","ean1":"7896422513098","produto":"CLOMID","apresentacao":"50 MG COM CT BL AL PLAS INC X 10","tipo":"Novo (Referência)","tarja":"Tarja Vermelha","nForma":"comprimido","nApresentacao":"50 MG","nQtd":"10"},{"substancia":"ESTRADIOL HEMI-HIDRATADO","laboratorio":"TEVA FARMACÊUTICA LTDA.","ean1":"7898919603138","produto":"ESTREVA","apresentacao":"0,1 PCC GEL CT CART FR PLAS OP X 50 G","tipo":"Novo (Referência)","tarja":"Tarja Vermelha"},{"substancia":"RISPERIDONA","laboratorio":"RANBAXY FARMACÊUTICA LTDA","ean1":"7897076920966","produto":"RISPERIDONA","apresentacao":"2 MG COM REV CT BL AL PLAS TRANS X 500","tipo":"Genérico","tarja":"Tarja Vermelha","nForma":"comprimido","nApresentacao":"2 MG","nQtd":"500"},{"substancia":"BESILATO DE LEVANLODIPINO","laboratorio":"EMS S/A","ean1":"7896004763255","produto":"ATELOP","apresentacao":"5 MG COM CT BL AL PLAS OPC X 30","tipo":"Similar","tarja":"Tarja Vermelha","nForma":"comprimido","nApresentacao
View key_codes.js
const keyCodes = {
0: 'That key has no keycode',
3: 'break',
8: 'backspace / delete',
9: 'tab',
12: 'clear',
13: 'enter',
16: 'shift',
17: 'ctrl',
18: 'alt',