Skip to content

Instantly share code, notes, and snippets.

Avatar
🤔
Thinking

Alisson Nunes Alynva

🤔
Thinking
View GitHub Profile
@Alynva
Alynva / build.js
Created Aug 27, 2021 — 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 Aug 23, 2021 — 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 Feb 14, 2021
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 / setInterval.kt
Created Sep 19, 2018
setInterval in Kotlin
View setInterval.kt
val handler = Handler(Looper.getMainLooper())
val runnable = object : Runnable {
override fun run() {
if (countProgress.progress > 0) {
val new_time = countProgress.progress.toInt() - 1
timeLabel.text = "$new_time segundos"
countProgress.progress = new_time
}
handler.postDelayed(this, 1000)
@Alynva
Alynva / index.js
Created Aug 29, 2020 — 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 Aug 10, 2019
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 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',
@Alynva
Alynva / busy_cop-mapa1.pl
Last active Nov 8, 2018
Trabalho de Inteligência Artificial - Projeto 1 (BCC/UFSCar/2018)
View busy_cop-mapa1.pl
% Trabalho de Inteligência Artificial - Projeto 1 (BCC/UFSCar/2018)
% Autor: Alisson Nunes (R.A.: 725862)
:- write_ln('[MAPA 1 CARREGADO]').
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ladrao([10, 5]) :- !.
policial([10, 1]) :- !.
@Alynva
Alynva / match.cpp
Last active Nov 9, 2017
Analisa duas listas de stings ORDENADAS e retorna outra lista que contém as strings que pertence simultaneamente às duas listas fornecidas.
View match.cpp
/*
Autor:
Alisson Nunes V. A. (www.alynva.com)
Descrição:
Este algoritmo foi desenvolvido com
o propósito de analisar duas listas de
stings ORDENADAS e retornar outra lista
que contém as strings que pertence
simultaneamente às duas listas