This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// const { Client, Location, List, Buttons, LocalAuth } = require('./index'); | |
import pkg from 'whatsapp-web.js' | |
const { Client, Location, List, Buttons, LocalAuth } = pkg | |
const client = new Client({ | |
authStrategy: new LocalAuth(), | |
puppeteer: { headless: false } | |
}) | |
// const browser = await puppeteer.launch({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Quick start-stop-daemon example, derived from Debian /etc/init.d/ssh | |
set -e | |
# Must be a valid filename | |
NAME=foo | |
PIDFILE=/var/run/$NAME.pid | |
#This is the command to be run, give the full pathname | |
DAEMON=/usr/local/bin/bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { memo, useState, useEffect } from 'react' | |
import memoize from 'memoize-one' | |
import isEqual from 'lodash.isequal' | |
const equalFn = (newArg, lastArg) => isEqual(newArg, lastArg) | |
const range = (start, end) => [...Array(end - start).keys()].map(k => k + start) | |
const getPager = memoize((totalItems, currentPage, pageSize) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
import { Command } from 'commander' | |
import got from 'got' | |
import fs from 'fs' | |
const fsp = fs.promises | |
const LOOP_DELAY = 100 | |
async function read(tempFile) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import client from './mongodb.js' | |
import { transformObject, convertToDate } from './utils.js' | |
;(async () => { | |
const nfeDB = client.db('nfeServiceDB') | |
const nfeCollection = nfeDB.collection('nfe') | |
const count = await nfeCollection.countDocuments({ vs: '1.0', 'NFe.infNFe.ide.dhEmi': { $type: 'string' } }) | |
// eslint-disable-next-line no-console | |
console.log('count', count) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
352206041550260006745506400012822013044218431,aasdsad, asdsad, asda, ACP559, 94.6 | |
352206041550260006745506400012822013044218431,aasdsad, asdsad, asda, ART9614, 131.05 | |
find - Mongo | |
lines = [] | |
for (const nfe of nfes) { | |
// const dets = findAll det (nfe._id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { css as transformStyleObject, get } from '@theme-ui/css' | |
import { useTheme } from '@emotion/react' | |
import { css as createClassName } from '@emotion/css' | |
import { IMaskInput } from 'react-imask' | |
const MaskedInput = React.forwardRef(({ __themeKey = 'forms', __css, variant = 'input', sx, style, ...rest }, ref) => { | |
const theme = useTheme() | |
const autofillStyles = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find and replace text in multiple files | |
# http://www.24hourapps.com/2009/03/linux-tips-17-find-and-replace-text-in.html | |
# Multiple file find and replace is a rarely used, but an extremely time saving, ability of | |
# Linux that I cannot live without. It can be achieved by chaining a few commands together | |
# to get the list of files you want to change (find), make sure the files contain the strings | |
# you want to replace (grep), and do the replacements (sed). | |
# Lets say we have a lot of code that uses the function registerUser that was implemented when | |
# there was only one class of users, but now another class of users need to access the system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
const fsp = require('fs').promises; | |
const { program } = require('commander'); | |
const got = require('got'); | |
const AVERAGE_QTY = 10; | |
const LOOP_DELAY = 100; | |
async function read(tempFile) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
const fs = require('fs'); | |
const AWS = require('aws-sdk'); | |
const { program } = require('commander'); | |
const execa = require('execa'); | |
program | |
.option('-d, --db-name <name>', 'Database') | |
.option('-p, --db-password <pass>', 'Database password') |
NewerOlder