Skip to content

Instantly share code, notes, and snippets.

View DevNvll's full-sized avatar

Henrick Mello DevNvll

  • Rio de Janeiro, Brazil
View GitHub Profile
@DevNvll
DevNvll / remove_node_modules_recursively.ps1
Created November 25, 2020 01:28 — forked from SynCap/remove_node_modules_recursively.ps1
Remove `node_modules` folders in Windows in all subfolders recursively with PowerShell to avoid exceeding path max_length
<#
Note: Eliminate `-WhatIf` parameter to get action be actually done
Note: PS with version prior to 4.0 can't delete non-empty folders
#>
Get-ChildItem -Path "." -Include "node_modules" -Recurse -Directory | Remove-Item -Recurse -Force -WhatIf
@DevNvll
DevNvll / remove-instances.js
Created January 15, 2018 13:21
Script to remove running instances before creating new Now deployment. Useful for bots.
const NowClient = require('now-client')
const now = new NowClient()
console.log('> Running deployment script')
now.getDeployments().then(deployments => {
console.log('> Removing active deployments')
const active = deployments.filter(deploy => deploy.name === require('../package.json').name && deploy.scale.current >= 1)
if(active.length >= 1)
active.forEach(deploy => now.deleteDeployment(deploy.uid).then(removed => console.log('> Removed deployment %s', deploy.url)))
function checkToken(req, res, next) {
var token = req.body.token || req.query.token || req.headers['x-access-token'];
if (token) {
jwt.verify(token, app.get('secret'), function(err, decoded) {
if (err) {
return res.json({ success: false, code: 'TOKEN_FAIL', message: 'Token inváido' });
} else {
req.decoded = decoded;
next();
}
@DevNvll
DevNvll / index.js
Last active January 10, 2018 06:04
const express = require('express')
const bodyParser = require('body-parser')
const app = express()
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({extended: false}))
const usuarios = [
{
@DevNvll
DevNvll / index.js
Last active January 10, 2018 06:04
const express = require('express')
const bodyParser = require('body-parser')
const app = express()
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({extended: false}))
app.get('/', (req, res) => {
res.send('Hello World')
Verifying my Blockstack ID is secured with the address 1FGkYWJwmgfFBhEhr4qjDADE3rXw7vKmEd https://explorer.blockstack.org/address/1FGkYWJwmgfFBhEhr4qjDADE3rXw7vKmEd
@DevNvll
DevNvll / Account.java
Last active November 13, 2017 13:55
hmp_bank
package HMP_Bank;
public class Account {
public int id;
private double saldo = 0;
private String senha;
public String usuario;
public Cliente cliente;
@DevNvll
DevNvll / Ex401.java
Last active October 15, 2017 19:01
Lista 4
package Lista4;
import java.util.Scanner;
public class Ex401 {
public static void main(String[] args){
Scanner s = new Scanner(System.in);
int[] vet = new int[5];
for(int x = 0; x < 5; x++) {
System.out.println("Digite um número: ");
@DevNvll
DevNvll / Ex301.java
Last active October 15, 2017 00:04
Lista 3 Java
package Lista3;
import java.util.Scanner;
public class Ex301 {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
double x = 0;
do {
System.out.println("Digite uma nota entre 0 e 10");
@DevNvll
DevNvll / Ex201.java
Last active September 26, 2017 23:46
Lista2 Java
package com.company;
import java.util.Scanner;
public class Ex201 {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.print("Digite um número: ");
int num1 = s.nextInt();
System.out.print("Digite outro número: ");