Skip to content

Instantly share code, notes, and snippets.

View ivanelson's full-sized avatar

Ivanelson Nunes ivanelson

  • Teresina, PI - BR
View GitHub Profile
@ivanelson
ivanelson / langids.py
Created August 22, 2016 14:15
langids
def langids(self):
print "metodo langids..."
""" Return the USB device's supported language ID codes.
These are 16-bit codes familiar to Windows developers, where for
example instead of en-US you say 0x0409. USB_LANGIDS.pdf on the usb.org
developer site for more info. String requests using a LANGID not
in this array should not be sent to the device.
This property will cause some USB traffic the first time it is accessed
@ivanelson
ivanelson / my_func_plpgsql.sql
Created May 17, 2017 18:00
Sqitch with Declare
BEGIN;
-- XXX Add DDLs here.
DO $$
DECLARE
mydata date;
BEGIN
SELECT INTO mydata CURRENT_DATE;
IF mydata = '2017-03-21' THEN
insert INTO log_os (codfili, codorde,codtecn, hr_log, dt_log, cd_usuario, cd_senha, nr_log,no_historico)
@ivanelson
ivanelson / my.cfg
Created May 22, 2017 22:19
rundeck
#Mon May 22 19:19:14 BRT 2017
#edit below
ansible-ssh-auth-type=privateKey
ansible-ssh-key-storage-path=keys/id_rsa.ansible
project.ansible-become-method=sudo
project.ansible-become-user=ansible
project.ansible-executable=/bin/bash
project.ansible-ssh-auth-type=privateKey
project.ansible-ssh-key-storage-path=keys/id_rsa.ansible
project.ansible-ssh-user=ansible
@ivanelson
ivanelson / .vimrc
Created April 17, 2018 18:43
Meu vim
execute pathogen#infect()
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
"let g:syntastic_auto_loc_list = 1
let g:syntastic_auto_loc_list=2
let g:syntastic_check_on_open = 1
@ivanelson
ivanelson / well.sql
Created August 10, 2018 12:28
add contrainst unique table already exists
ALTER TABLE dbatez.rec_filial drop COLUMN pk_rec_filial;
ALTER TABLE dbatez.rec_filial ADD COLUMN pk_rec_filial bigserial UNIQUE;
ALTER TABLE dbatez.rec_filial ALTER COLUMN pk_rec_filial SET NOT NULL;
ALTER TABLE dbatez.rec_filial ALTER COLUMN pk_rec_filial SET DEFAULT nextval('dbatez.rec_filial_pk_rec_filial_seq'::regclass);
update dbatez.REC_FILIAL set pk_rec_filial = pk_rec_filial;
-- passar o ultimo elementro da sequence
select max(pk_rec_filial) from dbatez.rec_filial;
@ivanelson
ivanelson / 3E5.c
Created November 28, 2018 21:24
3E5 - Divisível por 3 e 4
#include<stdio.h>
#include<math.h>
int main()
{
int numero;
printf("Entre com um numero inteiro: ");
scanf("%d",&numero);
if (((numero % 3)==0) && ((numero % 5)==0)){
@ivanelson
ivanelson / media.c
Created December 11, 2018 19:04
Recebe 3 notas e calcula média de 04 alunos
#include <stdio.h>
#include <stdlib.h>
int main(void) {
// declaração de variáveis
int contador;
float nota1, nota2, nota3, media;
for (contador = 0; contador < 3; contador ++) {
@ivanelson
ivanelson / if-aninhado.c
Last active December 13, 2018 22:06
if's aninhados em C
void main() {
float salario;
char temFilhos;
printf("Digite o salario atual do funcionario: ");
scanf("%f", &salario);
printf("\nVoce possui Filhos? Digite 'S' ou 'N': ");
scanf(" %c", &temFilhos);
@ivanelson
ivanelson / forloop.c
Created December 14, 2018 14:14
For loop in "C"
#include <stdio.h>
#include <stdlib.h>
void main() {
float nota, soma=0, media;
int conta;
for (conta = 0; conta <= 9; conta++) {
printf("Digite a nota: ");
scanf("%f", &nota);
@ivanelson
ivanelson / celsius-to-fahrenheit.c
Created December 14, 2018 14:42
Convert Celsius to Fahrenheit in "C"
#include <stdio.h>
#include <stdlib.h>
/*
F=1,8C + 32
*/
void main() {
float soma=0;
int valorInicial, valorFinal, contador;
printf("Digite o valor da temperatura inicial: \n");