Skip to content

Instantly share code, notes, and snippets.

View valterlobo's full-sized avatar

Valter Lobo valterlobo

View GitHub Profile
@yanaga
yanaga / gist:3024877
Created June 30, 2012 18:04
Código Java para validação do CNS (Cartão Nacional de Saúde)
public boolean isValid(String s) {
if (s.matches("[1-2]\\d{10}00[0-1]\\d") || s.matches("[7-9]\\d{14}")) {
return somaPonderada(s) % 11 == 0;
}
return false;
}
private int somaPonderada(String s) {
char[] cs = s.toCharArray();
int soma = 0;
@izazueta
izazueta / visor-archivos-online.md
Last active July 20, 2023 09:32
Google Docs Viewer & Office Web Apps Viewer

Google Docs Viewer

Only files under 25 MB can be previewed with the Google Drive viewer.

Google Drive viewer helps you preview over 16 different file types, listed below:

  • Image files (.JPEG, .PNG, .GIF, .TIFF, .BMP)
  • Video files (WebM, .MPEG4, .3GPP, .MOV, .AVI, .MPEGPS, .WMV, .FLV)
  • Text files (.TXT)
  • Markup/Code (.CSS, .HTML, .PHP, .C, .CPP, .H, .HPP, .JS)
  • Microsoft Word (.DOC and .DOCX)
@elliottb
elliottb / fabfile.py
Created December 2, 2013 02:26
Example Python Fabric deployment script. Deploys code from a deployment box to a remote host. Usage from command line on the deployment box: fab deploy.
from fabric.api import local, run, env, put
import os, time
# remote ssh credentials
env.hosts = ['10.1.1.25']
env.user = 'deploy'
env.password = 'XXXXXXXX' #ssh password for user
# or, specify path to server public key here:
# env.key_filename = ''
@drorata
drorata / gist:146ce50807d16fd4a6aa
Last active June 3, 2024 06:00
Minimal Working example of Elasticsearch scrolling using Python client
# Initialize the scroll
page = es.search(
index = 'yourIndex',
doc_type = 'yourType',
scroll = '2m',
search_type = 'scan',
size = 1000,
body = {
# Your query's body
})
@chranderson
chranderson / nvmCommands.js
Last active July 23, 2024 09:37
Useful NVM commands
// check version
node -v || node --version
// list locally installed versions of node
nvm ls
// list remove available versions of node
nvm ls-remote
// install specific version of node
@jniltinho
jniltinho / sqlserver-linux-backup.py
Last active October 28, 2021 11:35
SQL Server command line Backup Linux
#!/usr/bin/env python
# -*- coding: utf-8 -*-
## SQL Server command line backup Linux
## On OpenSUSE 42.2 64Bits
## Author: Nilton OS -- www.linuxpro.com.br
## http://stackoverflow.com/questions/880487/sql-server-command-line-backup-statement
## https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-migrate-sqlpackage
## Version: 0.2
### BACKUP SCRIPT SQLSERVER CLI
package main
import (
"fmt"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
)
# https://stackoverflow.com/questions/29102725/go-sql-driver-get-interface-column-values
var myMap = make(map[string]interface{})
rows, err := db.Query("SELECT * FROM myTable")
defer rows.Close()
if err != nil {
log.Fatal(err)
}
colNames, err := rows.Columns()
if err != nil {
@maheshmurthy
maheshmurthy / index.html
Last active June 1, 2023 03:04
index.html with ethers.js
<!DOCTYPE html>
<html>
<head>
<title>Hello World DApp</title>
<link href='https://fonts.googleapis.com/css?family=Open Sans:400,700' rel='stylesheet' type='text/css'>
<link href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css' rel='stylesheet' type='text/css'>
</head>
<body class="container">
<h1>A Simple Hello World Voting Application</h1>
<div class="table-responsive">
@FernandoCelmer
FernandoCelmer / WhatsappMessage.py
Last active June 26, 2024 04:46
Script Python para enviar mensagens automatizadas pelo Whatsapp.
import time
import requests
import webbrowser as web
import pyautogui as pg
import pyttsx3
class WhatsappMessage:
def __init__(self,phone_no, message, time_hour, time_min):